зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland.
This commit is contained in:
Коммит
4941b2389f
|
@ -149,11 +149,10 @@ export function toggleBreakpointsAtLine(
|
|||
export function removeAllBreakpoints(cx: Context) {
|
||||
return async ({ dispatch, getState }: ThunkArgs) => {
|
||||
const breakpointList = getBreakpointsList(getState());
|
||||
dispatch({ type: "REMOVE_BREAKPOINTS" });
|
||||
|
||||
return Promise.all(
|
||||
await Promise.all(
|
||||
breakpointList.map(bp => dispatch(removeBreakpoint(cx, bp)))
|
||||
);
|
||||
dispatch({ type: "REMOVE_BREAKPOINTS" });
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -482,13 +482,8 @@ bool WebGLContext::CreateAndInitGL(
|
|||
|
||||
if (IsWebGL2()) {
|
||||
flags |= gl::CreateContextFlags::PREFER_ES3;
|
||||
} else {
|
||||
// Request and prefer ES2 context for WebGL1.
|
||||
flags |= gl::CreateContextFlags::PREFER_EXACT_VERSION;
|
||||
|
||||
if (!StaticPrefs::webgl_1_allow_core_profiles()) {
|
||||
flags |= gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE;
|
||||
}
|
||||
} else if (!StaticPrefs::webgl_1_allow_core_profiles()) {
|
||||
flags |= gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE;
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -5328,6 +5328,7 @@ subsuite = webgl2-core
|
|||
fail-if = (os == 'linux')
|
||||
[generated/test_2_conformance2__rendering__draw-with-integer-texture-base-level.html]
|
||||
subsuite = webgl2-core
|
||||
fail-if = (os == 'win' && processor != "aarch64") #aarch64 has unexpected pass in 1525750, also see 1536182
|
||||
[generated/test_2_conformance2__rendering__element-index-uint.html]
|
||||
subsuite = webgl2-core
|
||||
[generated/test_2_conformance2__rendering__framebuffer-completeness-draw-framebuffer.html]
|
||||
|
@ -8092,7 +8093,6 @@ subsuite = webgl2-ext
|
|||
subsuite = webgl2-ext
|
||||
[generated/test_2_conformance__glsl__misc__shaders-with-invariance.html]
|
||||
subsuite = webgl2-ext
|
||||
fail-if = 1 # https://github.com/KhronosGroup/WebGL/pull/2908
|
||||
[generated/test_2_conformance__glsl__misc__shaders-with-mis-matching-uniforms.html]
|
||||
subsuite = webgl2-ext
|
||||
[generated/test_2_conformance__glsl__misc__shaders-with-mis-matching-varyings.html]
|
||||
|
@ -10822,6 +10822,7 @@ subsuite = webgl1-core
|
|||
subsuite = webgl1-core
|
||||
[generated/test_conformance__canvas__viewport-unchanged-upon-resize.html]
|
||||
subsuite = webgl1-core
|
||||
skip-if = (os == 'mac')
|
||||
[generated/test_conformance__context__constants-and-properties.html]
|
||||
subsuite = webgl1-core
|
||||
[generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html]
|
||||
|
@ -11529,7 +11530,6 @@ subsuite = webgl1-ext
|
|||
subsuite = webgl1-ext
|
||||
[generated/test_conformance__glsl__misc__shaders-with-invariance.html]
|
||||
subsuite = webgl1-ext
|
||||
fail-if = 1 # https://github.com/KhronosGroup/WebGL/pull/2908
|
||||
[generated/test_conformance__glsl__misc__shaders-with-mis-matching-uniforms.html]
|
||||
subsuite = webgl1-ext
|
||||
[generated/test_conformance__glsl__misc__shaders-with-mis-matching-varyings.html]
|
||||
|
|
|
@ -179,12 +179,6 @@ fail-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1563418
|
|||
[generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html]
|
||||
fail-if = 1
|
||||
|
||||
[generated/test_conformance__glsl__misc__shaders-with-invariance.html]
|
||||
fail-if = 1 # https://github.com/KhronosGroup/WebGL/pull/2908
|
||||
|
||||
[generated/test_2_conformance__glsl__misc__shaders-with-invariance.html]
|
||||
fail-if = 1 # https://github.com/KhronosGroup/WebGL/pull/2908
|
||||
|
||||
########################################################################
|
||||
# Complicated
|
||||
|
||||
|
@ -1076,6 +1070,8 @@ skip-if = (os == 'win' && os_version == '6.1')
|
|||
skip-if = (os == 'win')
|
||||
[generated/test_2_conformance2__buffers__get-buffer-sub-data.html]
|
||||
skip-if = (os == 'win')
|
||||
[generated/test_2_conformance2__rendering__draw-with-integer-texture-base-level.html]
|
||||
fail-if = (os == 'win' && processor != "aarch64") #aarch64 has unexpected pass in 1525750, also see 1536182
|
||||
[generated/test_2_conformance__rendering__preservedrawingbuffer-leak.html]
|
||||
skip-if = (os == 'win')
|
||||
[generated/test_conformance__context__context-size-change.html]
|
||||
|
|
|
@ -1 +1 @@
|
|||
chromium/3865
|
||||
chromium/3729
|
||||
|
|
|
@ -33,16 +33,12 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.khronos.org/registry/egl
|
||||
**
|
||||
** Khronos $Git commit SHA1: d738c39fe2 $ on $Git commit date: 2019-06-14 16:17:31 -0600 $
|
||||
** Khronos $Git commit SHA1: 4136522c4d $ on $Git commit date: 2018-12-06 03:51:22 -0800 $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#ifndef EGL_EGL_PROTOTYPES
|
||||
#define EGL_EGL_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Generated on date 20190716 */
|
||||
/* Generated on date 20181214 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
|
|
|
@ -202,40 +202,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
|
|||
#endif
|
||||
#endif /* EGL_CHROMIUM_get_sync_values */
|
||||
|
||||
#ifndef EGL_ANGLE_power_preference
|
||||
#define EGL_ANGLE_power_preference 1
|
||||
#define EGL_POWER_PREFERENCE_ANGLE 0x3482
|
||||
#define EGL_LOW_POWER_ANGLE 0x0001
|
||||
#define EGL_HIGH_POWER_ANGLE 0x0002
|
||||
#endif /* EGL_ANGLE_power_preference */
|
||||
|
||||
#ifndef EGL_ANGLE_feature_control
|
||||
#define EGL_ANGLE_feature_control 1
|
||||
#define EGL_FEATURE_NAME_ANGLE 0x3460
|
||||
#define EGL_FEATURE_CATEGORY_ANGLE 0x3461
|
||||
#define EGL_FEATURE_DESCRIPTION_ANGLE 0x3462
|
||||
#define EGL_FEATURE_BUG_ANGLE 0x3463
|
||||
#define EGL_FEATURE_STATUS_ANGLE 0x3464
|
||||
#define EGL_FEATURE_COUNT_ANGLE 0x3465
|
||||
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
|
||||
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_feature_control */
|
||||
|
||||
#ifndef EGL_ANGLE_image_d3d11_texture
|
||||
#define EGL_D3D11_TEXTURE_ANGLE 0x3484
|
||||
#endif /* EGL_ANGLE_image_d3d11_texture */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_backwards_compatible
|
||||
#define EGL_ANGLE_create_context_backwards_compatible 1
|
||||
#define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE 0x3483
|
||||
#endif /* EGL_ANGLE_create_context_backwards_compatible */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
|
|
|
@ -660,26 +660,6 @@ GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUM(GLuint program, GLint
|
|||
#endif
|
||||
#endif /* GL_CHROMIUM_bind_uniform_location */
|
||||
|
||||
/* GL_CHROMIUM_lose_context */
|
||||
#ifndef GL_CHROMIUM_lose_context
|
||||
#define GL_CHROMIUM_lose_context 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glLoseContextCHROMIUM(GLenum current, GLenum other);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMPROC) (GLenum current, GLenum other);
|
||||
#endif /* GL_CHROMIUM_lose_context */
|
||||
|
||||
#ifndef GL_ANGLE_texture_external_update
|
||||
#define GL_ANGLE_texture_external_update 1
|
||||
#define GL_TEXTURE_NATIVE_ID_ANGLE 0x3481
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DEXTERNALANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATETEXTUREANGLEPROC) (GLenum target);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glTexImage2DExternalANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glInvalidateTextureANGLE (GLenum target);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_texture_external_update */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
|
|
|
@ -155,18 +155,11 @@ typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTCONTEXTANGLEPROC)(GLeglCo
|
|||
typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
|
||||
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *memoryObjects);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *fences);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *memoryObjects);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *ids);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *semaphores);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *arrays);
|
||||
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
|
@ -179,19 +172,16 @@ typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESCONTEXTANGLEPROC)(GLeg
|
|||
typedef void (GL_APIENTRYP PFNGLENDQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *fences);
|
||||
typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *ids);
|
||||
typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *semaphores);
|
||||
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *arrays);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, void **params);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTCONTEXTANGLEPROC)(GLeglContext ctx);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, void **params);
|
||||
|
@ -204,26 +194,18 @@ typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTCONTEXTANGLEPROC)(GLeglConte
|
|||
typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum pname, GLuint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLubyte *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLubyte *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum handleType, GLint fd);
|
||||
typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei length, const GLchar *marker);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
|
||||
typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum access);
|
||||
typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count);
|
||||
typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRCONTEXTANGLEPROC)(GLeglContext ctx);
|
||||
|
@ -236,26 +218,17 @@ typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTCONTEXTANGLEPROC)(GLeglContext ctx
|
|||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum pname, const GLuint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSETFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum condition);
|
||||
typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
|
||||
typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum components);
|
||||
typedef void (GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
|
||||
|
@ -363,9 +336,6 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)
|
|||
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum current, GLenum other);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DEXTERNALANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATETEXTUREANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader);
|
||||
|
@ -514,18 +484,11 @@ GL_APICALL void GL_APIENTRY glBindFragDataLocationEXTContextANGLE(GLeglContext c
|
|||
GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glBindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
|
||||
GL_APICALL void GL_APIENTRY glBlitFramebufferANGLEContextANGLE(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
GL_APICALL void GL_APIENTRY glBufferStorageMemEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *memoryObjects);
|
||||
GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHRContextANGLE(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
|
||||
GL_APICALL void GL_APIENTRY glDebugMessageControlKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
GL_APICALL void GL_APIENTRY glDebugMessageInsertKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFencesNVContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *fences);
|
||||
GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *memoryObjects);
|
||||
GL_APICALL void GL_APIENTRY glDeleteQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids);
|
||||
GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *semaphores);
|
||||
GL_APICALL void GL_APIENTRY glDeleteVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays);
|
||||
GL_APICALL void GL_APIENTRY glDiscardFramebufferEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
|
@ -538,19 +501,16 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOESContextANGLE(GLeglContex
|
|||
GL_APICALL void GL_APIENTRY glEndQueryEXTContextANGLE(GLeglContext ctx, GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glFinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
|
||||
GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture3DOESContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVRContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
GL_APICALL void GL_APIENTRY glGenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences);
|
||||
GL_APICALL void GL_APIENTRY glGenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
|
||||
GL_APICALL void GL_APIENTRY glGenSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *semaphores);
|
||||
GL_APICALL void GL_APIENTRY glGenVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferPointervOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, void **params);
|
||||
GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHRContextANGLE(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
|
||||
GL_APICALL void GL_APIENTRY glGetFenceivNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXTContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx);
|
||||
GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx, GLuint memoryObject, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
GL_APICALL void GL_APIENTRY glGetPointervKHRContextANGLE(GLeglContext ctx, GLenum pname, void **params);
|
||||
|
@ -563,26 +523,18 @@ GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXTContextANGLE(GLeglContext ctx,
|
|||
GL_APICALL void GL_APIENTRY glGetQueryivEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum pname, GLuint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
|
||||
GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXTContextANGLE(GLeglContext ctx, GLenum pname, GLubyte *data);
|
||||
GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLubyte *data);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformfvEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformivEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glImportMemoryFdEXTContextANGLE(GLeglContext ctx, GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
|
||||
GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum handleType, GLint fd);
|
||||
GL_APICALL void GL_APIENTRY glInsertEventMarkerEXTContextANGLE(GLeglContext ctx, GLsizei length, const GLchar *marker);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXTContextANGLE(GLeglContext ctx, GLuint memoryObject);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsQueryEXTContextANGLE(GLeglContext ctx, GLuint id);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
|
||||
GL_APICALL void *GL_APIENTRY glMapBufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum access);
|
||||
GL_APICALL void *GL_APIENTRY glMapBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx, GLuint count);
|
||||
GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx, GLuint memoryObject, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
|
||||
GL_APICALL void GL_APIENTRY glObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
|
||||
GL_APICALL void GL_APIENTRY glPopDebugGroupKHRContextANGLE(GLeglContext ctx);
|
||||
|
@ -595,26 +547,17 @@ GL_APICALL void GL_APIENTRY glReadnPixelsEXTContextANGLE(GLeglContext ctx, GLint
|
|||
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
|
||||
GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum pname, const GLuint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glSetFenceNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum condition);
|
||||
GL_APICALL void GL_APIENTRY glSignalSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
|
||||
GL_APICALL GLboolean GL_APIENTRY glTestFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
|
||||
GL_APICALL void GL_APIENTRY glTexImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexStorage1DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
GL_APICALL void GL_APIENTRY glTexStorage2DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glTexStorage3DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOESContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem2DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem3DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY glWaitSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
|
||||
GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components);
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
|
||||
|
@ -722,7 +665,4 @@ GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedANGLEContextANGLE(GLeglC
|
|||
GL_APICALL void GL_APIENTRY glGetMultisamplefvANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
|
||||
GL_APICALL void GL_APIENTRY glSampleMaskiANGLEContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glLoseContextCHROMIUMContextANGLE(GLeglContext ctx, GLenum current, GLenum other);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2DExternalANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glInvalidateTextureANGLEContextANGLE(GLeglContext ctx, GLenum target);
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 209
|
||||
#define ANGLE_SH_VERSION 205
|
||||
|
||||
enum ShShaderSpec
|
||||
{
|
||||
|
@ -38,8 +38,6 @@ enum ShShaderSpec
|
|||
|
||||
SH_GLES3_1_SPEC,
|
||||
SH_WEBGL3_SPEC,
|
||||
|
||||
SH_GL3_3_SPEC,
|
||||
};
|
||||
|
||||
enum ShShaderOutput
|
||||
|
@ -276,16 +274,6 @@ const ShCompileOptions SH_EMULATE_GL_DRAW_ID = UINT64_C(1) << 40;
|
|||
// another webpage/application.
|
||||
const ShCompileOptions SH_INIT_SHARED_VARIABLES = UINT64_C(1) << 41;
|
||||
|
||||
// Forces the value returned from an atomic operations to be always be resolved. This is targeted to
|
||||
// workaround a bug in NVIDIA D3D driver where the return value from
|
||||
// RWByteAddressBuffer.InterlockedAdd does not get resolved when used in the .yzw components of a
|
||||
// RWByteAddressBuffer.Store operation. Only has an effect on HLSL translation.
|
||||
// http://anglebug.com/3246
|
||||
const ShCompileOptions SH_FORCE_ATOMIC_VALUE_RESOLUTION = UINT64_C(1) << 42;
|
||||
|
||||
// Rewrite gl_BaseVertex and gl_BaseInstance as uniform int
|
||||
const ShCompileOptions SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE = UINT64_C(1) << 43;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
enum ShArrayIndexClampingStrategy
|
||||
{
|
||||
|
@ -331,15 +319,12 @@ struct ShBuiltInResources
|
|||
int EXT_shader_framebuffer_fetch;
|
||||
int NV_shader_framebuffer_fetch;
|
||||
int ARM_shader_framebuffer_fetch;
|
||||
int OVR_multiview;
|
||||
int OVR_multiview2;
|
||||
int EXT_YUV_target;
|
||||
int EXT_geometry_shader;
|
||||
int OES_texture_storage_multisample_2d_array;
|
||||
int OES_texture_3D;
|
||||
int ANGLE_texture_multisample;
|
||||
int ANGLE_multi_draw;
|
||||
int ANGLE_base_vertex_base_instance;
|
||||
|
||||
// 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
|
||||
|
@ -672,14 +657,6 @@ inline bool IsWebGLBasedSpec(ShShaderSpec spec)
|
|||
{
|
||||
return (spec == SH_WEBGL_SPEC || spec == SH_WEBGL2_SPEC || spec == SH_WEBGL3_SPEC);
|
||||
}
|
||||
|
||||
//
|
||||
// Helper function to identify DesktopGL specs
|
||||
//
|
||||
inline bool IsDesktopGLSpec(ShShaderSpec spec)
|
||||
{
|
||||
return spec == SH_GL3_3_SPEC;
|
||||
}
|
||||
} // namespace sh
|
||||
|
||||
#endif // GLSLANG_SHADERLANG_H_
|
||||
|
|
|
@ -1,171 +0,0 @@
|
|||
//
|
||||
// Copyright 2019 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.
|
||||
//
|
||||
// Feature.h: Definition of structs to hold feature/workaround information.
|
||||
//
|
||||
|
||||
#ifndef ANGLE_PLATFORM_FEATURE_H_
|
||||
#define ANGLE_PLATFORM_FEATURE_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
enum class FeatureCategory
|
||||
{
|
||||
FrontendWorkarounds,
|
||||
OpenGLWorkarounds,
|
||||
D3DWorkarounds,
|
||||
D3DCompilerWorkarounds,
|
||||
VulkanWorkarounds,
|
||||
VulkanFeatures,
|
||||
};
|
||||
|
||||
constexpr char kFeatureCategoryFrontendWorkarounds[] = "Frontend workarounds";
|
||||
constexpr char kFeatureCategoryOpenGLWorkarounds[] = "OpenGL workarounds";
|
||||
constexpr char kFeatureCategoryD3DWorkarounds[] = "D3D workarounds";
|
||||
constexpr char kFeatureCategoryD3DCompilerWorkarounds[] = "D3D compiler workarounds";
|
||||
constexpr char kFeatureCategoryVulkanWorkarounds[] = "Vulkan workarounds";
|
||||
constexpr char kFeatureCategoryVulkanFeatures[] = "Vulkan features";
|
||||
constexpr char kFeatureCategoryUnknown[] = "Unknown";
|
||||
|
||||
inline const char *FeatureCategoryToString(const FeatureCategory &fc)
|
||||
{
|
||||
switch (fc)
|
||||
{
|
||||
case FeatureCategory::FrontendWorkarounds:
|
||||
return kFeatureCategoryFrontendWorkarounds;
|
||||
break;
|
||||
|
||||
case FeatureCategory::OpenGLWorkarounds:
|
||||
return kFeatureCategoryOpenGLWorkarounds;
|
||||
break;
|
||||
|
||||
case FeatureCategory::D3DWorkarounds:
|
||||
return kFeatureCategoryD3DWorkarounds;
|
||||
break;
|
||||
|
||||
case FeatureCategory::D3DCompilerWorkarounds:
|
||||
return kFeatureCategoryD3DCompilerWorkarounds;
|
||||
break;
|
||||
|
||||
case FeatureCategory::VulkanWorkarounds:
|
||||
return kFeatureCategoryVulkanWorkarounds;
|
||||
break;
|
||||
|
||||
case FeatureCategory::VulkanFeatures:
|
||||
return kFeatureCategoryVulkanFeatures;
|
||||
break;
|
||||
|
||||
default:
|
||||
return kFeatureCategoryUnknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr char kFeatureStatusEnabled[] = "enabled";
|
||||
constexpr char kFeatureStatusDisabled[] = "disabled";
|
||||
|
||||
inline const char *FeatureStatusToString(const bool &status)
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
return kFeatureStatusEnabled;
|
||||
}
|
||||
return kFeatureStatusDisabled;
|
||||
}
|
||||
|
||||
struct Feature;
|
||||
|
||||
using FeatureMap = std::map<std::string, Feature *>;
|
||||
using FeatureList = std::vector<const Feature *>;
|
||||
|
||||
struct Feature
|
||||
{
|
||||
Feature(const Feature &other);
|
||||
Feature(const char *name,
|
||||
const FeatureCategory &category,
|
||||
const char *description,
|
||||
FeatureMap *const mapPtr,
|
||||
const char *bug);
|
||||
~Feature();
|
||||
|
||||
// The name of the workaround, lowercase, camel_case
|
||||
const char *const name;
|
||||
|
||||
// The category that the workaround belongs to. Eg. "Vulkan workarounds"
|
||||
const FeatureCategory category;
|
||||
|
||||
// A short description to be read by the user.
|
||||
const char *const description;
|
||||
|
||||
// A link to the bug, if any
|
||||
const char *const bug;
|
||||
|
||||
// Whether the workaround is enabled or not. Determined by heuristics like vendor ID and
|
||||
// version, but may be overriden to any value.
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
inline Feature::Feature(const Feature &other) = default;
|
||||
inline Feature::Feature(const char *name,
|
||||
const FeatureCategory &category,
|
||||
const char *description,
|
||||
FeatureMap *const mapPtr,
|
||||
const char *bug = "")
|
||||
: name(name), category(category), description(description), bug(bug), enabled(false)
|
||||
{
|
||||
if (mapPtr != nullptr)
|
||||
{
|
||||
(*mapPtr)[std::string(name)] = this;
|
||||
}
|
||||
}
|
||||
|
||||
inline Feature::~Feature() = default;
|
||||
|
||||
struct FeatureSetBase
|
||||
{
|
||||
public:
|
||||
FeatureSetBase();
|
||||
~FeatureSetBase();
|
||||
|
||||
private:
|
||||
// Non-copyable
|
||||
FeatureSetBase(const FeatureSetBase &other) = delete;
|
||||
FeatureSetBase &operator=(const FeatureSetBase &other) = delete;
|
||||
|
||||
protected:
|
||||
FeatureMap members = FeatureMap();
|
||||
|
||||
public:
|
||||
void overrideFeatures(const std::vector<std::string> &feature_names, const bool enabled)
|
||||
{
|
||||
for (const std::string &name : feature_names)
|
||||
{
|
||||
if (members.find(name) != members.end())
|
||||
{
|
||||
members[name]->enabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populateFeatureList(FeatureList *features) const
|
||||
{
|
||||
for (FeatureMap::const_iterator it = members.begin(); it != members.end(); it++)
|
||||
{
|
||||
features->push_back(it->second);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inline FeatureSetBase::FeatureSetBase() = default;
|
||||
inline FeatureSetBase::~FeatureSetBase() = default;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_WORKAROUND_H_
|
|
@ -1,222 +0,0 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// FeaturesD3D.h: Features and workarounds for D3D driver bugs and other issues.
|
||||
|
||||
#ifndef ANGLE_PLATFORM_FEATURESD3D_H_
|
||||
#define ANGLE_PLATFORM_FEATURESD3D_H_
|
||||
|
||||
#include "platform/Feature.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
// Workarounds attached to each shader. Do not need to expose information about these workarounds so
|
||||
// a simple bool struct suffices.
|
||||
struct CompilerWorkaroundsD3D
|
||||
{
|
||||
bool skipOptimization = false;
|
||||
|
||||
bool useMaxOptimization = false;
|
||||
|
||||
// IEEE strictness needs to be enabled for NANs to work.
|
||||
bool enableIEEEStrictness = false;
|
||||
};
|
||||
|
||||
struct FeaturesD3D : FeatureSetBase
|
||||
{
|
||||
FeaturesD3D();
|
||||
~FeaturesD3D();
|
||||
|
||||
// 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.
|
||||
Feature mrtPerfWorkaround = {
|
||||
"mrt_perf_workaround", FeatureCategory::D3DWorkarounds,
|
||||
"Some NVIDIA D3D11 drivers have a bug where they ignore null render targets", &members};
|
||||
|
||||
Feature setDataFasterThanImageUpload = {"set_data_faster_than_image_upload",
|
||||
FeatureCategory::D3DWorkarounds,
|
||||
"Set data faster than image upload", &members};
|
||||
|
||||
// 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.
|
||||
Feature zeroMaxLodWorkaround = {
|
||||
"zero_max_lod", FeatureCategory::D3DWorkarounds,
|
||||
"D3D11 is missing an option to disable mipmaps on a mipmapped texture", &members};
|
||||
|
||||
// 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.
|
||||
Feature useInstancedPointSpriteEmulation = {
|
||||
"use_instanced_point_sprite_emulation", FeatureCategory::D3DWorkarounds,
|
||||
"Some D3D11 renderers do not support geometry shaders for pointsprite emulation", &members};
|
||||
|
||||
// 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)
|
||||
Feature depthStencilBlitExtraCopy = {
|
||||
"depth_stencil_blit_extra_copy", FeatureCategory::D3DWorkarounds,
|
||||
"Bug in NVIDIA D3D11 Driver version <=347.88 and >368.81 triggers a TDR when using "
|
||||
"CopySubresourceRegion from a staging texture to a depth/stencil",
|
||||
&members, "http://anglebug.com/1452"};
|
||||
|
||||
// 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.
|
||||
Feature expandIntegerPowExpressions = {
|
||||
"expand_integer_pow_expressions", FeatureCategory::D3DWorkarounds,
|
||||
"The HLSL optimizer has a bug with optimizing 'pow' in certain integer-valued expressions",
|
||||
&members};
|
||||
|
||||
// NVIDIA drivers sometimes write out-of-order results to StreamOut buffers when transform
|
||||
// feedback is used to repeatedly write to the same buffer positions.
|
||||
Feature flushAfterEndingTransformFeedback = {
|
||||
"flush_after_ending_transform_feedback", FeatureCategory::D3DWorkarounds,
|
||||
"NVIDIA drivers sometimes write out-of-order results to StreamOut buffers when transform "
|
||||
"feedback is used to repeatedly write to the same buffer positions",
|
||||
&members};
|
||||
|
||||
// Some drivers (NVIDIA) do not take into account the base level of the texture in the results
|
||||
// of the HLSL GetDimensions builtin.
|
||||
Feature getDimensionsIgnoresBaseLevel = {
|
||||
"get_dimensions_ignores_base_level", FeatureCategory::D3DWorkarounds,
|
||||
"Some NVIDIA drivers do not take into account the base level of the "
|
||||
"texture in the results of the HLSL GetDimensions builtin",
|
||||
&members};
|
||||
|
||||
// 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.
|
||||
Feature preAddTexelFetchOffsets = {
|
||||
"pre_add_texel_fetch_offsets", FeatureCategory::D3DWorkarounds,
|
||||
"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",
|
||||
&members};
|
||||
|
||||
// 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.
|
||||
Feature emulateTinyStencilTextures = {
|
||||
"emulate_tiny_stencil_textures", FeatureCategory::D3DWorkarounds,
|
||||
"On some AMD drivers, 1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly",
|
||||
&members};
|
||||
|
||||
// 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.
|
||||
// On older AMD drivers, the data in DXGI_FORMAT_B5G6R5_UNORM becomes corrupted for unknown
|
||||
// reasons.
|
||||
Feature disableB5G6R5Support = {"disable_b5g6r5_support", FeatureCategory::D3DWorkarounds,
|
||||
"On Intel and AMD drivers, textures with the format "
|
||||
"DXGI_FORMAT_B5G6R5_UNORM have incorrect data",
|
||||
&members};
|
||||
|
||||
// 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.
|
||||
Feature rewriteUnaryMinusOperator = {
|
||||
"rewrite_unary_minus_operator", FeatureCategory::D3DWorkarounds,
|
||||
"On some Intel drivers, evaluating unary minus operator on integer may "
|
||||
"get wrong answer in vertex shaders",
|
||||
&members};
|
||||
|
||||
// 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.
|
||||
Feature emulateIsnanFloat = {
|
||||
"emulate_isnan_float", FeatureCategory::D3DWorkarounds,
|
||||
"On some Intel drivers, using isnan() on highp float will get wrong answer", &members,
|
||||
"https://crbug.com/650547"};
|
||||
|
||||
// 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
|
||||
Feature callClearTwice = {"call_clear_twice", FeatureCategory::D3DWorkarounds,
|
||||
"On some Intel drivers, using clear() may not take effect", &members,
|
||||
"https://crbug.com/655534"};
|
||||
|
||||
// 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.
|
||||
Feature useSystemMemoryForConstantBuffers = {
|
||||
"use_system_memory_for_constant_buffers", FeatureCategory::D3DWorkarounds,
|
||||
"On some Intel drivers, copying from staging storage to constant buffer "
|
||||
"storage does not work",
|
||||
&members, "https://crbug.com/593024"};
|
||||
|
||||
// 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.
|
||||
Feature selectViewInGeometryShader = {
|
||||
"select_view_in_geometry_shader", FeatureCategory::D3DWorkarounds,
|
||||
"The viewport or render target slice will be selected in the geometry shader stage for "
|
||||
"the ANGLE_multiview extension",
|
||||
&members};
|
||||
|
||||
// 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
|
||||
Feature addDummyTextureNoRenderTarget = {
|
||||
"add_dummy_texture_no_render_target", FeatureCategory::D3DWorkarounds,
|
||||
"On D3D ntel drivers <4815 when rendering with no render target, two "
|
||||
"bugs lead to incorrect behavior",
|
||||
&members, "http://anglebug.com/2152"};
|
||||
|
||||
// Don't use D3D constant register zero when allocating space for uniforms in the vertex shader.
|
||||
// This is targeted to work around a bug in NVIDIA D3D driver version 388.59 where in very
|
||||
// specific cases the driver would not handle constant register zero correctly.
|
||||
Feature skipVSConstantRegisterZero = {
|
||||
"skip_vs_constant_register_zero", FeatureCategory::D3DWorkarounds,
|
||||
"On NVIDIA D3D driver v388.59 in specific cases the driver doesn't "
|
||||
"handle constant register zero correctly",
|
||||
&members};
|
||||
|
||||
// Forces the value returned from an atomic operations to be always be resolved. This is
|
||||
// targeted to workaround a bug in NVIDIA D3D driver where the return value from
|
||||
// RWByteAddressBuffer.InterlockedAdd does not get resolved when used in the .yzw components of
|
||||
// a RWByteAddressBuffer.Store operation. Only has an effect on HLSL translation.
|
||||
// http://anglebug.com/3246
|
||||
Feature forceAtomicValueResolution = {
|
||||
"force_atomic_value_resolution", FeatureCategory::D3DWorkarounds,
|
||||
"On an NVIDIA D3D driver, the return value from RWByteAddressBuffer.InterlockedAdd does "
|
||||
"not resolve when used in the .yzw components of a RWByteAddressBuffer.Store operation",
|
||||
&members, "http://anglebug.com/3246"};
|
||||
|
||||
// Match chromium's robust resource init behaviour by always prefering to upload texture data
|
||||
// instead of clearing. Clear calls have been observed to cause texture corruption for some
|
||||
// formats.
|
||||
Feature allowClearForRobustResourceInit = {
|
||||
"allow_clear_for_robust_resource_init", FeatureCategory::D3DWorkarounds,
|
||||
"Some drivers corrupt texture data when clearing for robust resource initialization.",
|
||||
&members, "http://crbug.com/941620"};
|
||||
};
|
||||
|
||||
inline FeaturesD3D::FeaturesD3D() = default;
|
||||
inline FeaturesD3D::~FeaturesD3D() = default;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_FEATURESD3D_H_
|
|
@ -1,341 +0,0 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// FeaturesGL.h: Features and workarounds for GL driver bugs and other issues.
|
||||
|
||||
#ifndef ANGLE_PLATFORM_FEATURESGL_H_
|
||||
#define ANGLE_PLATFORM_FEATURESGL_H_
|
||||
|
||||
#include "platform/Feature.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
struct FeaturesGL : FeatureSetBase
|
||||
{
|
||||
FeaturesGL();
|
||||
~FeaturesGL();
|
||||
|
||||
// When writing a float to a normalized integer framebuffer, desktop OpenGL is allowed to write
|
||||
// one of the two closest normalized integer representations (although round to nearest is
|
||||
// preferred) (see section 2.3.5.2 of the GL 4.5 core specification). OpenGL ES requires that
|
||||
// round-to-nearest is used (see "Conversion from Floating-Point to Framebuffer Fixed-Point" in
|
||||
// section 2.1.2 of the OpenGL ES 2.0.25 spec). This issue only shows up on Intel and AMD
|
||||
// drivers on framebuffer formats that have 1-bit alpha, work around this by using higher
|
||||
// precision formats instead.
|
||||
Feature avoid1BitAlphaTextureFormats = {
|
||||
"avoid_1_bit_alpha_texture_formats", FeatureCategory::OpenGLWorkarounds,
|
||||
"Issue on Intel and AMD drivers with 1-bit alpha framebuffer formats", &members};
|
||||
|
||||
// On some older Intel drivers, GL_RGBA4 is not color renderable, glCheckFramebufferStatus
|
||||
// returns GL_FRAMEBUFFER_UNSUPPORTED. Work around this by using a known color-renderable
|
||||
// format.
|
||||
Feature rgba4IsNotSupportedForColorRendering = {
|
||||
"rgba4_is_not_supported_for_color_rendering", FeatureCategory::OpenGLWorkarounds,
|
||||
"Issue on older Intel drivers, GL_RGBA4 is not color renderable", &members};
|
||||
|
||||
// When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the
|
||||
// driver clears to the linearized clear color despite the framebuffer not supporting SRGB
|
||||
// blending. It only seems to do this when the framebuffer has only linear attachments, mixed
|
||||
// attachments appear to get the correct clear color.
|
||||
Feature doesSRGBClearsOnLinearFramebufferAttachments = {
|
||||
"does_srgb_clears_on_linear_framebuffer_attachments", FeatureCategory::OpenGLWorkarounds,
|
||||
"Issue clearing framebuffers with linear attachments on Intel or AMD "
|
||||
"drivers when GL_FRAMEBUFFER_SRGB is enabled",
|
||||
&members};
|
||||
|
||||
// On Mac some GLSL constructs involving do-while loops cause GPU hangs, such as the following:
|
||||
// int i = 1;
|
||||
// do {
|
||||
// i --;
|
||||
// continue;
|
||||
// } while (i > 0)
|
||||
// Work around this by rewriting the do-while to use another GLSL construct (block + while)
|
||||
Feature doWhileGLSLCausesGPUHang = {
|
||||
"do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Mac, some GLSL constructs involving do-while loops cause GPU hangs", &members};
|
||||
|
||||
// Calling glFinish doesn't cause all queries to report that the result is available on some
|
||||
// (NVIDIA) drivers. It was found that enabling GL_DEBUG_OUTPUT_SYNCHRONOUS before the finish
|
||||
// causes it to fully finish.
|
||||
Feature finishDoesNotCauseQueriesToBeAvailable = {
|
||||
"finish_does_not_cause_queries_to_be_available", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some NVIDIA drivers, glFinish doesn't cause all queries to report available result",
|
||||
&members};
|
||||
|
||||
// Always call useProgram after a successful link to avoid a driver bug.
|
||||
// This workaround is meant to reproduce the use_current_program_after_successful_link
|
||||
// workaround in Chromium (http://crbug.com/110263). It has been shown that this workaround is
|
||||
// not necessary for MacOSX 10.9 and higher (http://crrev.com/39eb535b).
|
||||
Feature alwaysCallUseProgramAfterLink = {
|
||||
"always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds,
|
||||
"Always call useProgram after a successful link to avoid a driver bug", &members};
|
||||
|
||||
// In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row.
|
||||
Feature unpackOverlappingRowsSeparatelyUnpackBuffer = {
|
||||
"unpack_overlapping_rows_separately_unpack_buffer", FeatureCategory::OpenGLWorkarounds,
|
||||
"In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row",
|
||||
&members};
|
||||
|
||||
// In the case of packing to a pixel pack buffer, pack overlapping rows row by row.
|
||||
Feature packOverlappingRowsSeparatelyPackBuffer = {
|
||||
"pack_overlapping_rows_separately_pack_buffer", FeatureCategory::OpenGLWorkarounds,
|
||||
"In the case of packing to a pixel pack buffer, pack overlapping rows row by row",
|
||||
&members};
|
||||
|
||||
// During initialization, assign the current vertex attributes to the spec-mandated defaults.
|
||||
Feature initializeCurrentVertexAttributes = {
|
||||
"initialize_current_vertex_attributes", FeatureCategory::OpenGLWorkarounds,
|
||||
"During initialization, assign the current vertex attributes to the spec-mandated defaults",
|
||||
&members};
|
||||
|
||||
// abs(i) where i is an integer returns unexpected result on Intel Mac.
|
||||
// Emulate abs(i) with i * sign(i).
|
||||
Feature emulateAbsIntFunction = {
|
||||
"emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Intel Mac, abs(i) where i is an integer returns unexpected result", &members};
|
||||
|
||||
// On Intel Mac, calculation of loop conditions in for and while loop has bug.
|
||||
// Add "&& true" to the end of the condition expression to work around the bug.
|
||||
Feature addAndTrueToLoopCondition = {
|
||||
"add_and_true_to_loop_condition", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Intel Mac, calculation of loop conditions in for and while loop has bug", &members};
|
||||
|
||||
// When uploading textures from an unpack buffer, some drivers count an extra row padding when
|
||||
// checking if the pixel unpack buffer is big enough. Tracking bug: http://anglebug.com/1512
|
||||
// For example considering the pixel buffer below where in memory, each row data (D) of the
|
||||
// texture is followed by some unused data (the dots):
|
||||
// +-------+--+
|
||||
// |DDDDDDD|..|
|
||||
// |DDDDDDD|..|
|
||||
// |DDDDDDD|..|
|
||||
// |DDDDDDD|..|
|
||||
// +-------A--B
|
||||
// The last pixel read will be A, but the driver will think it is B, causing it to generate an
|
||||
// error when the pixel buffer is just big enough.
|
||||
Feature unpackLastRowSeparatelyForPaddingInclusion = {
|
||||
"unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,
|
||||
"When uploading textures from an unpack buffer, some drivers count an extra row padding",
|
||||
&members};
|
||||
|
||||
// Equivalent workaround when uploading data from a pixel pack buffer.
|
||||
Feature packLastRowSeparatelyForPaddingInclusion = {
|
||||
"pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,
|
||||
"When uploading textures from an pack buffer, some drivers count an extra row padding",
|
||||
&members};
|
||||
|
||||
// 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: http://crbug.com/650547
|
||||
Feature emulateIsnanFloat = {
|
||||
"emulate_isnan_float", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some Intel drivers, using isnan() on highp float will get wrong answer", &members};
|
||||
|
||||
// On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be
|
||||
// treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a
|
||||
// unused std140 or shared uniform block at the beginning of main to work around it.
|
||||
// Also used on Linux AMD.
|
||||
Feature useUnusedBlocksWithStandardOrSharedLayout = {
|
||||
"use_unused_blocks_with_standard_or_shared_layout", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Mac with OpenGL version 4.1 and Linux AMD, unused std140 or shared uniform blocks "
|
||||
"will be treated as inactive",
|
||||
&members};
|
||||
|
||||
// This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3.
|
||||
Feature removeInvariantAndCentroidForESSL3 = {
|
||||
"remove_invarient_and_centroid_for_essl3", FeatureCategory::OpenGLWorkarounds,
|
||||
"Fix spec difference between GLSL 4.1 or lower and ESSL3", &members};
|
||||
|
||||
// On Intel Mac OSX 10.11 driver, using "-float" will get wrong answer. Use "0.0 - float" to
|
||||
// replace "-float".
|
||||
// Tracking bug: http://crbug.com/308366
|
||||
Feature rewriteFloatUnaryMinusOperator = {
|
||||
"rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Intel Mac OSX 10.11 driver, using '-<float>' will get wrong answer", &members,
|
||||
"http://crbug.com/308366"};
|
||||
|
||||
// On NVIDIA drivers, atan(y, x) may return a wrong answer.
|
||||
// Tracking bug: http://crbug.com/672380
|
||||
Feature emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds,
|
||||
"On NVIDIA drivers, atan(y, x) may return a wrong answer",
|
||||
&members, "http://crbug.com/672380"};
|
||||
|
||||
// Some drivers seem to forget about UBO bindings when using program binaries. Work around
|
||||
// this by re-applying the bindings after the program binary is loaded or saved.
|
||||
// This only seems to affect AMD OpenGL drivers, and some Android devices.
|
||||
// http://anglebug.com/1637
|
||||
Feature reapplyUBOBindingsAfterUsingBinaryProgram = {
|
||||
"reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds,
|
||||
"Some AMD OpenGL drivers and Android devices forget about UBO bindings "
|
||||
"when using program binaries",
|
||||
&members, "http://anglebug.com/1637"};
|
||||
|
||||
// Some OpenGL drivers return 0 when we query MAX_VERTEX_ATTRIB_STRIDE in an OpenGL 4.4 or
|
||||
// higher context.
|
||||
// This only seems to affect AMD OpenGL drivers.
|
||||
// Tracking bug: http://anglebug.com/1936
|
||||
Feature emulateMaxVertexAttribStride = {
|
||||
"emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds,
|
||||
"Some AMD OpenGL >= 4.4 drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members,
|
||||
"http://anglebug.com/1936"};
|
||||
|
||||
// Initializing uninitialized locals caused odd behavior on Mac in a few WebGL 2 tests.
|
||||
// Tracking bug: http://anglebug/2041
|
||||
Feature dontInitializeUninitializedLocals = {
|
||||
"dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds,
|
||||
"On Mac initializing uninitialized locals caused odd behavior in a few WebGL 2 tests",
|
||||
&members, "http://anglebug.com/2041"};
|
||||
|
||||
// On some NVIDIA drivers the point size range reported from the API is inconsistent with the
|
||||
// actual behavior. Clamp the point size to the value from the API to fix this.
|
||||
Feature clampPointSize = {
|
||||
"clamp_point_size", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some NVIDIA drivers the point size range reported from the API is "
|
||||
"inconsistent with the actual behavior",
|
||||
&members};
|
||||
|
||||
// On some NVIDIA drivers certain types of GLSL arithmetic ops mixing vectors and scalars may be
|
||||
// executed incorrectly. Change them in the shader translator. Tracking bug:
|
||||
// http://crbug.com/772651
|
||||
Feature rewriteVectorScalarArithmetic = {
|
||||
"rewrite_vector_scalar_arithmetic", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some NVIDIA drivers certain types of GLSL arithmetic ops mixing "
|
||||
"vectors and scalars may be executed incorrectly",
|
||||
&members, "http://crbug.com/772651"};
|
||||
|
||||
// On some Android devices for loops used to initialize variables hit native GLSL compiler bugs.
|
||||
Feature dontUseLoopsToInitializeVariables = {
|
||||
"dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some Android devices for loops used to initialize variables hit "
|
||||
"native GLSL compiler bugs",
|
||||
&members};
|
||||
|
||||
// On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating
|
||||
// point depth buffer. Clamp it in the translated shader to fix this.
|
||||
Feature clampFragDepth = {"clamp_frag_depth", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some NVIDIA drivers gl_FragDepth is not clamped correctly when "
|
||||
"rendering to a floating point depth buffer",
|
||||
&members};
|
||||
|
||||
// On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a
|
||||
// GLSL user-defined function have incorrect results. Rewrite this type of statements to fix
|
||||
// this.
|
||||
Feature rewriteRepeatedAssignToSwizzled = {
|
||||
"rewrite_repeated_assign_to_swizzled", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some NVIDIA drivers < v397.31, repeated assignment to swizzled "
|
||||
"values inside a GLSL user-defined function have incorrect results",
|
||||
&members};
|
||||
// On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests.
|
||||
// It might be possible to work around the Intel bug by rewriting *FragData to *FragColor
|
||||
// instead of disabling the functionality entirely. The AMD bug looked like incorrect blending,
|
||||
// not sure if a workaround is feasible. http://anglebug.com/1085
|
||||
Feature disableBlendFuncExtended = {
|
||||
"disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests",
|
||||
&members, "http://anglebug.com/1085"};
|
||||
|
||||
// Qualcomm drivers returns raw sRGB values instead of linearized values when calling
|
||||
// glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and
|
||||
// http://crbug.com/565179
|
||||
Feature unsizedsRGBReadPixelsDoesntTransform = {
|
||||
"unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds,
|
||||
"Qualcomm drivers returns raw sRGB values instead of linearized values "
|
||||
"when calling glReadPixels on unsized sRGB texture formats",
|
||||
&members, "http://crbug.com/565179"};
|
||||
|
||||
// Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex:
|
||||
// GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS). http://anglebug.com/3027
|
||||
Feature queryCounterBitsGeneratesErrors = {
|
||||
"query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds,
|
||||
"Older Qualcomm drivers generate errors when querying the number of bits in timer queries",
|
||||
&members, "http://anglebug.com/3027"};
|
||||
|
||||
// Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android
|
||||
// platforms.
|
||||
// http://anglebug.com/3045
|
||||
Feature dontRelinkProgramsInParallel = {
|
||||
"dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds,
|
||||
"On some Intel Windows OpenGL drivers and Android, relinking a program "
|
||||
"in parallel is buggy",
|
||||
&members, "http://anglebug.com/3045"};
|
||||
|
||||
// Some tests have been seen to fail using worker contexts, this switch allows worker contexts
|
||||
// to be disabled for some platforms. http://crbug.com/849576
|
||||
Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds,
|
||||
"Some tests have been seen to fail using worker contexts",
|
||||
&members, "http://crbug.com/849576"};
|
||||
|
||||
// Most Android devices fail to allocate a texture that is larger than 4096. Limit the caps
|
||||
// instead of generating GL_OUT_OF_MEMORY errors. Also causes system to hang on some older
|
||||
// intel mesa drivers on Linux.
|
||||
Feature limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096",
|
||||
FeatureCategory::OpenGLWorkarounds,
|
||||
"Limit max texture size to 4096 to avoid frequent "
|
||||
"out-of-memory errors on Android or Intel Linux",
|
||||
&members, "http://crbug.com/927470"};
|
||||
|
||||
// Prevent excessive MSAA allocations on Android devices, various rendering bugs have been
|
||||
// observed and they tend to be high DPI anyways. http://crbug.com/797243
|
||||
Feature limitMaxMSAASamplesTo4 = {
|
||||
"max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds,
|
||||
"Various rendering bugs have been observed when using higher MSAA counts on Android",
|
||||
&members, "http://crbug.com/797243"};
|
||||
|
||||
// Prefer to do the robust resource init clear using a glClear. Calls to TexSubImage2D on large
|
||||
// textures can take hundreds of milliseconds because of slow uploads on macOS. Do this only on
|
||||
// macOS because clears are buggy on other drivers.
|
||||
// https://crbug.com/848952 (slow uploads on macOS)
|
||||
// https://crbug.com/883276 (buggy clears on Android)
|
||||
Feature allowClearForRobustResourceInit = {
|
||||
"allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds,
|
||||
"Using glClear for robust resource initialization is buggy on some drivers and leads to "
|
||||
"texture corruption. Default to data uploads except on MacOS where it is very slow.",
|
||||
&members, "http://crbug.com/883276"};
|
||||
|
||||
// Some drivers automatically handle out-of-bounds uniform array access but others need manual
|
||||
// clamping to satisfy the WebGL requirements.
|
||||
Feature clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds,
|
||||
"Clamp uniform array access to avoid reading invalid memory.",
|
||||
&members, "http://anglebug.com/2978"};
|
||||
|
||||
// Reset glTexImage2D base level to workaround pixel comparison failure above Mac OS 10.12.4 on
|
||||
// Intel Mac.
|
||||
Feature resetTexImage2DBaseLevel = {"reset_teximage2d_base_level",
|
||||
FeatureCategory::OpenGLWorkarounds,
|
||||
"Reset texture base level before calling glTexImage2D to "
|
||||
"work around pixel comparison failure.",
|
||||
&members, "https://crbug.com/705865"};
|
||||
|
||||
// glClearColor does not always work on Intel 6xxx Mac drivers when the clear color made up of
|
||||
// all zeros and ones.
|
||||
Feature clearToZeroOrOneBroken = {
|
||||
"clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds,
|
||||
"Clears when the clear color is all zeros or ones do not work.", &members,
|
||||
"https://crbug.com/710443"};
|
||||
|
||||
// Some older Linux Intel mesa drivers will hang the system when allocating large textures. Fix
|
||||
// this by capping the max texture size.
|
||||
Feature limitMax3dArrayTextureSizeTo1024 = {
|
||||
"max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds,
|
||||
"Limit max 3d texture size and max array texture layers to 1024 to avoid system hang on "
|
||||
"older Intel Linux",
|
||||
&members, "http://crbug.com/927470"};
|
||||
|
||||
// BlitFramebuffer has issues on some platforms with large source/dest texture sizes. This
|
||||
// workaround adjusts the destination rectangle source and dest rectangle to fit within maximum
|
||||
// twice the size of the framebuffer.
|
||||
Feature adjustSrcDstRegionBlitFramebuffer = {
|
||||
"adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,
|
||||
"Many platforms have issues with blitFramebuffer when the parameters are large.", &members,
|
||||
"http://crbug.com/830046"};
|
||||
};
|
||||
|
||||
inline FeaturesGL::FeaturesGL() = default;
|
||||
inline FeaturesGL::~FeaturesGL() = default;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_FEATURESGL_H_
|
|
@ -9,25 +9,18 @@
|
|||
#ifndef ANGLE_PLATFORM_FEATURESVK_H_
|
||||
#define ANGLE_PLATFORM_FEATURESVK_H_
|
||||
|
||||
#include "platform/Feature.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
struct FeaturesVk : FeatureSetBase
|
||||
struct FeaturesVk
|
||||
{
|
||||
FeaturesVk();
|
||||
~FeaturesVk();
|
||||
|
||||
// Line segment rasterization must follow OpenGL rules. This means using an algorithm similar
|
||||
// to Bresenham's. Vulkan uses a different algorithm. This feature enables the use of pixel
|
||||
// shader patching to implement OpenGL basic line rasterization rules. This feature will
|
||||
// normally always be enabled. Exposing it as an option enables performance testing.
|
||||
Feature basicGLLineRasterization = {
|
||||
"basic_gl_line_rasterization", FeatureCategory::VulkanFeatures,
|
||||
"Enable the use of pixel shader patching to implement OpenGL basic line "
|
||||
"rasterization rules",
|
||||
&members};
|
||||
bool basicGLLineRasterization = false;
|
||||
|
||||
// Flips the viewport to render upside-down. This has the effect to render the same way as
|
||||
// OpenGL. If this feature gets enabled, we enable the KHR_MAINTENANCE_1 extension to allow
|
||||
|
@ -42,153 +35,45 @@ struct FeaturesVk : FeatureSetBase
|
|||
// -generating mipmaps
|
||||
// -Point sprites tests
|
||||
// -texStorage
|
||||
Feature flipViewportY = {"flip_viewport_y", FeatureCategory::VulkanFeatures,
|
||||
"Flips the viewport to render upside-down", &members};
|
||||
bool flipViewportY = false;
|
||||
|
||||
// Add an extra copy region when using vkCmdCopyBuffer as the Windows Intel driver seems
|
||||
// to have a bug where the last region is ignored.
|
||||
Feature extraCopyBufferRegion = {
|
||||
"extra_copy_buffer_region", FeatureCategory::VulkanWorkarounds,
|
||||
"Windows Intel driver seems to have a bug where the last copy region in "
|
||||
"vkCmdCopyBuffer is ignored",
|
||||
&members};
|
||||
bool extraCopyBufferRegion = false;
|
||||
|
||||
// This flag is added for the sole purpose of end2end tests, to test the correctness
|
||||
// of various algorithms when a fallback format is used, such as using a packed format to
|
||||
// emulate a depth- or stencil-only format.
|
||||
Feature forceFallbackFormat = {"force_fallback_format", FeatureCategory::VulkanWorkarounds,
|
||||
"Force a fallback format for angle_end2end_tests", &members};
|
||||
bool forceFallbackFormat = false;
|
||||
|
||||
// On some NVIDIA drivers the point size range reported from the API is inconsistent with the
|
||||
// actual behavior. Clamp the point size to the value from the API to fix this.
|
||||
// Tracked in http://anglebug.com/2970.
|
||||
Feature clampPointSize = {
|
||||
"clamp_point_size", FeatureCategory::VulkanWorkarounds,
|
||||
"On some NVIDIA drivers, the point size range reported from the API is "
|
||||
"inconsistent with the actual behavior",
|
||||
&members, "http://anglebug.com/2970"};
|
||||
bool clampPointSize = false;
|
||||
|
||||
// On some android devices, the memory barrier between the compute shader that converts vertex
|
||||
// attributes and the vertex shader that reads from it is ineffective. Only known workaround is
|
||||
// to perform a flush after the conversion. http://anglebug.com/3016
|
||||
Feature flushAfterVertexConversion = {
|
||||
"flush_after_vertex_conversion", FeatureCategory::VulkanWorkarounds,
|
||||
"On some android devices, the memory barrier between the compute shader that converts "
|
||||
"vertex attributes and the vertex shader that reads from it is ineffective",
|
||||
&members, "http://anglebug.com/3016"};
|
||||
bool flushAfterVertexConversion = false;
|
||||
|
||||
// Whether the VkDevice supports the VK_KHR_incremental_present extension, on which the
|
||||
// EGL_KHR_swap_buffers_with_damage extension can be layered.
|
||||
Feature supportsIncrementalPresent = {
|
||||
"supports_incremental_present", FeatureCategory::VulkanFeatures,
|
||||
"VkDevice supports the VK_KHR_incremental_present extension", &members};
|
||||
bool supportsIncrementalPresent = false;
|
||||
|
||||
// Whether texture copies on cube map targets should be done on GPU. This is a workaround for
|
||||
// Intel drivers on windows that have an issue with creating single-layer views on cube map
|
||||
// textures.
|
||||
Feature forceCpuPathForCubeMapCopy = {
|
||||
"force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds,
|
||||
"Some Intel Windows drivers have an issue with creating single-layer "
|
||||
"views on cube map textures",
|
||||
&members};
|
||||
bool forceCpuPathForCubeMapCopy = false;
|
||||
|
||||
// Whether the VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer
|
||||
// extension, on which the EGL_ANDROID_image_native_buffer extension can be layered.
|
||||
Feature supportsAndroidHardwareBuffer = {
|
||||
"supports_android_hardware_buffer", FeatureCategory::VulkanFeatures,
|
||||
"VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension",
|
||||
&members};
|
||||
|
||||
// Whether the VkDevice supports the VK_KHR_external_memory_fd extension, on which the
|
||||
// GL_EXT_memory_object_fd extension can be layered.
|
||||
Feature supportsExternalMemoryFd = {
|
||||
"supports_external_memory_fd", FeatureCategory::VulkanFeatures,
|
||||
"VkDevice supports the VK_KHR_external_memory_fd extension", &members};
|
||||
|
||||
// Whether the VkDevice supports the VK_KHR_external_semaphore_fd extension, on which the
|
||||
// GL_EXT_semaphore_fd extension can be layered.
|
||||
Feature supportsExternalSemaphoreFd = {
|
||||
"supports_external_semaphore_fd", FeatureCategory::VulkanFeatures,
|
||||
"VkDevice supports the VK_KHR_external_semaphore_fd extension", &members};
|
||||
|
||||
// Whether the VkDevice supports the VK_EXT_shader_stencil_export extension, which is used to
|
||||
// perform multisampled resolve of stencil buffer. A multi-step workaround is used instead if
|
||||
// this extension is not available.
|
||||
Feature supportsShaderStencilExport = {
|
||||
"supports_shader_stencil_export", FeatureCategory::VulkanFeatures,
|
||||
"VkDevice supports the VK_EXT_shader_stencil_export extension", &members};
|
||||
|
||||
// Where VK_EXT_transform_feedback is not support, an emulation path is used.
|
||||
// http://anglebug.com/3205
|
||||
Feature emulateTransformFeedback = {
|
||||
"emulate_transform_feedback", FeatureCategory::VulkanFeatures,
|
||||
"Emulate transform feedback as the VK_EXT_transform_feedback is not present.", &members,
|
||||
"http://anglebug.com/3205"};
|
||||
bool supportsAndroidHardwareBuffer = false;
|
||||
|
||||
// VK_PRESENT_MODE_FIFO_KHR causes random timeouts on Linux Intel. http://anglebug.com/3153
|
||||
Feature disableFifoPresentMode = {
|
||||
"disable_fifo_present_mode", FeatureCategory::VulkanWorkarounds,
|
||||
"On Linux Intel, VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members,
|
||||
"http://anglebug.com/3153"};
|
||||
|
||||
// On Qualcomm, a bug is preventing us from using loadOp=Clear with inline commands in the
|
||||
// render pass. http://anglebug.com/2361
|
||||
Feature restartRenderPassAfterLoadOpClear = {
|
||||
"restart_render_pass_after_load_op_clear", FeatureCategory::VulkanWorkarounds,
|
||||
"On Qualcomm, a bug is preventing us from using loadOp=Clear with inline "
|
||||
"commands in the render pass",
|
||||
&members, "http://anglebug.com/2361"};
|
||||
|
||||
// On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave.
|
||||
// For example, binding only descriptor set 3 results in zero being read from a uniform buffer
|
||||
// object within that set. This flag results in empty descriptor sets being bound for any
|
||||
// unused descriptor set to work around this issue. http://anglebug.com/2727
|
||||
Feature bindEmptyForUnusedDescriptorSets = {
|
||||
"bind_empty_for_unused_descriptor_sets", FeatureCategory::VulkanWorkarounds,
|
||||
"On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave",
|
||||
&members, "http://anglebug.com/2727"};
|
||||
|
||||
// When the scissor is (0,0,0,0) on Windows Intel, the driver acts as if the scissor was
|
||||
// disabled. Work-around this by setting the scissor to just outside of the render area
|
||||
// (e.g. (renderArea.x, renderArea.y, 1, 1)). http://anglebug.com/3407
|
||||
Feature forceNonZeroScissor = {
|
||||
"force_non_zero_scissor", FeatureCategory::VulkanWorkarounds,
|
||||
"On Windows Intel, when the scissor is (0,0,0,0), the driver acts as if the "
|
||||
"scissor was disabled",
|
||||
&members, "http://anglebug.com/3407"};
|
||||
|
||||
// OES_depth_texture is a commonly expected feature on Android. However it
|
||||
// requires that D16_UNORM support texture filtering
|
||||
// (e.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) and some devices
|
||||
// do not. Work-around this by setting saying D16_UNORM supports filtering
|
||||
// anyway.
|
||||
Feature forceD16TexFilter = {"force_D16_texture_filter", FeatureCategory::VulkanWorkarounds,
|
||||
"On some Android devices, VK_FORMAT_D16_UNORM does not support "
|
||||
"VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, "
|
||||
"which prevents OES_depth_texture from being supported.",
|
||||
&members, "http://anglebug.com/3452"};
|
||||
|
||||
// On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly. This
|
||||
// workaround makes sure this path is avoided. http://anglebug.com/3498
|
||||
Feature disableFlippingBlitWithCommand = {
|
||||
"disable_flipping_blit_with_command", FeatureCategory::VulkanWorkarounds,
|
||||
"On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly.",
|
||||
&members, "http://anglebug.com/3498"};
|
||||
|
||||
// On platform with Intel or AMD GPU, a window resizing would not trigger the vulkan driver to
|
||||
// return VK_ERROR_OUT_OF_DATE on swapchain present. Work-around by query current window extent
|
||||
// every frame to detect a window resizing.
|
||||
// http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625
|
||||
Feature perFrameWindowSizeQuery = {
|
||||
"per_frame_window_size_query", FeatureCategory::VulkanWorkarounds,
|
||||
"On platform with Intel or AMD gpu, vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE"
|
||||
"when window resizing",
|
||||
&members, "http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625"};
|
||||
bool disableFifoPresentMode = false;
|
||||
};
|
||||
|
||||
inline FeaturesVk::FeaturesVk() = default;
|
||||
inline FeaturesVk::~FeaturesVk() = default;
|
||||
|
||||
inline FeaturesVk::FeaturesVk() = default;
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_FEATURESVK_H_
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// FrontendFeatures.h: Features/workarounds for driver bugs and other behaviors seen
|
||||
// on all platforms.
|
||||
|
||||
#ifndef ANGLE_PLATFORM_FRONTENDFEATURES_H_
|
||||
#define ANGLE_PLATFORM_FRONTENDFEATURES_H_
|
||||
|
||||
#include "platform/Feature.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
struct FrontendFeatures : angle::FeatureSetBase
|
||||
{
|
||||
FrontendFeatures();
|
||||
~FrontendFeatures();
|
||||
|
||||
// Force the context to be lost (via KHR_robustness) if a GL_OUT_OF_MEMORY error occurs. The
|
||||
// driver may be in an inconsistent state if this happens, and some users of ANGLE rely on this
|
||||
// notification to prevent further execution.
|
||||
angle::Feature loseContextOnOutOfMemory = {
|
||||
"lose_context_on_out_of_memory", angle::FeatureCategory::FrontendWorkarounds,
|
||||
"Some users rely on a lost context notification if a GL_OUT_OF_MEMORY "
|
||||
"error occurs",
|
||||
&members};
|
||||
|
||||
// Program binaries don't contain transform feedback varyings on Qualcomm GPUs.
|
||||
// Work around this by disabling the program cache for programs with transform feedback.
|
||||
angle::Feature disableProgramCachingForTransformFeedback = {
|
||||
"disable_program_caching_for_transform_feedback",
|
||||
angle::FeatureCategory::FrontendWorkarounds,
|
||||
"On Qualcomm GPUs, program binaries don't contain transform feedback varyings", &members};
|
||||
|
||||
// On Windows Intel OpenGL drivers TexImage sometimes seems to interact with the Framebuffer.
|
||||
// Flaky crashes can occur unless we sync the Framebuffer bindings. The workaround is to add
|
||||
// Framebuffer binding dirty bits to TexImage updates. See http://anglebug.com/2906
|
||||
angle::Feature syncFramebufferBindingsOnTexImage = {
|
||||
"sync_framebuffer_bindings_on_tex_image", angle::FeatureCategory::FrontendWorkarounds,
|
||||
"On Windows Intel OpenGL drivers TexImage sometimes seems to interact "
|
||||
"with the Framebuffer",
|
||||
&members};
|
||||
|
||||
angle::Feature scalarizeVecAndMatConstructorArgs = {
|
||||
"scalarize_vec_and_mat_constructor_args", angle::FeatureCategory::FrontendWorkarounds,
|
||||
"Always rewrite vec/mat constructors to be consistent", &members,
|
||||
"http://crbug.com/398694"};
|
||||
};
|
||||
|
||||
inline FrontendFeatures::FrontendFeatures() = default;
|
||||
inline FrontendFeatures::~FrontendFeatures() = default;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_FRONTENDFEATURES_H_
|
|
@ -21,8 +21,7 @@
|
|||
# define ANGLE_PLATFORM_EXPORT __declspec(dllexport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
// (miko): This visibility setting conflicts with the Firefox build system.
|
||||
// # define ANGLE_PLATFORM_EXPORT __attribute__((visibility("default")))
|
||||
# define ANGLE_PLATFORM_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#if !defined(ANGLE_PLATFORM_EXPORT)
|
||||
# define ANGLE_PLATFORM_EXPORT
|
||||
|
@ -36,7 +35,7 @@
|
|||
|
||||
namespace angle
|
||||
{
|
||||
struct FeaturesD3D;
|
||||
struct WorkaroundsD3D;
|
||||
struct FeaturesVk;
|
||||
using TraceEventHandle = uint64_t;
|
||||
using EGLDisplayType = void *;
|
||||
|
@ -216,14 +215,15 @@ inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name,
|
|||
|
||||
// Allows us to programatically override ANGLE's default workarounds for testing purposes.
|
||||
using OverrideWorkaroundsD3DFunc = void (*)(PlatformMethods *platform,
|
||||
angle::FeaturesD3D *featuresD3D);
|
||||
angle::WorkaroundsD3D *workaroundsD3D);
|
||||
inline void DefaultOverrideWorkaroundsD3D(PlatformMethods *platform,
|
||||
angle::FeaturesD3D *featuresD3D)
|
||||
angle::WorkaroundsD3D *workaroundsD3D)
|
||||
{}
|
||||
|
||||
using OverrideFeaturesVkFunc = void (*)(PlatformMethods *platform,
|
||||
angle::FeaturesVk *featuresVulkan);
|
||||
inline void DefaultOverrideFeaturesVk(PlatformMethods *platform, angle::FeaturesVk *featuresVulkan)
|
||||
angle::FeaturesVk *workaroundsVulkan);
|
||||
inline void DefaultOverrideFeaturesVk(PlatformMethods *platform,
|
||||
angle::FeaturesVk *workaroundsVulkan)
|
||||
{}
|
||||
|
||||
// Callback on a successful program link with the program binary. Can be used to store
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
//
|
||||
// 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
|
||||
{
|
||||
WorkaroundsD3D();
|
||||
WorkaroundsD3D(const WorkaroundsD3D &other);
|
||||
|
||||
// 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;
|
||||
|
||||
// Don't use D3D constant register zero when allocating space for uniforms in the vertex shader.
|
||||
// This is targeted to work around a bug in NVIDIA D3D driver version 388.59 where in very
|
||||
// specific cases the driver would not handle constant register zero correctly.
|
||||
bool skipVSConstantRegisterZero = false;
|
||||
};
|
||||
|
||||
inline WorkaroundsD3D::WorkaroundsD3D() = default;
|
||||
inline WorkaroundsD3D::WorkaroundsD3D(const WorkaroundsD3D &other) = default;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_WORKAROUNDSD3D_H_
|
|
@ -1,3 +1,3 @@
|
|||
#define ANGLE_COMMIT_HASH "0f5a52939b91"
|
||||
#define ANGLE_COMMIT_HASH "21dccd386996"
|
||||
#define ANGLE_COMMIT_HASH_SIZE 12
|
||||
#define ANGLE_COMMIT_DATE "2019-09-03 21:51:25 +0200"
|
||||
#define ANGLE_COMMIT_DATE "2019-08-01 14:11:16 -0700"
|
||||
|
|
|
@ -99,6 +99,6 @@ using ColorGeneric = angle::ColorGeneric;
|
|||
|
||||
} // namespace gl
|
||||
|
||||
#include "Color.inc"
|
||||
#include "Color.inl"
|
||||
|
||||
#endif // COMMON_COLOR_H_
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// Color.inc : Inline definitions of some functions from Color.h
|
||||
// Color.inl : Inline definitions of some functions from Color.h
|
||||
|
||||
namespace angle
|
||||
{
|
|
@ -64,7 +64,7 @@ class FixedVector final
|
|||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
static constexpr size_type max_size();
|
||||
size_type max_size() const;
|
||||
|
||||
void clear();
|
||||
|
||||
|
@ -233,7 +233,7 @@ typename FixedVector<T, N, Storage>::size_type FixedVector<T, N, Storage>::size(
|
|||
}
|
||||
|
||||
template <class T, size_t N, class Storage>
|
||||
constexpr typename FixedVector<T, N, Storage>::size_type FixedVector<T, N, Storage>::max_size()
|
||||
typename FixedVector<T, N, Storage>::size_type FixedVector<T, N, Storage>::max_size() const
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
|
|
@ -47,26 +47,6 @@ EGLenum ToEGLenum(CompositorTiming from)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, CompositorTiming value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case CompositorTiming::CompositeDeadline:
|
||||
os << "EGL_COMPOSITE_DEADLINE_ANDROID";
|
||||
break;
|
||||
case CompositorTiming::CompositInterval:
|
||||
os << "EGL_COMPOSITE_INTERVAL_ANDROID";
|
||||
break;
|
||||
case CompositorTiming::CompositToPresentLatency:
|
||||
os << "EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
MessageType FromEGLenum<MessageType>(EGLenum from)
|
||||
{
|
||||
|
@ -103,29 +83,6 @@ EGLenum ToEGLenum(MessageType from)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, MessageType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case MessageType::Critical:
|
||||
os << "EGL_DEBUG_MSG_CRITICAL_KHR";
|
||||
break;
|
||||
case MessageType::Error:
|
||||
os << "EGL_DEBUG_MSG_ERROR_KHR";
|
||||
break;
|
||||
case MessageType::Warn:
|
||||
os << "EGL_DEBUG_MSG_WARN_KHR";
|
||||
break;
|
||||
case MessageType::Info:
|
||||
os << "EGL_DEBUG_MSG_INFO_KHR";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
ObjectType FromEGLenum<ObjectType>(EGLenum from)
|
||||
{
|
||||
|
@ -174,38 +131,6 @@ EGLenum ToEGLenum(ObjectType from)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, ObjectType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case ObjectType::Thread:
|
||||
os << "EGL_OBJECT_THREAD_KHR";
|
||||
break;
|
||||
case ObjectType::Display:
|
||||
os << "EGL_OBJECT_DISPLAY_KHR";
|
||||
break;
|
||||
case ObjectType::Context:
|
||||
os << "EGL_OBJECT_CONTEXT_KHR";
|
||||
break;
|
||||
case ObjectType::Surface:
|
||||
os << "EGL_OBJECT_SURFACE_KHR";
|
||||
break;
|
||||
case ObjectType::Image:
|
||||
os << "EGL_OBJECT_IMAGE_KHR";
|
||||
break;
|
||||
case ObjectType::Sync:
|
||||
os << "EGL_OBJECT_SYNC_KHR";
|
||||
break;
|
||||
case ObjectType::Stream:
|
||||
os << "EGL_OBJECT_STREAM_KHR";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
TextureFormat FromEGLenum<TextureFormat>(EGLenum from)
|
||||
{
|
||||
|
@ -238,26 +163,6 @@ EGLenum ToEGLenum(TextureFormat from)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, TextureFormat value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case TextureFormat::NoTexture:
|
||||
os << "EGL_NO_TEXTURE";
|
||||
break;
|
||||
case TextureFormat::RGB:
|
||||
os << "EGL_TEXTURE_RGB";
|
||||
break;
|
||||
case TextureFormat::RGBA:
|
||||
os << "EGL_TEXTURE_RGBA";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
Timestamp FromEGLenum<Timestamp>(EGLenum from)
|
||||
{
|
||||
|
@ -314,42 +219,4 @@ EGLenum ToEGLenum(Timestamp from)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, Timestamp value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Timestamp::RequestedPresentTime:
|
||||
os << "EGL_REQUESTED_PRESENT_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::RenderingCompleteTime:
|
||||
os << "EGL_RENDERING_COMPLETE_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::CompositionLatchTime:
|
||||
os << "EGL_COMPOSITION_LATCH_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::FirstCompositionStartTime:
|
||||
os << "EGL_FIRST_COMPOSITION_START_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::LastCompositionStartTime:
|
||||
os << "EGL_LAST_COMPOSITION_START_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::FirstCompositionGPUFinishedTime:
|
||||
os << "EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::DisplayPresentTime:
|
||||
os << "EGL_DISPLAY_PRESENT_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::DequeueReadyTime:
|
||||
os << "EGL_DEQUEUE_READY_TIME_ANDROID";
|
||||
break;
|
||||
case Timestamp::ReadsDoneTime:
|
||||
os << "EGL_READS_DONE_TIME_ANDROID";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace egl
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <angle_gl.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
namespace egl
|
||||
{
|
||||
|
@ -38,7 +37,6 @@ enum class CompositorTiming : uint8_t
|
|||
template <>
|
||||
CompositorTiming FromEGLenum<CompositorTiming>(EGLenum from);
|
||||
EGLenum ToEGLenum(CompositorTiming from);
|
||||
std::ostream &operator<<(std::ostream &os, CompositorTiming value);
|
||||
|
||||
enum class MessageType : uint8_t
|
||||
{
|
||||
|
@ -54,7 +52,6 @@ enum class MessageType : uint8_t
|
|||
template <>
|
||||
MessageType FromEGLenum<MessageType>(EGLenum from);
|
||||
EGLenum ToEGLenum(MessageType from);
|
||||
std::ostream &operator<<(std::ostream &os, MessageType value);
|
||||
|
||||
enum class ObjectType : uint8_t
|
||||
{
|
||||
|
@ -73,7 +70,6 @@ enum class ObjectType : uint8_t
|
|||
template <>
|
||||
ObjectType FromEGLenum<ObjectType>(EGLenum from);
|
||||
EGLenum ToEGLenum(ObjectType from);
|
||||
std::ostream &operator<<(std::ostream &os, ObjectType value);
|
||||
|
||||
enum class TextureFormat : uint8_t
|
||||
{
|
||||
|
@ -88,7 +84,6 @@ enum class TextureFormat : uint8_t
|
|||
template <>
|
||||
TextureFormat FromEGLenum<TextureFormat>(EGLenum from);
|
||||
EGLenum ToEGLenum(TextureFormat from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureFormat value);
|
||||
|
||||
enum class Timestamp : uint8_t
|
||||
{
|
||||
|
@ -109,7 +104,6 @@ enum class Timestamp : uint8_t
|
|||
template <>
|
||||
Timestamp FromEGLenum<Timestamp>(EGLenum from);
|
||||
EGLenum ToEGLenum(Timestamp from);
|
||||
std::ostream &operator<<(std::ostream &os, Timestamp value);
|
||||
|
||||
} // namespace egl
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ TextureType TextureTargetToType(TextureTarget target)
|
|||
return TextureType::_2DMultisampleArray;
|
||||
case TextureTarget::_3D:
|
||||
return TextureType::_3D;
|
||||
case TextureTarget::InvalidEnum:
|
||||
return TextureType::InvalidEnum;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return TextureType::InvalidEnum;
|
||||
|
@ -170,114 +168,6 @@ bool IsMultisampled(gl::TextureType type)
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, PrimitiveMode value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case PrimitiveMode::LineLoop:
|
||||
os << "GL_LINE_LOOP";
|
||||
break;
|
||||
case PrimitiveMode::Lines:
|
||||
os << "GL_LINES";
|
||||
break;
|
||||
case PrimitiveMode::LinesAdjacency:
|
||||
os << "GL_LINES_ADJACENCY";
|
||||
break;
|
||||
case PrimitiveMode::LineStrip:
|
||||
os << "GL_LINE_STRIP";
|
||||
break;
|
||||
case PrimitiveMode::LineStripAdjacency:
|
||||
os << "GL_LINE_STRIP_ADJANCENCY";
|
||||
break;
|
||||
case PrimitiveMode::Points:
|
||||
os << "GL_POINTS";
|
||||
break;
|
||||
case PrimitiveMode::TriangleFan:
|
||||
os << "GL_TRIANGLE_FAN";
|
||||
break;
|
||||
case PrimitiveMode::Triangles:
|
||||
os << "GL_TRIANGLES";
|
||||
break;
|
||||
case PrimitiveMode::TrianglesAdjacency:
|
||||
os << "GL_TRIANGLES_ADJANCENCY";
|
||||
break;
|
||||
case PrimitiveMode::TriangleStrip:
|
||||
os << "GL_TRIANGLE_STRIP";
|
||||
break;
|
||||
case PrimitiveMode::TriangleStripAdjacency:
|
||||
os << "GL_TRIANGLE_STRIP_ADJACENCY";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, DrawElementsType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case DrawElementsType::UnsignedByte:
|
||||
os << "GL_UNSIGNED_BYTE";
|
||||
break;
|
||||
case DrawElementsType::UnsignedShort:
|
||||
os << "GL_UNSIGNED_SHORT";
|
||||
break;
|
||||
case DrawElementsType::UnsignedInt:
|
||||
os << "GL_UNSIGNED_INT";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, VertexAttribType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case VertexAttribType::Byte:
|
||||
os << "GL_UNSIGNED_BYTE";
|
||||
break;
|
||||
case VertexAttribType::Fixed:
|
||||
os << "GL_FIXED";
|
||||
break;
|
||||
case VertexAttribType::Float:
|
||||
os << "GL_FLOAT";
|
||||
break;
|
||||
case VertexAttribType::HalfFloat:
|
||||
os << "GL_HALF_FLOAT";
|
||||
break;
|
||||
case VertexAttribType::Int:
|
||||
os << "GL_INT";
|
||||
break;
|
||||
case VertexAttribType::Int2101010:
|
||||
os << "GL_INT_10_10_10_2";
|
||||
break;
|
||||
case VertexAttribType::Short:
|
||||
os << "GL_SHORT";
|
||||
break;
|
||||
case VertexAttribType::UnsignedByte:
|
||||
os << "GL_UNSIGNED_BYTE";
|
||||
break;
|
||||
case VertexAttribType::UnsignedInt:
|
||||
os << "GL_UNSIGNED_INT";
|
||||
break;
|
||||
case VertexAttribType::UnsignedInt2101010:
|
||||
os << "GL_UNSIGNED_INT_10_10_10_2";
|
||||
break;
|
||||
case VertexAttribType::UnsignedShort:
|
||||
os << "GL_UNSIGNED_SHORT";
|
||||
break;
|
||||
default:
|
||||
os << "GL_INVALID_ENUM";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
|
|
@ -269,8 +269,6 @@ static_assert(ToGLenum(PrimitiveMode::TrianglesAdjacency) == GL_TRIANGLES_ADJACE
|
|||
static_assert(ToGLenum(PrimitiveMode::TriangleStripAdjacency) == GL_TRIANGLE_STRIP_ADJACENCY,
|
||||
"PrimitiveMode violation");
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, PrimitiveMode value);
|
||||
|
||||
enum class DrawElementsType : size_t
|
||||
{
|
||||
UnsignedByte = 0,
|
||||
|
@ -313,8 +311,6 @@ ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedByte, GL_UNSIGNED_BYTE);
|
|||
ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedShort, GL_UNSIGNED_SHORT);
|
||||
ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedInt, GL_UNSIGNED_INT);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, DrawElementsType value);
|
||||
|
||||
enum class VertexAttribType
|
||||
{
|
||||
Byte = 0, // GLenum == 0x1400
|
||||
|
@ -371,8 +367,6 @@ ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, HalfFloat, GL_HALF_FLOAT);
|
|||
ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Fixed, GL_FIXED);
|
||||
ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Int2101010, GL_INT_2_10_10_10_REV);
|
||||
ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, UnsignedInt2101010, GL_UNSIGNED_INT_2_10_10_10_REV);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, VertexAttribType value);
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -17,7 +17,6 @@
|
|||
#include <angle_gl.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
@ -43,7 +42,6 @@ enum class AlphaTestFunc : uint8_t
|
|||
template <>
|
||||
AlphaTestFunc FromGLenum<AlphaTestFunc>(GLenum from);
|
||||
GLenum ToGLenum(AlphaTestFunc from);
|
||||
std::ostream &operator<<(std::ostream &os, AlphaTestFunc value);
|
||||
|
||||
enum class BufferBinding : uint8_t
|
||||
{
|
||||
|
@ -67,7 +65,6 @@ enum class BufferBinding : uint8_t
|
|||
template <>
|
||||
BufferBinding FromGLenum<BufferBinding>(GLenum from);
|
||||
GLenum ToGLenum(BufferBinding from);
|
||||
std::ostream &operator<<(std::ostream &os, BufferBinding value);
|
||||
|
||||
enum class BufferUsage : uint8_t
|
||||
{
|
||||
|
@ -88,7 +85,6 @@ enum class BufferUsage : uint8_t
|
|||
template <>
|
||||
BufferUsage FromGLenum<BufferUsage>(GLenum from);
|
||||
GLenum ToGLenum(BufferUsage from);
|
||||
std::ostream &operator<<(std::ostream &os, BufferUsage value);
|
||||
|
||||
enum class ClientVertexArrayType : uint8_t
|
||||
{
|
||||
|
@ -105,7 +101,6 @@ enum class ClientVertexArrayType : uint8_t
|
|||
template <>
|
||||
ClientVertexArrayType FromGLenum<ClientVertexArrayType>(GLenum from);
|
||||
GLenum ToGLenum(ClientVertexArrayType from);
|
||||
std::ostream &operator<<(std::ostream &os, ClientVertexArrayType value);
|
||||
|
||||
enum class CullFaceMode : uint8_t
|
||||
{
|
||||
|
@ -120,7 +115,6 @@ enum class CullFaceMode : uint8_t
|
|||
template <>
|
||||
CullFaceMode FromGLenum<CullFaceMode>(GLenum from);
|
||||
GLenum ToGLenum(CullFaceMode from);
|
||||
std::ostream &operator<<(std::ostream &os, CullFaceMode value);
|
||||
|
||||
enum class FilterMode : uint8_t
|
||||
{
|
||||
|
@ -137,7 +131,6 @@ enum class FilterMode : uint8_t
|
|||
template <>
|
||||
FilterMode FromGLenum<FilterMode>(GLenum from);
|
||||
GLenum ToGLenum(FilterMode from);
|
||||
std::ostream &operator<<(std::ostream &os, FilterMode value);
|
||||
|
||||
enum class FogMode : uint8_t
|
||||
{
|
||||
|
@ -152,36 +145,6 @@ enum class FogMode : uint8_t
|
|||
template <>
|
||||
FogMode FromGLenum<FogMode>(GLenum from);
|
||||
GLenum ToGLenum(FogMode from);
|
||||
std::ostream &operator<<(std::ostream &os, FogMode value);
|
||||
|
||||
enum class GraphicsResetStatus : uint8_t
|
||||
{
|
||||
NoError = 0,
|
||||
GuiltyContextReset = 1,
|
||||
InnocentContextReset = 2,
|
||||
UnknownContextReset = 3,
|
||||
|
||||
InvalidEnum = 4,
|
||||
EnumCount = 4,
|
||||
};
|
||||
|
||||
template <>
|
||||
GraphicsResetStatus FromGLenum<GraphicsResetStatus>(GLenum from);
|
||||
GLenum ToGLenum(GraphicsResetStatus from);
|
||||
std::ostream &operator<<(std::ostream &os, GraphicsResetStatus value);
|
||||
|
||||
enum class HandleType : uint8_t
|
||||
{
|
||||
OpaqueFd = 0,
|
||||
|
||||
InvalidEnum = 1,
|
||||
EnumCount = 1,
|
||||
};
|
||||
|
||||
template <>
|
||||
HandleType FromGLenum<HandleType>(GLenum from);
|
||||
GLenum ToGLenum(HandleType from);
|
||||
std::ostream &operator<<(std::ostream &os, HandleType value);
|
||||
|
||||
enum class HintSetting : uint8_t
|
||||
{
|
||||
|
@ -196,29 +159,6 @@ enum class HintSetting : uint8_t
|
|||
template <>
|
||||
HintSetting FromGLenum<HintSetting>(GLenum from);
|
||||
GLenum ToGLenum(HintSetting from);
|
||||
std::ostream &operator<<(std::ostream &os, HintSetting value);
|
||||
|
||||
enum class ImageLayout : uint8_t
|
||||
{
|
||||
Undefined = 0,
|
||||
General = 1,
|
||||
ColorAttachment = 2,
|
||||
DepthStencilAttachment = 3,
|
||||
DepthStencilReadOnlyAttachment = 4,
|
||||
ShaderReadOnly = 5,
|
||||
TransferSrc = 6,
|
||||
TransferDst = 7,
|
||||
DepthReadOnlyStencilAttachment = 8,
|
||||
DepthAttachmentStencilReadOnly = 9,
|
||||
|
||||
InvalidEnum = 10,
|
||||
EnumCount = 10,
|
||||
};
|
||||
|
||||
template <>
|
||||
ImageLayout FromGLenum<ImageLayout>(GLenum from);
|
||||
GLenum ToGLenum(ImageLayout from);
|
||||
std::ostream &operator<<(std::ostream &os, ImageLayout value);
|
||||
|
||||
enum class LightParameter : uint8_t
|
||||
{
|
||||
|
@ -241,7 +181,6 @@ enum class LightParameter : uint8_t
|
|||
template <>
|
||||
LightParameter FromGLenum<LightParameter>(GLenum from);
|
||||
GLenum ToGLenum(LightParameter from);
|
||||
std::ostream &operator<<(std::ostream &os, LightParameter value);
|
||||
|
||||
enum class LogicalOperation : uint8_t
|
||||
{
|
||||
|
@ -269,7 +208,6 @@ enum class LogicalOperation : uint8_t
|
|||
template <>
|
||||
LogicalOperation FromGLenum<LogicalOperation>(GLenum from);
|
||||
GLenum ToGLenum(LogicalOperation from);
|
||||
std::ostream &operator<<(std::ostream &os, LogicalOperation value);
|
||||
|
||||
enum class MaterialParameter : uint8_t
|
||||
{
|
||||
|
@ -287,7 +225,6 @@ enum class MaterialParameter : uint8_t
|
|||
template <>
|
||||
MaterialParameter FromGLenum<MaterialParameter>(GLenum from);
|
||||
GLenum ToGLenum(MaterialParameter from);
|
||||
std::ostream &operator<<(std::ostream &os, MaterialParameter value);
|
||||
|
||||
enum class MatrixType : uint8_t
|
||||
{
|
||||
|
@ -302,7 +239,6 @@ enum class MatrixType : uint8_t
|
|||
template <>
|
||||
MatrixType FromGLenum<MatrixType>(GLenum from);
|
||||
GLenum ToGLenum(MatrixType from);
|
||||
std::ostream &operator<<(std::ostream &os, MatrixType value);
|
||||
|
||||
enum class PointParameter : uint8_t
|
||||
{
|
||||
|
@ -318,9 +254,8 @@ enum class PointParameter : uint8_t
|
|||
template <>
|
||||
PointParameter FromGLenum<PointParameter>(GLenum from);
|
||||
GLenum ToGLenum(PointParameter from);
|
||||
std::ostream &operator<<(std::ostream &os, PointParameter value);
|
||||
|
||||
enum class ProvokingVertexConvention : uint8_t
|
||||
enum class ProvokingVertex : uint8_t
|
||||
{
|
||||
FirstVertexConvention = 0,
|
||||
LastVertexConvention = 1,
|
||||
|
@ -330,9 +265,8 @@ enum class ProvokingVertexConvention : uint8_t
|
|||
};
|
||||
|
||||
template <>
|
||||
ProvokingVertexConvention FromGLenum<ProvokingVertexConvention>(GLenum from);
|
||||
GLenum ToGLenum(ProvokingVertexConvention from);
|
||||
std::ostream &operator<<(std::ostream &os, ProvokingVertexConvention value);
|
||||
ProvokingVertex FromGLenum<ProvokingVertex>(GLenum from);
|
||||
GLenum ToGLenum(ProvokingVertex from);
|
||||
|
||||
enum class QueryType : uint8_t
|
||||
{
|
||||
|
@ -351,7 +285,6 @@ enum class QueryType : uint8_t
|
|||
template <>
|
||||
QueryType FromGLenum<QueryType>(GLenum from);
|
||||
GLenum ToGLenum(QueryType from);
|
||||
std::ostream &operator<<(std::ostream &os, QueryType value);
|
||||
|
||||
enum class ShaderType : uint8_t
|
||||
{
|
||||
|
@ -367,7 +300,6 @@ enum class ShaderType : uint8_t
|
|||
template <>
|
||||
ShaderType FromGLenum<ShaderType>(GLenum from);
|
||||
GLenum ToGLenum(ShaderType from);
|
||||
std::ostream &operator<<(std::ostream &os, ShaderType value);
|
||||
|
||||
enum class ShadingModel : uint8_t
|
||||
{
|
||||
|
@ -381,7 +313,6 @@ enum class ShadingModel : uint8_t
|
|||
template <>
|
||||
ShadingModel FromGLenum<ShadingModel>(GLenum from);
|
||||
GLenum ToGLenum(ShadingModel from);
|
||||
std::ostream &operator<<(std::ostream &os, ShadingModel value);
|
||||
|
||||
enum class TextureCombine : uint8_t
|
||||
{
|
||||
|
@ -401,7 +332,6 @@ enum class TextureCombine : uint8_t
|
|||
template <>
|
||||
TextureCombine FromGLenum<TextureCombine>(GLenum from);
|
||||
GLenum ToGLenum(TextureCombine from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureCombine value);
|
||||
|
||||
enum class TextureEnvMode : uint8_t
|
||||
{
|
||||
|
@ -419,7 +349,6 @@ enum class TextureEnvMode : uint8_t
|
|||
template <>
|
||||
TextureEnvMode FromGLenum<TextureEnvMode>(GLenum from);
|
||||
GLenum ToGLenum(TextureEnvMode from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureEnvMode value);
|
||||
|
||||
enum class TextureEnvParameter : uint8_t
|
||||
{
|
||||
|
@ -450,7 +379,6 @@ enum class TextureEnvParameter : uint8_t
|
|||
template <>
|
||||
TextureEnvParameter FromGLenum<TextureEnvParameter>(GLenum from);
|
||||
GLenum ToGLenum(TextureEnvParameter from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureEnvParameter value);
|
||||
|
||||
enum class TextureEnvTarget : uint8_t
|
||||
{
|
||||
|
@ -464,7 +392,6 @@ enum class TextureEnvTarget : uint8_t
|
|||
template <>
|
||||
TextureEnvTarget FromGLenum<TextureEnvTarget>(GLenum from);
|
||||
GLenum ToGLenum(TextureEnvTarget from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureEnvTarget value);
|
||||
|
||||
enum class TextureOp : uint8_t
|
||||
{
|
||||
|
@ -480,7 +407,6 @@ enum class TextureOp : uint8_t
|
|||
template <>
|
||||
TextureOp FromGLenum<TextureOp>(GLenum from);
|
||||
GLenum ToGLenum(TextureOp from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureOp value);
|
||||
|
||||
enum class TextureSrc : uint8_t
|
||||
{
|
||||
|
@ -496,7 +422,6 @@ enum class TextureSrc : uint8_t
|
|||
template <>
|
||||
TextureSrc FromGLenum<TextureSrc>(GLenum from);
|
||||
GLenum ToGLenum(TextureSrc from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureSrc value);
|
||||
|
||||
enum class TextureTarget : uint8_t
|
||||
{
|
||||
|
@ -521,7 +446,6 @@ enum class TextureTarget : uint8_t
|
|||
template <>
|
||||
TextureTarget FromGLenum<TextureTarget>(GLenum from);
|
||||
GLenum ToGLenum(TextureTarget from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureTarget value);
|
||||
|
||||
enum class TextureType : uint8_t
|
||||
{
|
||||
|
@ -541,7 +465,6 @@ enum class TextureType : uint8_t
|
|||
template <>
|
||||
TextureType FromGLenum<TextureType>(GLenum from);
|
||||
GLenum ToGLenum(TextureType from);
|
||||
std::ostream &operator<<(std::ostream &os, TextureType value);
|
||||
|
||||
enum class VertexArrayType : uint8_t
|
||||
{
|
||||
|
@ -558,7 +481,6 @@ enum class VertexArrayType : uint8_t
|
|||
template <>
|
||||
VertexArrayType FromGLenum<VertexArrayType>(GLenum from);
|
||||
GLenum ToGLenum(VertexArrayType from);
|
||||
std::ostream &operator<<(std::ostream &os, VertexArrayType value);
|
||||
|
||||
enum class WrapMode : uint8_t
|
||||
{
|
||||
|
@ -574,7 +496,6 @@ enum class WrapMode : uint8_t
|
|||
template <>
|
||||
WrapMode FromGLenum<WrapMode>(GLenum from);
|
||||
GLenum ToGLenum(WrapMode from);
|
||||
std::ostream &operator<<(std::ostream &os, WrapMode value);
|
||||
|
||||
} // namespace gl
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "common/angleutils.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/mathutil.h"
|
||||
#include "common/platform.h"
|
||||
#include "common/tls.h"
|
||||
|
||||
|
@ -37,48 +36,42 @@ PoolAllocator::PoolAllocator(int growthIncrement, int allocationAlignment)
|
|||
#endif
|
||||
mLocked(false)
|
||||
{
|
||||
#if !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
if (mAlignment == 1)
|
||||
{
|
||||
// This is a special fast-path where fastAllocation() is enabled
|
||||
mAlignmentMask = 0;
|
||||
mHeaderSkip = sizeof(Header);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
//
|
||||
// Adjust mAlignment to be at least pointer aligned and
|
||||
// power of 2.
|
||||
//
|
||||
size_t minAlign = sizeof(void *);
|
||||
mAlignment &= ~(minAlign - 1);
|
||||
if (mAlignment < minAlign)
|
||||
mAlignment = minAlign;
|
||||
mAlignment = gl::ceilPow2(mAlignment);
|
||||
mAlignmentMask = mAlignment - 1;
|
||||
//
|
||||
// Adjust mAlignment to be at least pointer aligned and
|
||||
// power of 2.
|
||||
//
|
||||
size_t minAlign = sizeof(void *);
|
||||
mAlignment &= ~(minAlign - 1);
|
||||
if (mAlignment < minAlign)
|
||||
mAlignment = minAlign;
|
||||
size_t a = 1;
|
||||
while (a < mAlignment)
|
||||
a <<= 1;
|
||||
mAlignment = a;
|
||||
mAlignmentMask = a - 1;
|
||||
|
||||
#if !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
//
|
||||
// Align header skip
|
||||
//
|
||||
mHeaderSkip = minAlign;
|
||||
if (mHeaderSkip < sizeof(Header))
|
||||
{
|
||||
mHeaderSkip = rx::roundUp(sizeof(Header), mAlignment);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Don't allow page sizes we know are smaller than all common
|
||||
// OS page sizes.
|
||||
//
|
||||
if (mPageSize < 4 * 1024)
|
||||
mPageSize = 4 * 1024;
|
||||
|
||||
//
|
||||
// A large mCurrentPageOffset indicates a new page needs to
|
||||
// be obtained to allocate memory.
|
||||
//
|
||||
mCurrentPageOffset = mPageSize;
|
||||
|
||||
//
|
||||
// Align header skip
|
||||
//
|
||||
mHeaderSkip = minAlign;
|
||||
if (mHeaderSkip < sizeof(Header))
|
||||
{
|
||||
mHeaderSkip = (sizeof(Header) + mAlignmentMask) & ~mAlignmentMask;
|
||||
}
|
||||
#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
mStack.push_back({});
|
||||
#endif
|
||||
|
@ -269,22 +262,7 @@ void *PoolAllocator::allocate(size_t numBytes)
|
|||
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(memory) + mHeaderSkip);
|
||||
return std::align(mAlignment, numBytes, unalignedPtr, allocationSize);
|
||||
}
|
||||
unsigned char *newPageAddr =
|
||||
static_cast<unsigned char *>(allocateNewPage(numBytes, allocationSize));
|
||||
return initializeAllocation(mInUseList, newPageAddr, numBytes);
|
||||
#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
void *alloc = malloc(numBytes + mAlignmentMask);
|
||||
mStack.back().push_back(alloc);
|
||||
|
||||
intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc);
|
||||
intAlloc = (intAlloc + mAlignmentMask) & ~mAlignmentMask;
|
||||
return reinterpret_cast<void *>(intAlloc);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
void *PoolAllocator::allocateNewPage(size_t numBytes, size_t allocationSize)
|
||||
{
|
||||
//
|
||||
// Need a simple page to allocate from.
|
||||
//
|
||||
|
@ -300,15 +278,23 @@ void *PoolAllocator::allocateNewPage(size_t numBytes, size_t allocationSize)
|
|||
if (memory == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Use placement-new to initialize header
|
||||
new (memory) Header(mInUseList, 1);
|
||||
mInUseList = memory;
|
||||
|
||||
unsigned char *ret = reinterpret_cast<unsigned char *>(mInUseList) + mHeaderSkip;
|
||||
mCurrentPageOffset = (mHeaderSkip + allocationSize + mAlignmentMask) & ~mAlignmentMask;
|
||||
return ret;
|
||||
}
|
||||
return initializeAllocation(mInUseList, ret, numBytes);
|
||||
#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
void *alloc = malloc(numBytes + mAlignmentMask);
|
||||
mStack.back().push_back(alloc);
|
||||
|
||||
intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc);
|
||||
intAlloc = (intAlloc + mAlignmentMask) & ~mAlignmentMask;
|
||||
return reinterpret_cast<void *>(intAlloc);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PoolAllocator::lock()
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "angleutils.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
@ -124,10 +123,6 @@ class PoolAllocator : angle::NonCopyable
|
|||
{
|
||||
public:
|
||||
static const int kDefaultAlignment = 16;
|
||||
//
|
||||
// Create PoolAllocator. If alignment is be set to 1 byte then fastAllocate()
|
||||
// function can be used to make allocations with less overhead.
|
||||
//
|
||||
PoolAllocator(int growthIncrement = 8 * 1024, int allocationAlignment = kDefaultAlignment);
|
||||
|
||||
//
|
||||
|
@ -158,33 +153,6 @@ class PoolAllocator : angle::NonCopyable
|
|||
//
|
||||
void *allocate(size_t numBytes);
|
||||
|
||||
//
|
||||
// Call fastAllocate() for a faster allocate function that does minimal bookkeeping
|
||||
// preCondition: Allocator must have been created w/ alignment of 1
|
||||
ANGLE_INLINE uint8_t *fastAllocate(size_t numBytes)
|
||||
{
|
||||
#if defined(ANGLE_DISABLE_POOL_ALLOC)
|
||||
return reinterpret_cast<uint8_t *>(allocate(numBytes));
|
||||
#else
|
||||
ASSERT(mAlignment == 1);
|
||||
// No multi-page allocations
|
||||
ASSERT(numBytes <= (mPageSize - mHeaderSkip));
|
||||
//
|
||||
// Do the allocation, most likely case inline first, for efficiency.
|
||||
//
|
||||
if (numBytes <= mPageSize - mCurrentPageOffset)
|
||||
{
|
||||
//
|
||||
// Safe to allocate from mCurrentPageOffset.
|
||||
//
|
||||
uint8_t *memory = reinterpret_cast<uint8_t *>(mInUseList) + mCurrentPageOffset;
|
||||
mCurrentPageOffset += numBytes;
|
||||
return memory;
|
||||
}
|
||||
return reinterpret_cast<uint8_t *>(allocateNewPage(numBytes, numBytes));
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// There is no deallocate. The point of this class is that
|
||||
// deallocation can be skipped by the user of it, as the model
|
||||
|
@ -237,8 +205,6 @@ class PoolAllocator : angle::NonCopyable
|
|||
};
|
||||
using AllocStack = std::vector<AllocState>;
|
||||
|
||||
// Slow path of allocation when we have to get a new page.
|
||||
void *allocateNewPage(size_t numBytes, size_t allocationSize);
|
||||
// Track allocations if and only if we're using guard blocks
|
||||
void *initializeAllocation(Header *block, unsigned char *memory, size_t numBytes)
|
||||
{
|
||||
|
|
|
@ -1,268 +0,0 @@
|
|||
//
|
||||
// Copyright 2018 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.
|
||||
//
|
||||
|
||||
// android_util.cpp: Utilities for the using the Android platform
|
||||
|
||||
#include "common/android_util.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// Taken from cutils/native_handle.h:
|
||||
// https://android.googlesource.com/platform/system/core/+/master/libcutils/include/cutils/native_handle.h
|
||||
typedef struct native_handle
|
||||
{
|
||||
int version; /* sizeof(native_handle_t) */
|
||||
int numFds; /* number of file-descriptors at &data[0] */
|
||||
int numInts; /* number of ints at &data[numFds] */
|
||||
int data[0]; /* numFds + numInts ints */
|
||||
} native_handle_t;
|
||||
|
||||
// Taken from nativebase/nativebase.h
|
||||
// https://android.googlesource.com/platform/frameworks/native/+/master/libs/nativebase/include/nativebase/nativebase.h
|
||||
typedef const native_handle_t *buffer_handle_t;
|
||||
|
||||
typedef struct android_native_base_t
|
||||
{
|
||||
/* a magic value defined by the actual EGL native type */
|
||||
int magic;
|
||||
/* the sizeof() of the actual EGL native type */
|
||||
int version;
|
||||
void *reserved[4];
|
||||
/* reference-counting interface */
|
||||
void (*incRef)(struct android_native_base_t *base);
|
||||
void (*decRef)(struct android_native_base_t *base);
|
||||
} android_native_base_t;
|
||||
|
||||
typedef struct ANativeWindowBuffer
|
||||
{
|
||||
struct android_native_base_t common;
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
int format;
|
||||
int usage_deprecated;
|
||||
uintptr_t layerCount;
|
||||
void *reserved[1];
|
||||
const native_handle_t *handle;
|
||||
uint64_t usage;
|
||||
// we needed extra space for storing the 64-bits usage flags
|
||||
// the number of slots to use from reserved_proc depends on the
|
||||
// architecture.
|
||||
void *reserved_proc[8 - (sizeof(uint64_t) / sizeof(void *))];
|
||||
} ANativeWindowBuffer_t;
|
||||
|
||||
// Taken from android/hardware_buffer.h
|
||||
// https://android.googlesource.com/platform/frameworks/native/+/master/libs/nativewindow/include/android/hardware_buffer.h
|
||||
|
||||
// AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM,
|
||||
// AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM formats were deprecated and re-added explicitly.
|
||||
|
||||
// clang-format off
|
||||
/**
|
||||
* Buffer pixel formats.
|
||||
*/
|
||||
enum {
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8A8_UNORM
|
||||
* OpenGL ES: GL_RGBA8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1,
|
||||
|
||||
/**
|
||||
* 32 bits per pixel, 8 bits per channel format where alpha values are
|
||||
* ignored (always opaque).
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8A8_UNORM
|
||||
* OpenGL ES: GL_RGB8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8_UNORM
|
||||
* OpenGL ES: GL_RGB8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16
|
||||
* OpenGL ES: GL_RGB565
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4,
|
||||
|
||||
AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM = 5,
|
||||
AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM = 6,
|
||||
AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM = 7,
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
|
||||
* OpenGL ES: GL_RGBA16F
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32
|
||||
* OpenGL ES: GL_RGB10_A2
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b,
|
||||
|
||||
/**
|
||||
* An opaque binary blob format that must have height 1, with width equal to
|
||||
* the buffer size in bytes.
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_BLOB = 0x21,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D16_UNORM
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT16
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_X8_D24_UNORM_PACK32
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT24
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D24_UNORM_S8_UINT
|
||||
* OpenGL ES: GL_DEPTH24_STENCIL8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D32_SFLOAT
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT32F
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D32_SFLOAT_S8_UINT
|
||||
* OpenGL ES: GL_DEPTH32F_STENCIL8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_S8_UINT
|
||||
* OpenGL ES: GL_STENCIL_INDEX8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// In the Android system:
|
||||
// - AHardwareBuffer is essentially a typedef of GraphicBuffer. Conversion functions simply
|
||||
// reinterpret_cast.
|
||||
// - GraphicBuffer inherits from two base classes, ANativeWindowBuffer and RefBase.
|
||||
//
|
||||
// GraphicBuffer implements a getter for ANativeWindowBuffer (getNativeBuffer) by static_casting
|
||||
// itself to its base class ANativeWindowBuffer. The offset of the ANativeWindowBuffer pointer
|
||||
// from the GraphicBuffer pointer is 16 bytes. This is likely due to two pointers: The vtable of
|
||||
// GraphicBuffer and the one pointer member of the RefBase class.
|
||||
//
|
||||
// This is not future proof at all. We need to look into getting utilities added to Android to
|
||||
// perform this cast for us.
|
||||
constexpr int kAHardwareBufferToANativeWindowBufferOffset = static_cast<int>(sizeof(void *)) * 2;
|
||||
|
||||
template <typename T1, typename T2>
|
||||
T1 *offsetPointer(T2 *ptr, int bytes)
|
||||
{
|
||||
return reinterpret_cast<T1 *>(reinterpret_cast<intptr_t>(ptr) + bytes);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace android
|
||||
{
|
||||
|
||||
ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer)
|
||||
{
|
||||
return reinterpret_cast<ANativeWindowBuffer *>(clientBuffer);
|
||||
}
|
||||
|
||||
void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
|
||||
int *width,
|
||||
int *height,
|
||||
int *depth,
|
||||
int *pixelFormat)
|
||||
{
|
||||
*width = buffer->width;
|
||||
*height = buffer->height;
|
||||
*depth = static_cast<int>(buffer->layerCount);
|
||||
*height = buffer->height;
|
||||
*pixelFormat = buffer->format;
|
||||
}
|
||||
|
||||
GLenum NativePixelFormatToGLInternalFormat(int pixelFormat)
|
||||
{
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
|
||||
return GL_RGBA8;
|
||||
case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
|
||||
return GL_RGB8;
|
||||
case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
|
||||
return GL_RGB8;
|
||||
case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
|
||||
return GL_RGB565;
|
||||
case AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM:
|
||||
return GL_BGRA8_EXT;
|
||||
case AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM:
|
||||
return GL_RGB5_A1;
|
||||
case AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM:
|
||||
return GL_RGBA4;
|
||||
case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
|
||||
return GL_RGBA16F;
|
||||
case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
|
||||
return GL_RGB10_A2;
|
||||
case AHARDWAREBUFFER_FORMAT_BLOB:
|
||||
return GL_NONE;
|
||||
case AHARDWAREBUFFER_FORMAT_D16_UNORM:
|
||||
return GL_DEPTH_COMPONENT16;
|
||||
case AHARDWAREBUFFER_FORMAT_D24_UNORM:
|
||||
return GL_DEPTH_COMPONENT24;
|
||||
case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT:
|
||||
return GL_DEPTH24_STENCIL8;
|
||||
case AHARDWAREBUFFER_FORMAT_D32_FLOAT:
|
||||
return GL_DEPTH_COMPONENT32F;
|
||||
case AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT:
|
||||
return GL_DEPTH32F_STENCIL8;
|
||||
case AHARDWAREBUFFER_FORMAT_S8_UINT:
|
||||
return GL_STENCIL_INDEX8;
|
||||
default:
|
||||
return GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer)
|
||||
{
|
||||
return offsetPointer<AHardwareBuffer>(windowBuffer,
|
||||
-kAHardwareBufferToANativeWindowBufferOffset);
|
||||
}
|
||||
|
||||
EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer)
|
||||
{
|
||||
return offsetPointer<EGLClientBuffer>(hardwareBuffer,
|
||||
kAHardwareBufferToANativeWindowBufferOffset);
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
} // namespace angle
|
|
@ -1,39 +0,0 @@
|
|||
//
|
||||
// Copyright 2018 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.
|
||||
//
|
||||
|
||||
// android_util.h: Utilities for the using the Android platform
|
||||
|
||||
#ifndef COMMON_ANDROIDUTIL_H_
|
||||
#define COMMON_ANDROIDUTIL_H_
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include "angle_gl.h"
|
||||
|
||||
struct ANativeWindowBuffer;
|
||||
struct AHardwareBuffer;
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace android
|
||||
{
|
||||
|
||||
ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer);
|
||||
EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer);
|
||||
|
||||
void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
|
||||
int *width,
|
||||
int *height,
|
||||
int *depth,
|
||||
int *pixelFormat);
|
||||
GLenum NativePixelFormatToGLInternalFormat(int pixelFormat);
|
||||
|
||||
AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer);
|
||||
|
||||
} // namespace android
|
||||
} // namespace angle
|
||||
|
||||
#endif // COMMON_ANDROIDUTIL_H_
|
|
@ -324,10 +324,4 @@ std::string ToString(const T &value)
|
|||
# define ANGLE_NO_DISCARD
|
||||
#endif // __has_cpp_attribute(nodiscard)
|
||||
|
||||
#if __has_cpp_attribute(maybe_unused)
|
||||
# define ANGLE_MAYBE_UNUSED [[maybe_unused]]
|
||||
#else
|
||||
# define ANGLE_MAYBE_UNUSED
|
||||
#endif // __has_cpp_attribute(maybe_unused)
|
||||
|
||||
#endif // COMMON_ANGLEUTILS_H_
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
|
||||
namespace angle
|
||||
{
|
||||
template <typename BitsT, typename ParamT>
|
||||
constexpr static BitsT Bit(ParamT x)
|
||||
{
|
||||
return (static_cast<BitsT>(1) << static_cast<size_t>(x));
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT, typename ParamT = std::size_t>
|
||||
class BitSetT final
|
||||
|
@ -133,10 +128,14 @@ class BitSetT final
|
|||
Iterator end() const { return Iterator(BitSetT()); }
|
||||
|
||||
private:
|
||||
constexpr static BitsT Bit(ParamT x)
|
||||
{
|
||||
return (static_cast<BitsT>(1) << static_cast<size_t>(x));
|
||||
}
|
||||
// Produces a mask of ones up to the "x"th bit.
|
||||
constexpr static BitsT Mask(std::size_t x)
|
||||
{
|
||||
return ((Bit<BitsT>(static_cast<ParamT>(x - 1)) - 1) << 1) + 1;
|
||||
return ((Bit(static_cast<ParamT>(x - 1)) - 1) << 1) + 1;
|
||||
}
|
||||
|
||||
BitsT mBits;
|
||||
|
@ -284,7 +283,7 @@ constexpr bool BitSetT<N, BitsT, ParamT>::operator[](ParamT pos) const
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
bool BitSetT<N, BitsT, ParamT>::test(ParamT pos) const
|
||||
{
|
||||
return (mBits & Bit<BitsT>(pos)) != 0;
|
||||
return (mBits & Bit(pos)) != 0;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT, typename ParamT>
|
||||
|
@ -331,7 +330,7 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator|=(const BitSetT &
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator^=(const BitSetT &other)
|
||||
{
|
||||
mBits = mBits ^ other.mBits;
|
||||
mBits = (mBits ^ other.mBits) & Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -351,14 +350,14 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator&=(BitsT value)
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator|=(BitsT value)
|
||||
{
|
||||
mBits |= value & Mask(N);
|
||||
mBits |= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator^=(BitsT value)
|
||||
{
|
||||
mBits ^= value & Mask(N);
|
||||
mBits ^= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -391,7 +390,6 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator>>=(std::size_t po
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set()
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
mBits = Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
@ -399,10 +397,9 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set()
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set(ParamT pos, bool value)
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
if (value)
|
||||
{
|
||||
mBits |= Bit<BitsT>(pos) & Mask(N);
|
||||
mBits |= Bit(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -414,7 +411,6 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set(ParamT pos, bool value
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::reset()
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
mBits = 0;
|
||||
return *this;
|
||||
}
|
||||
|
@ -422,15 +418,13 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::reset()
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::reset(ParamT pos)
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
mBits &= ~Bit<BitsT>(pos);
|
||||
mBits &= ~Bit(pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::flip()
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
mBits ^= Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
@ -438,8 +432,7 @@ BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::flip()
|
|||
template <size_t N, typename BitsT, typename ParamT>
|
||||
BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::flip(ParamT pos)
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
mBits ^= Bit<BitsT>(pos) & Mask(N);
|
||||
mBits ^= Bit(pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "common/Optional.h"
|
||||
#include "common/angleutils.h"
|
||||
#include "common/system_utils.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
@ -36,7 +35,7 @@ DebugAnnotator *g_debugAnnotator = nullptr;
|
|||
std::mutex *g_debugMutex = nullptr;
|
||||
|
||||
constexpr std::array<const char *, LOG_NUM_SEVERITIES> g_logSeverityNames = {
|
||||
{"EVENT", "INFO", "WARN", "ERR", "FATAL"}};
|
||||
{"EVENT", "WARN", "ERR"}};
|
||||
|
||||
constexpr const char *LogSeverityName(int severity)
|
||||
{
|
||||
|
@ -158,7 +157,7 @@ LogMessage::~LogMessage()
|
|||
lock = std::unique_lock<std::mutex>(*g_debugMutex);
|
||||
}
|
||||
|
||||
if (DebugAnnotationsInitialized() && (mSeverity >= LOG_INFO))
|
||||
if (DebugAnnotationsInitialized() && (mSeverity == LOG_ERR || mSeverity == LOG_WARN))
|
||||
{
|
||||
g_debugAnnotator->logMessage(*this);
|
||||
}
|
||||
|
@ -166,18 +165,6 @@ LogMessage::~LogMessage()
|
|||
{
|
||||
Trace(getSeverity(), getMessage().c_str());
|
||||
}
|
||||
|
||||
if (mSeverity == LOG_FATAL)
|
||||
{
|
||||
if (angle::IsDebuggerAttached())
|
||||
{
|
||||
angle::BreakDebugger();
|
||||
}
|
||||
else
|
||||
{
|
||||
ANGLE_CRASH();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Trace(LogSeverity severity, const char *message)
|
||||
|
@ -203,33 +190,14 @@ void Trace(LogSeverity severity, const char *message)
|
|||
}
|
||||
}
|
||||
|
||||
if (severity == LOG_FATAL || severity == LOG_ERR || severity == LOG_WARN ||
|
||||
severity == LOG_INFO)
|
||||
if (severity == LOG_ERR || severity == LOG_WARN)
|
||||
{
|
||||
#if defined(ANGLE_PLATFORM_ANDROID)
|
||||
android_LogPriority android_priority = ANDROID_LOG_ERROR;
|
||||
switch (severity)
|
||||
{
|
||||
case LOG_INFO:
|
||||
android_priority = ANDROID_LOG_INFO;
|
||||
break;
|
||||
case LOG_WARN:
|
||||
android_priority = ANDROID_LOG_WARN;
|
||||
break;
|
||||
case LOG_ERR:
|
||||
android_priority = ANDROID_LOG_ERROR;
|
||||
break;
|
||||
case LOG_FATAL:
|
||||
android_priority = ANDROID_LOG_FATAL;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
__android_log_print(android_priority, "ANGLE", "%s: %s\n", LogSeverityName(severity),
|
||||
str.c_str());
|
||||
__android_log_print((severity == LOG_ERR) ? ANDROID_LOG_ERROR : ANDROID_LOG_WARN, "ANGLE",
|
||||
"%s: %s\n", LogSeverityName(severity), str.c_str());
|
||||
#else
|
||||
// Note: we use fprintf because <iostream> includes static initializers.
|
||||
fprintf((severity >= LOG_ERR) ? stderr : stdout, "%s: %s\n", LogSeverityName(severity),
|
||||
fprintf((severity == LOG_ERR) ? stderr : stdout, "%s: %s\n", LogSeverityName(severity),
|
||||
str.c_str());
|
||||
#endif
|
||||
}
|
||||
|
@ -237,7 +205,7 @@ void Trace(LogSeverity severity, const char *message)
|
|||
#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)
|
||||
if (severity == LOG_ERR)
|
||||
# endif // !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
|
||||
{
|
||||
OutputDebugStringA(str.c_str());
|
||||
|
@ -246,7 +214,7 @@ void Trace(LogSeverity severity, const char *message)
|
|||
|
||||
#if defined(ANGLE_ENABLE_DEBUG_TRACE)
|
||||
# if defined(NDEBUG)
|
||||
if (severity == LOG_EVENT || severity == LOG_WARN || severity == LOG_INFO)
|
||||
if (severity == LOG_EVENT || severity == LOG_WARN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,11 +44,9 @@ 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_INFO = 1;
|
||||
constexpr LogSeverity LOG_WARN = 2;
|
||||
constexpr LogSeverity LOG_ERR = 3;
|
||||
constexpr LogSeverity LOG_FATAL = 4;
|
||||
constexpr LogSeverity LOG_NUM_SEVERITIES = 5;
|
||||
constexpr LogSeverity LOG_WARN = 1;
|
||||
constexpr LogSeverity LOG_ERR = 2;
|
||||
constexpr LogSeverity LOG_NUM_SEVERITIES = 3;
|
||||
|
||||
void Trace(LogSeverity severity, const char *message);
|
||||
|
||||
|
@ -189,20 +187,14 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
// 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_INFO(ClassName, ...) \
|
||||
::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_INFO, ##__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_EX_FATAL(ClassName, ...) \
|
||||
::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_FATAL, ##__VA_ARGS__)
|
||||
|
||||
#define COMPACT_ANGLE_LOG_EVENT COMPACT_ANGLE_LOG_EX_EVENT(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_INFO COMPACT_ANGLE_LOG_EX_INFO(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_WARN COMPACT_ANGLE_LOG_EX_WARN(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_ERR COMPACT_ANGLE_LOG_EX_ERR(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_FATAL COMPACT_ANGLE_LOG_EX_FATAL(LogMessage)
|
||||
|
||||
#define ANGLE_LOG_IS_ON(severity) (::gl::priv::ShouldCreatePlatformLogMessage(::gl::LOG_##severity))
|
||||
|
||||
|
@ -233,10 +225,8 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
# define ANGLE_ENABLE_ASSERTS
|
||||
#endif
|
||||
|
||||
#define INFO() ANGLE_LOG(INFO)
|
||||
#define WARN() ANGLE_LOG(WARN)
|
||||
#define ERR() ANGLE_LOG(ERR)
|
||||
#define FATAL() ANGLE_LOG(FATAL)
|
||||
|
||||
// A macro to log a performance event around a scope.
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
|
@ -253,7 +243,7 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
# define EVENT(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
# define ANGLE_CRASH() __builtin_trap()
|
||||
#else
|
||||
# define ANGLE_CRASH() ((void)(*(volatile char *)0 = 0)), __assume(0)
|
||||
|
@ -261,9 +251,11 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
|
||||
#if !defined(NDEBUG)
|
||||
# define ANGLE_ASSERT_IMPL(expression) assert(expression)
|
||||
# define ANGLE_ASSERT_IMPL_IS_NORETURN 0
|
||||
#else
|
||||
// TODO(jmadill): Detect if debugger is attached and break.
|
||||
# define ANGLE_ASSERT_IMPL(expression) ANGLE_CRASH()
|
||||
# define ANGLE_ASSERT_IMPL_IS_NORETURN 1
|
||||
#endif // !defined(NDEBUG)
|
||||
|
||||
// Note that gSwallowStream is used instead of an arbitrary LOG() stream to avoid the creation of an
|
||||
|
@ -280,16 +272,17 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
|
||||
// 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) \
|
||||
: (FATAL() << "\t! Assert failed in " << __FUNCTION__ << " (" << __FILE__ \
|
||||
<< ":" << __LINE__ << "): " << #expression))
|
||||
# define ASSERT(expression) \
|
||||
(expression ? static_cast<void>(0) \
|
||||
: ((ERR() << "\t! Assert failed in " << __FUNCTION__ << "(" << __LINE__ \
|
||||
<< "): " << #expression), \
|
||||
ANGLE_ASSERT_IMPL(expression)))
|
||||
# define UNREACHABLE_IS_NORETURN ANGLE_ASSERT_IMPL_IS_NORETURN
|
||||
#else
|
||||
# define ASSERT(condition) ANGLE_EAT_STREAM_PARAMETERS << !(condition)
|
||||
# define UNREACHABLE_IS_NORETURN 0
|
||||
#endif // defined(ANGLE_ENABLE_ASSERTS)
|
||||
|
||||
#define UNREACHABLE_IS_NORETURN 0
|
||||
|
||||
#define ANGLE_UNUSED_VARIABLE(variable) (static_cast<void>(variable))
|
||||
|
||||
// A macro to indicate unimplemented functionality
|
||||
|
@ -307,11 +300,12 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
} while (0)
|
||||
|
||||
// A macro for code which is not expected to be reached under valid assumptions
|
||||
# define UNREACHABLE() \
|
||||
do \
|
||||
{ \
|
||||
FATAL() << "\t! Unreachable reached: " << __FUNCTION__ << "(" << __FILE__ << ":" \
|
||||
<< __LINE__ << ")"; \
|
||||
# define UNREACHABLE() \
|
||||
do \
|
||||
{ \
|
||||
ERR() << "\t! Unreachable reached: " << __FUNCTION__ << "(" << __FILE__ << ":" \
|
||||
<< __LINE__ << ")"; \
|
||||
ASSERT(false); \
|
||||
} while (0)
|
||||
#else
|
||||
# define UNIMPLEMENTED() \
|
||||
|
@ -341,7 +335,7 @@ std::ostream &FmtHex(std::ostream &os, T value)
|
|||
# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic error \"-Wpadded\"")
|
||||
# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS _Pragma("clang diagnostic pop")
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(COMPILER_GCC)
|
||||
# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS \
|
||||
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic error \"-Wpadded\"")
|
||||
# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS _Pragma("GCC diagnostic pop")
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
namespace angle
|
||||
{
|
||||
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name)
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
|
||||
{
|
||||
auto *platform = ANGLEPlatformCurrent();
|
||||
ASSERT(platform);
|
||||
|
||||
const unsigned char *categoryEnabledFlag =
|
||||
|
@ -24,8 +25,7 @@ const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, cons
|
|||
return &disabled;
|
||||
}
|
||||
|
||||
angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
|
||||
char phase,
|
||||
angle::TraceEventHandle AddTraceEvent(char phase,
|
||||
const unsigned char *categoryGroupEnabled,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
|
@ -35,6 +35,7 @@ angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
|
|||
const unsigned long long *argValues,
|
||||
unsigned char flags)
|
||||
{
|
||||
auto *platform = ANGLEPlatformCurrent();
|
||||
ASSERT(platform);
|
||||
|
||||
double timestamp = platform->monotonicallyIncreasingTime(platform);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace angle
|
||||
{
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name);
|
||||
angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
|
||||
char phase,
|
||||
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(const char *name);
|
||||
angle::TraceEventHandle AddTraceEvent(char phase,
|
||||
const unsigned char *categoryGroupEnabled,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
|
|
|
@ -187,13 +187,9 @@ inline unsigned short float32ToFloat16(float fp32)
|
|||
unsigned int sign = (fp32i & 0x80000000) >> 16;
|
||||
unsigned int abs = fp32i & 0x7FFFFFFF;
|
||||
|
||||
if (abs > 0x7F800000)
|
||||
{ // NaN
|
||||
return 0x7FFF;
|
||||
}
|
||||
else if (abs > 0x47FFEFFF)
|
||||
{ // Infinity
|
||||
return static_cast<uint16_t>(sign | 0x7C00);
|
||||
if (abs > 0x47FFEFFF) // Infinity
|
||||
{
|
||||
return static_cast<unsigned short>(sign | 0x7FFF);
|
||||
}
|
||||
else if (abs < 0x38800000) // Denormal
|
||||
{
|
||||
|
@ -1248,31 +1244,17 @@ angle::CheckedNumeric<T> CheckedRoundUp(const T value, const T alignment)
|
|||
return roundUp(checkedValue, checkedAlignment);
|
||||
}
|
||||
|
||||
inline constexpr unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
|
||||
inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
|
||||
{
|
||||
unsigned int divided = value / divisor;
|
||||
return (divided + ((value % divisor == 0) ? 0 : 1));
|
||||
}
|
||||
|
||||
#if defined(__has_builtin)
|
||||
# define ANGLE_HAS_BUILTIN(x) __has_builtin(x)
|
||||
#else
|
||||
# define ANGLE_HAS_BUILTIN(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
# define ANGLE_ROTL(x, y) _rotl(x, y)
|
||||
# define ANGLE_ROTL64(x, y) _rotl64(x, y)
|
||||
# define ANGLE_ROTR16(x, y) _rotr16(x, y)
|
||||
|
||||
#elif defined(__clang__) && ANGLE_HAS_BUILTIN(__builtin_rotateleft32) && \
|
||||
ANGLE_HAS_BUILTIN(__builtin_rotateleft64) && ANGLE_HAS_BUILTIN(__builtin_rotateright16)
|
||||
|
||||
# define ANGLE_ROTL(x, y) __builtin_rotateleft32(x, y)
|
||||
# define ANGLE_ROTL64(x, y) __builtin_rotateleft64(x, y)
|
||||
# define ANGLE_ROTR16(x, y) __builtin_rotateright16(x, y)
|
||||
|
||||
#else
|
||||
|
||||
inline uint32_t RotL(uint32_t x, int8_t r)
|
||||
|
@ -1280,18 +1262,12 @@ inline uint32_t RotL(uint32_t x, int8_t r)
|
|||
return (x << r) | (x >> (32 - r));
|
||||
}
|
||||
|
||||
inline uint64_t RotL64(uint64_t x, int8_t r)
|
||||
{
|
||||
return (x << r) | (x >> (64 - r));
|
||||
}
|
||||
|
||||
inline uint16_t RotR16(uint16_t x, int8_t r)
|
||||
{
|
||||
return (x >> r) | (x << (16 - r));
|
||||
}
|
||||
|
||||
# define ANGLE_ROTL(x, y) ::rx::RotL(x, y)
|
||||
# define ANGLE_ROTL64(x, y) ::rx::RotL64(x, y)
|
||||
# define ANGLE_ROTR16(x, y) ::rx::RotR16(x, y)
|
||||
|
||||
#endif // namespace rx
|
||||
|
|
|
@ -57,7 +57,7 @@ std::vector<std::string> SplitString(const std::string &input,
|
|||
|
||||
if (resultType == SPLIT_WANT_ALL || !piece.empty())
|
||||
{
|
||||
result.push_back(std::move(piece));
|
||||
result.push_back(piece);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,26 +101,6 @@ std::string TrimString(const std::string &input, const std::string &trimChars)
|
|||
return input.substr(begin, end - begin + 1);
|
||||
}
|
||||
|
||||
std::string GetPrefix(const std::string &input, size_t offset, const char *delimiter)
|
||||
{
|
||||
size_t match = input.find(delimiter, offset);
|
||||
if (match == std::string::npos)
|
||||
{
|
||||
return input.substr(offset);
|
||||
}
|
||||
return input.substr(offset, match - offset);
|
||||
}
|
||||
|
||||
std::string GetPrefix(const std::string &input, size_t offset, char delimiter)
|
||||
{
|
||||
size_t match = input.find(delimiter, offset);
|
||||
if (match == std::string::npos)
|
||||
{
|
||||
return input.substr(offset);
|
||||
}
|
||||
return input.substr(offset, match - offset);
|
||||
}
|
||||
|
||||
bool HexStringToUInt(const std::string &input, unsigned int *uintOut)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
|
@ -157,6 +137,27 @@ 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)
|
||||
mbstate_t mbstate = {};
|
||||
size_t written = mbsrtowcs(wcstring.data(), &cString, length + 1, &mbstate);
|
||||
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;
|
||||
|
|
|
@ -41,14 +41,12 @@ void SplitStringAlongWhitespace(const std::string &input, std::vector<std::strin
|
|||
|
||||
std::string TrimString(const std::string &input, const std::string &trimChars);
|
||||
|
||||
// Return the substring starting at offset and up to the first occurance of the |delimeter|.
|
||||
std::string GetPrefix(const std::string &input, size_t offset, const char *delimiter);
|
||||
std::string GetPrefix(const std::string &input, size_t offset, char delimiter);
|
||||
|
||||
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);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
bool PrependPathToEnvironmentVar(const char *variableName, const char *path)
|
||||
{
|
||||
std::string oldValue = GetEnvironmentVar(variableName);
|
||||
|
@ -28,4 +29,5 @@ bool PrependPathToEnvironmentVar(const char *variableName, const char *path)
|
|||
}
|
||||
return SetEnvironmentVar(variableName, newValue);
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
|
|
@ -24,13 +24,10 @@ bool UnsetEnvironmentVar(const char *variableName);
|
|||
std::string GetEnvironmentVar(const char *variableName);
|
||||
const char *GetPathSeparator();
|
||||
bool PrependPathToEnvironmentVar(const char *variableName, const char *path);
|
||||
bool IsDirectory(const char *filename);
|
||||
|
||||
// Run an application and get the output. Gets a nullptr-terminated set of args to execute the
|
||||
// application with, and returns the stdout and stderr outputs as well as the exit code.
|
||||
//
|
||||
// Pass nullptr for stdoutOut/stderrOut if you don't need to capture. exitCodeOut is required.
|
||||
//
|
||||
// Returns false if it fails to actually execute the application.
|
||||
bool RunApp(const std::vector<const char *> &args,
|
||||
std::string *stdoutOut,
|
||||
|
@ -51,21 +48,7 @@ class Library : angle::NonCopyable
|
|||
}
|
||||
};
|
||||
|
||||
// Use SYSTEM_DIR to bypass loading ANGLE libraries with the same name as system DLLS
|
||||
// (e.g. opengl32.dll)
|
||||
enum class SearchType
|
||||
{
|
||||
ApplicationDir,
|
||||
SystemDir
|
||||
};
|
||||
|
||||
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType);
|
||||
|
||||
// Returns true if the process is currently being debugged.
|
||||
bool IsDebuggerAttached();
|
||||
|
||||
// Calls system APIs to break into the debugger.
|
||||
void BreakDebugger();
|
||||
Library *OpenSharedLibrary(const char *libraryName);
|
||||
} // namespace angle
|
||||
|
||||
#endif // COMMON_SYSTEM_UTILS_H_
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <array>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
@ -248,29 +247,8 @@ class PosixLibrary : public Library
|
|||
void *mModule = nullptr;
|
||||
};
|
||||
|
||||
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
|
||||
Library *OpenSharedLibrary(const char *libraryName)
|
||||
{
|
||||
return new PosixLibrary(libraryName);
|
||||
}
|
||||
|
||||
bool IsDirectory(const char *filename)
|
||||
{
|
||||
struct stat st;
|
||||
int result = stat(filename, &st);
|
||||
return result == 0 && ((st.st_mode & S_IFDIR) == S_IFDIR);
|
||||
}
|
||||
|
||||
bool IsDebuggerAttached()
|
||||
{
|
||||
// This could have a fuller implementation.
|
||||
// See https://cs.chromium.org/chromium/src/base/debug/debugger_posix.cc
|
||||
return false;
|
||||
}
|
||||
|
||||
void BreakDebugger()
|
||||
{
|
||||
// This could have a fuller implementation.
|
||||
// See https://cs.chromium.org/chromium/src/base/debug/debugger_posix.cc
|
||||
abort();
|
||||
}
|
||||
} // namespace angle
|
||||
|
|
|
@ -193,11 +193,7 @@ bool RunApp(const std::vector<const char *> &args,
|
|||
{
|
||||
startInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
}
|
||||
|
||||
if (stderrOut || stdoutOut)
|
||||
{
|
||||
startInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||
}
|
||||
startInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||
|
||||
// Create the child process.
|
||||
PROCESS_INFORMATION processInfo = {};
|
||||
|
@ -245,21 +241,13 @@ bool RunApp(const std::vector<const char *> &args,
|
|||
class Win32Library : public Library
|
||||
{
|
||||
public:
|
||||
Win32Library(const char *libraryName, SearchType searchType)
|
||||
Win32Library(const char *libraryName)
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
int ret = snprintf(buffer, MAX_PATH, "%s.%s", libraryName, GetSharedLibraryExtension());
|
||||
if (ret > 0 && ret < MAX_PATH)
|
||||
{
|
||||
switch (searchType)
|
||||
{
|
||||
case SearchType::ApplicationDir:
|
||||
mModule = LoadLibraryA(buffer);
|
||||
break;
|
||||
case SearchType::SystemDir:
|
||||
mModule = LoadLibraryExA(buffer, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
break;
|
||||
}
|
||||
mModule = LoadLibraryA(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,32 +275,8 @@ class Win32Library : public Library
|
|||
HMODULE mModule = nullptr;
|
||||
};
|
||||
|
||||
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
|
||||
Library *OpenSharedLibrary(const char *libraryName)
|
||||
{
|
||||
return new Win32Library(libraryName, searchType);
|
||||
}
|
||||
|
||||
bool IsDirectory(const char *filename)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileInformation;
|
||||
|
||||
BOOL result = GetFileAttributesExA(filename, GetFileExInfoStandard, &fileInformation);
|
||||
if (result)
|
||||
{
|
||||
DWORD attribs = fileInformation.dwFileAttributes;
|
||||
return (attribs != INVALID_FILE_ATTRIBUTES) && ((attribs & FILE_ATTRIBUTE_DIRECTORY) > 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsDebuggerAttached()
|
||||
{
|
||||
return !!::IsDebuggerPresent();
|
||||
}
|
||||
|
||||
void BreakDebugger()
|
||||
{
|
||||
__debugbreak();
|
||||
return new Win32Library(libraryName);
|
||||
}
|
||||
} // namespace angle
|
||||
|
|
|
@ -89,14 +89,6 @@ class CheckedNumeric
|
|||
// IsValid() is the public API to test if a CheckedNumeric is currently valid.
|
||||
bool IsValid() const { return validity() == RANGE_VALID; }
|
||||
|
||||
// AssignIfValid(Dst) - Assigns the underlying value if it is currently valid and is within the
|
||||
// range supported by the destination type. Returns true if successful and false otherwise.
|
||||
template <typename Dst>
|
||||
constexpr bool AssignIfValid(Dst *result) const
|
||||
{
|
||||
return IsValid() ? ((*result = static_cast<Dst>(state_.value())), true) : false;
|
||||
}
|
||||
|
||||
// ValueOrDie() The primary accessor for the underlying value. If the current
|
||||
// state is not valid it will CHECK and crash.
|
||||
T ValueOrDie() const
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by gen_uniform_type_table.py.
|
||||
//
|
||||
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright 2018 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.
|
||||
//
|
||||
|
@ -20,159 +20,150 @@ namespace
|
|||
{
|
||||
constexpr std::array<UniformTypeInfo, 62> kInfoTable = {
|
||||
{{GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 0, 0, 0, 0, 0 * 0,
|
||||
0 * 0, false, false, false, ""},
|
||||
0 * 0, false, false, false},
|
||||
{GL_BOOL, GL_BOOL, GL_NONE, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false, ""},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false},
|
||||
{GL_BOOL_VEC2, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC2, SamplerFormat::InvalidEnum, 1, 2, 2,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false, ""},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false},
|
||||
{GL_BOOL_VEC3, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false, ""},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false},
|
||||
{GL_BOOL_VEC4, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false, ""},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
|
||||
{GL_FLOAT, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 1, false, false, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 1, false, false, false},
|
||||
{GL_FLOAT_MAT2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2, GL_NONE, SamplerFormat::InvalidEnum, 2, 2, 4,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 4, false, true, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 4, false, true, false},
|
||||
{GL_FLOAT_MAT2x3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3x2, GL_NONE, SamplerFormat::InvalidEnum, 3,
|
||||
2, 6, sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 6, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 4,
|
||||
2, 8, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 8, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 3, 3, 9,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 9, false, true, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 9, false, true, false},
|
||||
{GL_FLOAT_MAT3x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x3, GL_NONE, SamplerFormat::InvalidEnum, 2,
|
||||
3, 6, sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 6, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 4,
|
||||
3, 12, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 12, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 4, 4,
|
||||
16, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 16, false, true, false, ""},
|
||||
16, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 16, false, true, false},
|
||||
{GL_FLOAT_MAT4x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x4, GL_NONE, SamplerFormat::InvalidEnum, 2,
|
||||
4, 8, sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 8, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 3,
|
||||
4, 12, sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 12, false, true, false, ""},
|
||||
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, SamplerFormat::InvalidEnum, 1, 2, 2,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 2, false, false, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 2, false, false, false},
|
||||
{GL_FLOAT_VEC3, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 3, false, false, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 3, false, false, false},
|
||||
{GL_FLOAT_VEC4, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 4, false, false, false, ""},
|
||||
sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 4, false, false, false},
|
||||
{GL_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
|
||||
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, SamplerFormat::InvalidEnum,
|
||||
1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
|
||||
"intBitsToFloat"},
|
||||
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, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1,
|
||||
1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
|
||||
"intBitsToFloat"},
|
||||
1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT, GL_INT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false},
|
||||
{GL_INT_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1,
|
||||
false, false, true, "intBitsToFloat"},
|
||||
false, false, true},
|
||||
{GL_INT_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
|
||||
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, SamplerFormat::InvalidEnum,
|
||||
1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
|
||||
"intBitsToFloat"},
|
||||
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, SamplerFormat::Signed, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
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, SamplerFormat::Signed,
|
||||
1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
|
||||
"intBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::Signed, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
|
||||
false, false, "intBitsToFloat"},
|
||||
false, false},
|
||||
{GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE,
|
||||
GL_NONE, SamplerFormat::Signed, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1,
|
||||
true, false, false, "intBitsToFloat"},
|
||||
true, false, false},
|
||||
{GL_INT_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::Signed, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
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, SamplerFormat::Signed, 1,
|
||||
1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
|
||||
"intBitsToFloat"},
|
||||
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, SamplerFormat::InvalidEnum, 1, 2, 2,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false},
|
||||
{GL_INT_VEC3, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false},
|
||||
{GL_INT_VEC4, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
|
||||
{GL_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
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, SamplerFormat::Float, 1,
|
||||
1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
|
||||
"intBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::Shadow, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
|
||||
false, false, "intBitsToFloat"},
|
||||
false, false},
|
||||
{GL_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE,
|
||||
SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
|
||||
false, false, "intBitsToFloat"},
|
||||
false, false},
|
||||
{GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE,
|
||||
SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
|
||||
false, false, "intBitsToFloat"},
|
||||
false, false},
|
||||
{GL_SAMPLER_2D_RECT_ANGLE, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1,
|
||||
1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
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, SamplerFormat::Shadow, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
|
||||
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, SamplerFormat::Shadow,
|
||||
1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
|
||||
"intBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
|
||||
false, false, "intBitsToFloat"},
|
||||
false, false},
|
||||
{GL_UNSIGNED_INT, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1,
|
||||
1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false,
|
||||
"uintBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
false, false, false, "uintBitsToFloat"},
|
||||
false, false, false},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
false, false, true, "uintBitsToFloat"},
|
||||
false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
false, false, true, "uintBitsToFloat"},
|
||||
false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
false, false, true, "uintBitsToFloat"},
|
||||
false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE,
|
||||
SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
false, false, true, "uintBitsToFloat"},
|
||||
false, false, true},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE,
|
||||
SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
true, false, false, "uintBitsToFloat"},
|
||||
true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
|
||||
SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
true, false, false, "uintBitsToFloat"},
|
||||
true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_UNSIGNED_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE,
|
||||
GL_NONE, SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4,
|
||||
sizeof(GLuint) * 1, true, false, false, "uintBitsToFloat"},
|
||||
sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_UNSIGNED_INT,
|
||||
GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE, SamplerFormat::Unsigned, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false,
|
||||
"uintBitsToFloat"},
|
||||
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,
|
||||
SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
true, false, false, "uintBitsToFloat"},
|
||||
true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE,
|
||||
SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
|
||||
true, false, false, "uintBitsToFloat"},
|
||||
true, false, false},
|
||||
{GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2,
|
||||
SamplerFormat::InvalidEnum, 1, 2, 2, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 2,
|
||||
false, false, false, "uintBitsToFloat"},
|
||||
false, false, false},
|
||||
{GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3,
|
||||
SamplerFormat::InvalidEnum, 1, 3, 3, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 3,
|
||||
false, false, false, "uintBitsToFloat"},
|
||||
false, false, false},
|
||||
{GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4,
|
||||
SamplerFormat::InvalidEnum, 1, 4, 4, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 4,
|
||||
false, false, false, "uintBitsToFloat"}}};
|
||||
false, false, false}}};
|
||||
|
||||
size_t GetTypeInfoIndex(GLenum uniformType)
|
||||
{
|
||||
|
|
|
@ -771,8 +771,7 @@ std::string ParseResourceName(const std::string &name, std::vector<unsigned int>
|
|||
}
|
||||
|
||||
const sh::ShaderVariable *FindShaderVarField(const sh::ShaderVariable &var,
|
||||
const std::string &fullName,
|
||||
GLuint *fieldIndexOut)
|
||||
const std::string &fullName)
|
||||
{
|
||||
if (var.fields.empty())
|
||||
{
|
||||
|
@ -793,12 +792,11 @@ const sh::ShaderVariable *FindShaderVarField(const sh::ShaderVariable &var,
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
for (size_t field = 0; field < var.fields.size(); ++field)
|
||||
for (const auto &field : var.fields)
|
||||
{
|
||||
if (var.fields[field].name == fieldName)
|
||||
if (field.name == fieldName)
|
||||
{
|
||||
*fieldIndexOut = static_cast<GLuint>(field);
|
||||
return &var.fields[field];
|
||||
return &field;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -893,22 +891,6 @@ unsigned int ElementTypeSize(GLenum elementType)
|
|||
}
|
||||
}
|
||||
|
||||
PipelineType GetPipelineType(ShaderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ShaderType::Vertex:
|
||||
case ShaderType::Fragment:
|
||||
case ShaderType::Geometry:
|
||||
return PipelineType::GraphicsPipeline;
|
||||
case ShaderType::Compute:
|
||||
return PipelineType::ComputePipeline;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return PipelineType::GraphicsPipeline;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
@ -970,7 +952,6 @@ bool IsExternalImageTarget(EGLenum target)
|
|||
switch (target)
|
||||
{
|
||||
case EGL_NATIVE_BUFFER_ANDROID:
|
||||
case EGL_D3D11_TEXTURE_ANGLE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
|
@ -62,8 +62,7 @@ std::string ParseResourceName(const std::string &name, std::vector<unsigned int>
|
|||
// Find the child field which matches 'fullName' == var.name + "." + field.name.
|
||||
// Return nullptr if not found.
|
||||
const sh::ShaderVariable *FindShaderVarField(const sh::ShaderVariable &var,
|
||||
const std::string &fullName,
|
||||
GLuint *fieldIndexOut);
|
||||
const std::string &fullName);
|
||||
|
||||
// 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.
|
||||
|
@ -75,20 +74,6 @@ IndexRange ComputeIndexRange(DrawElementsType indexType,
|
|||
// Get the primitive restart index value for the given index type.
|
||||
GLuint GetPrimitiveRestartIndex(DrawElementsType indexType);
|
||||
|
||||
// Get the primitive restart index value with the given C++ type.
|
||||
template <typename T>
|
||||
constexpr T GetPrimitiveRestartIndexFromType()
|
||||
{
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
static_assert(GetPrimitiveRestartIndexFromType<uint8_t>() == 0xFF,
|
||||
"verify restart index for uint8_t values");
|
||||
static_assert(GetPrimitiveRestartIndexFromType<uint16_t>() == 0xFFFF,
|
||||
"verify restart index for uint8_t values");
|
||||
static_assert(GetPrimitiveRestartIndexFromType<uint32_t>() == 0xFFFFFFFF,
|
||||
"verify restart index for uint8_t values");
|
||||
|
||||
bool IsTriangleMode(PrimitiveMode drawMode);
|
||||
|
||||
namespace priv
|
||||
|
@ -139,8 +124,7 @@ struct UniformTypeInfo final : angle::NonCopyable
|
|||
size_t externalSize,
|
||||
bool isSampler,
|
||||
bool isMatrixType,
|
||||
bool isImageType,
|
||||
const char *glslAsFloat);
|
||||
bool isImageType);
|
||||
|
||||
GLenum type;
|
||||
GLenum componentType;
|
||||
|
@ -157,7 +141,6 @@ struct UniformTypeInfo final : angle::NonCopyable
|
|||
bool isSampler;
|
||||
bool isMatrixType;
|
||||
bool isImageType;
|
||||
const char *glslAsFloat;
|
||||
};
|
||||
|
||||
inline constexpr UniformTypeInfo::UniformTypeInfo(GLenum type,
|
||||
|
@ -174,8 +157,7 @@ inline constexpr UniformTypeInfo::UniformTypeInfo(GLenum type,
|
|||
size_t externalSize,
|
||||
bool isSampler,
|
||||
bool isMatrixType,
|
||||
bool isImageType,
|
||||
const char *glslAsFloat)
|
||||
bool isImageType)
|
||||
: type(type),
|
||||
componentType(componentType),
|
||||
textureType(textureType),
|
||||
|
@ -190,8 +172,7 @@ inline constexpr UniformTypeInfo::UniformTypeInfo(GLenum type,
|
|||
externalSize(externalSize),
|
||||
isSampler(isSampler),
|
||||
isMatrixType(isMatrixType),
|
||||
isImageType(isImageType),
|
||||
glslAsFloat(glslAsFloat)
|
||||
isImageType(isImageType)
|
||||
{}
|
||||
|
||||
const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType);
|
||||
|
@ -206,14 +187,6 @@ T GetClampedVertexCount(size_t vertexCount)
|
|||
static constexpr size_t kMax = static_cast<size_t>(std::numeric_limits<T>::max());
|
||||
return static_cast<T>(vertexCount > kMax ? kMax : vertexCount);
|
||||
}
|
||||
|
||||
enum class PipelineType
|
||||
{
|
||||
GraphicsPipeline = 0,
|
||||
ComputePipeline = 1,
|
||||
};
|
||||
|
||||
PipelineType GetPipelineType(ShaderType shaderType);
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
|
|
@ -115,8 +115,8 @@ const char *Diagnostics::message(ID id)
|
|||
return "invalid file number";
|
||||
case PP_INVALID_LINE_DIRECTIVE:
|
||||
return "invalid line directive";
|
||||
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL:
|
||||
return "extension directive must occur before any non-preprocessor tokens in ESSL";
|
||||
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";
|
||||
case PP_TOKENIZER_ERROR:
|
||||
|
@ -129,7 +129,7 @@ const char *Diagnostics::message(ID id)
|
|||
return "unexpected token after conditional expression";
|
||||
case PP_UNRECOGNIZED_PRAGMA:
|
||||
return "unrecognized pragma";
|
||||
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL:
|
||||
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
|
||||
return "extension directive should occur before any non-preprocessor tokens";
|
||||
case PP_WARNING_MACRO_NAME_RESERVED:
|
||||
return "macro name with a double underscore is reserved - unintented behavior is "
|
||||
|
|
|
@ -64,7 +64,7 @@ class Diagnostics
|
|||
PP_INVALID_LINE_NUMBER,
|
||||
PP_INVALID_FILE_NUMBER,
|
||||
PP_INVALID_LINE_DIRECTIVE,
|
||||
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL,
|
||||
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
|
||||
PP_UNDEFINED_SHIFT,
|
||||
PP_TOKENIZER_ERROR,
|
||||
PP_ERROR_END,
|
||||
|
@ -72,7 +72,7 @@ class Diagnostics
|
|||
PP_WARNING_BEGIN,
|
||||
PP_EOF_IN_DIRECTIVE,
|
||||
PP_UNRECOGNIZED_PRAGMA,
|
||||
PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
|
||||
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
|
||||
PP_WARNING_MACRO_NAME_RESERVED,
|
||||
PP_WARNING_END
|
||||
};
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
|
||||
|
||||
#include <string>
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
@ -39,7 +38,7 @@ class DirectiveHandler
|
|||
const std::string &name,
|
||||
const std::string &behavior) = 0;
|
||||
|
||||
virtual void handleVersion(const SourceLocation &loc, int version, ShShaderSpec spec) = 0;
|
||||
virtual void handleVersion(const SourceLocation &loc, int version) = 0;
|
||||
};
|
||||
|
||||
} // namespace pp
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
#include "common/debug.h"
|
||||
#include "compiler/preprocessor/DiagnosticsBase.h"
|
||||
#include "compiler/preprocessor/DirectiveHandlerBase.h"
|
||||
|
@ -669,16 +668,16 @@ void DirectiveParser::parseExtension(Token *token)
|
|||
}
|
||||
if (valid && mSeenNonPreprocessorToken)
|
||||
{
|
||||
if (mSettings.shaderSpec == SH_WEBGL_SPEC && mShaderVersion < 300)
|
||||
if (mShaderVersion >= 300)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
|
||||
mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL,
|
||||
mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if (valid)
|
||||
|
@ -700,8 +699,7 @@ void DirectiveParser::parseVersion(Token *token)
|
|||
enum State
|
||||
{
|
||||
VERSION_NUMBER,
|
||||
VERSION_PROFILE_ES,
|
||||
VERSION_PROFILE_GL,
|
||||
VERSION_PROFILE,
|
||||
VERSION_ENDLINE
|
||||
};
|
||||
|
||||
|
@ -729,22 +727,10 @@ void DirectiveParser::parseVersion(Token *token)
|
|||
}
|
||||
if (valid)
|
||||
{
|
||||
if (sh::IsDesktopGLSpec(mSettings.shaderSpec))
|
||||
{
|
||||
state = VERSION_PROFILE_GL;
|
||||
}
|
||||
else if (version < 300)
|
||||
{
|
||||
state = VERSION_ENDLINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = VERSION_PROFILE_ES;
|
||||
}
|
||||
state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
|
||||
}
|
||||
break;
|
||||
case VERSION_PROFILE_ES:
|
||||
ASSERT(!sh::IsDesktopGLSpec(mSettings.shaderSpec));
|
||||
case VERSION_PROFILE:
|
||||
if (token->type != Token::IDENTIFIER || token->text != "es")
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, token->location,
|
||||
|
@ -753,16 +739,6 @@ void DirectiveParser::parseVersion(Token *token)
|
|||
}
|
||||
state = VERSION_ENDLINE;
|
||||
break;
|
||||
case VERSION_PROFILE_GL:
|
||||
ASSERT(sh::IsDesktopGLSpec(mSettings.shaderSpec));
|
||||
if (token->type != Token::IDENTIFIER || token->text != "core")
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, token->location,
|
||||
token->text);
|
||||
valid = false;
|
||||
}
|
||||
state = VERSION_ENDLINE;
|
||||
break;
|
||||
default:
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
|
||||
token->text);
|
||||
|
@ -771,11 +747,6 @@ void DirectiveParser::parseVersion(Token *token)
|
|||
}
|
||||
|
||||
mTokenizer->lex(token);
|
||||
|
||||
if (token->type == '\n' && state == VERSION_PROFILE_GL)
|
||||
{
|
||||
state = VERSION_ENDLINE;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid && (state != VERSION_ENDLINE))
|
||||
|
@ -794,7 +765,7 @@ void DirectiveParser::parseVersion(Token *token)
|
|||
|
||||
if (valid)
|
||||
{
|
||||
mDirectiveHandler->handleVersion(token->location, version, mSettings.shaderSpec);
|
||||
mDirectiveHandler->handleVersion(token->location, version);
|
||||
mShaderVersion = version;
|
||||
PredefineMacro(mMacroSet, "__VERSION__", version);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,466 @@
|
|||
/*
|
||||
//
|
||||
// Copyright (c) 2012 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.
|
||||
//
|
||||
|
||||
This file contains the Yacc grammar for GLSL ES preprocessor expression.
|
||||
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
|
||||
WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
*/
|
||||
|
||||
%{
|
||||
//
|
||||
// Copyright (c) 2012 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.
|
||||
//
|
||||
|
||||
// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Triggered by the auto-generated pplval variable.
|
||||
#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#else
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(disable: 4065 4244 4701 4702)
|
||||
#endif
|
||||
|
||||
#include "ExpressionParser.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Lexer.h"
|
||||
#include "Token.h"
|
||||
#include "common/mathutil.h"
|
||||
|
||||
typedef int32_t YYSTYPE;
|
||||
typedef uint32_t UNSIGNED_TYPE;
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
namespace {
|
||||
struct Context
|
||||
{
|
||||
angle::pp::Diagnostics *diagnostics;
|
||||
angle::pp::Lexer *lexer;
|
||||
angle::pp::Token *token;
|
||||
int* result;
|
||||
bool parsePresetToken;
|
||||
|
||||
angle::pp::ExpressionParser::ErrorSettings errorSettings;
|
||||
bool *valid;
|
||||
|
||||
void startIgnoreErrors() { ++ignoreErrors; }
|
||||
void endIgnoreErrors() { --ignoreErrors; }
|
||||
|
||||
bool isIgnoringErrors() { return ignoreErrors > 0; }
|
||||
|
||||
int ignoreErrors;
|
||||
};
|
||||
} // namespace
|
||||
%}
|
||||
|
||||
%pure-parser
|
||||
%name-prefix "pp"
|
||||
%parse-param {Context *context}
|
||||
%lex-param {Context *context}
|
||||
|
||||
%{
|
||||
static int yylex(YYSTYPE* lvalp, Context* context);
|
||||
static void yyerror(Context* context, const char* reason);
|
||||
%}
|
||||
|
||||
%token TOK_CONST_INT
|
||||
%token TOK_IDENTIFIER
|
||||
%left TOK_OP_OR
|
||||
%left TOK_OP_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%left TOK_OP_EQ TOK_OP_NE
|
||||
%left '<' '>' TOK_OP_LE TOK_OP_GE
|
||||
%left TOK_OP_LEFT TOK_OP_RIGHT
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%right TOK_UNARY
|
||||
|
||||
%%
|
||||
|
||||
input
|
||||
: expression {
|
||||
*(context->result) = static_cast<int>($1);
|
||||
YYACCEPT;
|
||||
}
|
||||
;
|
||||
|
||||
expression
|
||||
: TOK_CONST_INT
|
||||
| TOK_IDENTIFIER {
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
// This rule should be applied right after the token is lexed, so we can
|
||||
// refer to context->token in the error message.
|
||||
context->diagnostics->report(context->errorSettings.unexpectedIdentifier,
|
||||
context->token->location, context->token->text);
|
||||
*(context->valid) = false;
|
||||
}
|
||||
$$ = $1;
|
||||
}
|
||||
| expression TOK_OP_OR {
|
||||
if ($1 != 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
} expression {
|
||||
if ($1 != 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
$$ = static_cast<YYSTYPE>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 || $4;
|
||||
}
|
||||
}
|
||||
| expression TOK_OP_AND {
|
||||
if ($1 == 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
} expression {
|
||||
if ($1 == 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 && $4;
|
||||
}
|
||||
}
|
||||
| expression '|' expression {
|
||||
$$ = $1 | $3;
|
||||
}
|
||||
| expression '^' expression {
|
||||
$$ = $1 ^ $3;
|
||||
}
|
||||
| expression '&' expression {
|
||||
$$ = $1 & $3;
|
||||
}
|
||||
| expression TOK_OP_NE expression {
|
||||
$$ = $1 != $3;
|
||||
}
|
||||
| expression TOK_OP_EQ expression {
|
||||
$$ = $1 == $3;
|
||||
}
|
||||
| expression TOK_OP_GE expression {
|
||||
$$ = $1 >= $3;
|
||||
}
|
||||
| expression TOK_OP_LE expression {
|
||||
$$ = $1 <= $3;
|
||||
}
|
||||
| expression '>' expression {
|
||||
$$ = $1 > $3;
|
||||
}
|
||||
| expression '<' expression {
|
||||
$$ = $1 < $3;
|
||||
}
|
||||
| expression TOK_OP_RIGHT expression {
|
||||
if ($3 < 0 || $3 > 31)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " >> " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
*(context->valid) = false;
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else if ($1 < 0)
|
||||
{
|
||||
// Logical shift right.
|
||||
$$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) >> $3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 >> $3;
|
||||
}
|
||||
}
|
||||
| expression TOK_OP_LEFT expression {
|
||||
if ($3 < 0 || $3 > 31)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " << " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
*(context->valid) = false;
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Logical shift left. Casting to unsigned is needed to ensure there's no signed integer
|
||||
// overflow, which some tools treat as an error.
|
||||
$$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) << $3);
|
||||
}
|
||||
}
|
||||
| expression '-' expression {
|
||||
$$ = gl::WrappingDiff<YYSTYPE>($1, $3);
|
||||
}
|
||||
| expression '+' expression {
|
||||
$$ = gl::WrappingSum<YYSTYPE>($1, $3);
|
||||
}
|
||||
| expression '%' expression {
|
||||
if ($3 == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " % " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
*(context->valid) = false;
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -1))
|
||||
{
|
||||
// Check for the special case where the minimum representable number is
|
||||
// divided by -1. If left alone this has undefined results.
|
||||
$$ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 % $3;
|
||||
}
|
||||
}
|
||||
| expression '/' expression {
|
||||
if ($3 == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " / " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
*(context->valid) = false;
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -1))
|
||||
{
|
||||
// Check for the special case where the minimum representable number is
|
||||
// divided by -1. If left alone this leads to integer overflow in C++, which
|
||||
// has undefined results.
|
||||
$$ = std::numeric_limits<YYSTYPE>::max();
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 / $3;
|
||||
}
|
||||
}
|
||||
| expression '*' expression {
|
||||
$$ = gl::WrappingMul($1, $3);
|
||||
}
|
||||
| '!' expression %prec TOK_UNARY {
|
||||
$$ = ! $2;
|
||||
}
|
||||
| '~' expression %prec TOK_UNARY {
|
||||
$$ = ~ $2;
|
||||
}
|
||||
| '-' expression %prec TOK_UNARY {
|
||||
// Check for negation of minimum representable integer to prevent undefined signed int
|
||||
// overflow.
|
||||
if ($2 == std::numeric_limits<YYSTYPE>::min())
|
||||
{
|
||||
$$ = std::numeric_limits<YYSTYPE>::min();
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = -$2;
|
||||
}
|
||||
}
|
||||
| '+' expression %prec TOK_UNARY {
|
||||
$$ = + $2;
|
||||
}
|
||||
| '(' expression ')' {
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
int yylex(YYSTYPE *lvalp, Context *context)
|
||||
{
|
||||
angle::pp::Token *token = context->token;
|
||||
if (!context->parsePresetToken)
|
||||
{
|
||||
context->lexer->lex(token);
|
||||
}
|
||||
context->parsePresetToken = false;
|
||||
|
||||
int type = 0;
|
||||
|
||||
switch (token->type)
|
||||
{
|
||||
case angle::pp::Token::CONST_INT: {
|
||||
unsigned int val = 0;
|
||||
int testVal = 0;
|
||||
if (!token->uValue(&val) || (!token->iValue(&testVal) &&
|
||||
context->errorSettings.integerLiteralsMustFit32BitSignedRange))
|
||||
{
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_INTEGER_OVERFLOW,
|
||||
token->location, token->text);
|
||||
*(context->valid) = false;
|
||||
}
|
||||
*lvalp = static_cast<YYSTYPE>(val);
|
||||
type = TOK_CONST_INT;
|
||||
break;
|
||||
}
|
||||
case angle::pp::Token::IDENTIFIER:
|
||||
*lvalp = static_cast<YYSTYPE>(-1);
|
||||
type = TOK_IDENTIFIER;
|
||||
break;
|
||||
case angle::pp::Token::OP_OR:
|
||||
type = TOK_OP_OR;
|
||||
break;
|
||||
case angle::pp::Token::OP_AND:
|
||||
type = TOK_OP_AND;
|
||||
break;
|
||||
case angle::pp::Token::OP_NE:
|
||||
type = TOK_OP_NE;
|
||||
break;
|
||||
case angle::pp::Token::OP_EQ:
|
||||
type = TOK_OP_EQ;
|
||||
break;
|
||||
case angle::pp::Token::OP_GE:
|
||||
type = TOK_OP_GE;
|
||||
break;
|
||||
case angle::pp::Token::OP_LE:
|
||||
type = TOK_OP_LE;
|
||||
break;
|
||||
case angle::pp::Token::OP_RIGHT:
|
||||
type = TOK_OP_RIGHT;
|
||||
break;
|
||||
case angle::pp::Token::OP_LEFT:
|
||||
type = TOK_OP_LEFT;
|
||||
break;
|
||||
case '|':
|
||||
case '^':
|
||||
case '&':
|
||||
case '>':
|
||||
case '<':
|
||||
case '-':
|
||||
case '+':
|
||||
case '%':
|
||||
case '/':
|
||||
case '*':
|
||||
case '!':
|
||||
case '~':
|
||||
case '(':
|
||||
case ')':
|
||||
type = token->type;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
void yyerror(Context *context, const char *reason)
|
||||
{
|
||||
context->diagnostics->report(angle::pp::Diagnostics::PP_INVALID_EXPRESSION,
|
||||
context->token->location,
|
||||
reason);
|
||||
}
|
||||
|
||||
namespace angle {
|
||||
|
||||
namespace pp {
|
||||
|
||||
ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
|
||||
: mLexer(lexer),
|
||||
mDiagnostics(diagnostics)
|
||||
{
|
||||
}
|
||||
|
||||
bool ExpressionParser::parse(Token *token,
|
||||
int *result,
|
||||
bool parsePresetToken,
|
||||
const ErrorSettings &errorSettings,
|
||||
bool *valid)
|
||||
{
|
||||
Context context;
|
||||
context.diagnostics = mDiagnostics;
|
||||
context.lexer = mLexer;
|
||||
context.token = token;
|
||||
context.result = result;
|
||||
context.ignoreErrors = 0;
|
||||
context.parsePresetToken = parsePresetToken;
|
||||
context.errorSettings = errorSettings;
|
||||
context.valid = valid;
|
||||
int ret = yyparse(&context);
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
|
||||
break;
|
||||
}
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
} // namespace pp
|
||||
|
||||
} // namespace angle
|
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
//
|
||||
// Copyright (c) 2002-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.
|
||||
//
|
||||
|
||||
This file contains the Lex specification for GLSL ES preprocessor.
|
||||
Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
|
||||
http://msdn.microsoft.com/en-us/library/2scxys89.aspx
|
||||
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
|
||||
*/
|
||||
|
||||
%top{
|
||||
//
|
||||
// Copyright (c) 2011-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.
|
||||
//
|
||||
|
||||
// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
|
||||
}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4005)
|
||||
#endif
|
||||
|
||||
#include "compiler/preprocessor/Tokenizer.h"
|
||||
|
||||
#include "compiler/preprocessor/DiagnosticsBase.h"
|
||||
#include "compiler/preprocessor/Token.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Triggered by the auto-generated yy_fatal_error function.
|
||||
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(disable: 4244)
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
// Flex uses `/*FALLTHROUGH*/` instead of dedicated statements.
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
// Flex isn't semi-colon clean.
|
||||
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
|
||||
#endif
|
||||
|
||||
// Workaround for flex using the register keyword, deprecated in C++11.
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus > 199711L
|
||||
#define register
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef std::string YYSTYPE;
|
||||
typedef angle::pp::SourceLocation YYLTYPE;
|
||||
|
||||
// Use the unused yycolumn variable to track file (string) number.
|
||||
#define yyfileno yycolumn
|
||||
|
||||
#define YY_USER_INIT \
|
||||
do { \
|
||||
yyfileno = 0; \
|
||||
yylineno = 1; \
|
||||
yyextra->leadingSpace = false; \
|
||||
yyextra->lineStart = true; \
|
||||
} while(0);
|
||||
|
||||
#define YY_NO_INPUT
|
||||
#define YY_USER_ACTION \
|
||||
do \
|
||||
{ \
|
||||
angle::pp::Input* input = &yyextra->input; \
|
||||
angle::pp::Input::Location* scanLoc = &yyextra->scanLoc; \
|
||||
while ((scanLoc->sIndex < input->count()) && \
|
||||
(scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
|
||||
{ \
|
||||
scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
|
||||
++yyfileno; yylineno = 1; \
|
||||
} \
|
||||
yylloc->file = yyfileno; \
|
||||
yylloc->line = yylineno; \
|
||||
scanLoc->cIndex += yyleng; \
|
||||
} while(0);
|
||||
|
||||
#define YY_INPUT(buf, result, maxSize) \
|
||||
result = yyextra->input.read(buf, maxSize, &yylineno);
|
||||
|
||||
%}
|
||||
|
||||
%option noyywrap nounput never-interactive
|
||||
%option reentrant bison-bridge bison-locations
|
||||
%option prefix="pp"
|
||||
%option extra-type="angle::pp::Tokenizer::Context*"
|
||||
%x COMMENT
|
||||
|
||||
NEWLINE \n|\r|\r\n
|
||||
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
|
||||
PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
|
||||
|
||||
DECIMAL_CONSTANT [1-9][0-9]*[uU]?
|
||||
OCTAL_CONSTANT 0[0-7]*[uU]?
|
||||
HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
|
||||
|
||||
DIGIT [0-9]
|
||||
EXPONENT_PART [eE][+-]?{DIGIT}+
|
||||
FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
|
||||
|
||||
%%
|
||||
|
||||
/* Line comment */
|
||||
"//"[^\r\n]*
|
||||
|
||||
/* Block comment */
|
||||
/* Line breaks are just counted - not returned. */
|
||||
/* The comment is replaced by a single space. */
|
||||
"/*" { BEGIN(COMMENT); }
|
||||
<COMMENT>[^*\r\n]+
|
||||
<COMMENT>"*"
|
||||
<COMMENT>{NEWLINE} {
|
||||
if (yylineno == INT_MAX)
|
||||
{
|
||||
*yylval = "Integer overflow on line number";
|
||||
return angle::pp::Token::GOT_ERROR;
|
||||
}
|
||||
++yylineno;
|
||||
}
|
||||
<COMMENT>"*/" {
|
||||
yyextra->leadingSpace = true;
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
|
||||
# {
|
||||
// # is only valid at start of line for preprocessor directives.
|
||||
yylval->assign(1, yytext[0]);
|
||||
return yyextra->lineStart ? angle::pp::Token::PP_HASH : angle::pp::Token::PP_OTHER;
|
||||
}
|
||||
|
||||
{IDENTIFIER} {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::IDENTIFIER;
|
||||
}
|
||||
|
||||
({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::CONST_INT;
|
||||
}
|
||||
|
||||
({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::CONST_FLOAT;
|
||||
}
|
||||
|
||||
/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
|
||||
/* Rule to catch all invalid integers and floats. */
|
||||
({DIGIT}+[_a-zA-Z0-9.]*)|("."{DIGIT}+[_a-zA-Z0-9.]*) {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::PP_NUMBER;
|
||||
}
|
||||
|
||||
"++" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_INC;
|
||||
}
|
||||
"--" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_DEC;
|
||||
}
|
||||
"<<" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_LEFT;
|
||||
}
|
||||
">>" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_RIGHT;
|
||||
}
|
||||
"<=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_LE;
|
||||
}
|
||||
">=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_GE;
|
||||
}
|
||||
"==" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_EQ;
|
||||
}
|
||||
"!=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_NE;
|
||||
}
|
||||
"&&" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_AND;
|
||||
}
|
||||
"^^" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_XOR;
|
||||
}
|
||||
"||" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_OR;
|
||||
}
|
||||
"+=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_ADD_ASSIGN;
|
||||
}
|
||||
"-=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_SUB_ASSIGN;
|
||||
}
|
||||
"*=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_MUL_ASSIGN;
|
||||
}
|
||||
"/=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_DIV_ASSIGN;
|
||||
}
|
||||
"%=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_MOD_ASSIGN;
|
||||
}
|
||||
"<<=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_LEFT_ASSIGN;
|
||||
}
|
||||
">>=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_RIGHT_ASSIGN;
|
||||
}
|
||||
"&=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_AND_ASSIGN;
|
||||
}
|
||||
"^=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_XOR_ASSIGN;
|
||||
}
|
||||
"|=" {
|
||||
yylval->assign(yytext, yyleng);
|
||||
return angle::pp::Token::OP_OR_ASSIGN;
|
||||
}
|
||||
|
||||
{PUNCTUATOR} {
|
||||
yylval->assign(1, yytext[0]);
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
[ \t\v\f]+ { yyextra->leadingSpace = true; }
|
||||
|
||||
{NEWLINE} {
|
||||
if (yylineno == INT_MAX)
|
||||
{
|
||||
*yylval = "Integer overflow on line number";
|
||||
return angle::pp::Token::GOT_ERROR;
|
||||
}
|
||||
++yylineno;
|
||||
yylval->assign(1, '\n');
|
||||
return '\n';
|
||||
}
|
||||
|
||||
. {
|
||||
yylval->assign(1, yytext[0]);
|
||||
return angle::pp::Token::PP_OTHER;
|
||||
}
|
||||
|
||||
<*><<EOF>> {
|
||||
// YY_USER_ACTION is not invoked for handling EOF.
|
||||
// Set the location for EOF token manually.
|
||||
angle::pp::Input* input = &yyextra->input;
|
||||
angle::pp::Input::Location* scanLoc = &yyextra->scanLoc;
|
||||
yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
|
||||
if (scanLoc->sIndex != sIndexMax)
|
||||
{
|
||||
// We can only reach here if there are empty strings at the
|
||||
// end of the input.
|
||||
scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
|
||||
// FIXME: this is not 64-bit clean.
|
||||
yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
|
||||
}
|
||||
yylloc->file = yyfileno;
|
||||
yylloc->line = yylineno;
|
||||
yylval->clear();
|
||||
|
||||
// Line number overflows fake EOFs to exit early, check for this case.
|
||||
if (yylineno == INT_MAX) {
|
||||
yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR,
|
||||
angle::pp::SourceLocation(yyfileno, yylineno),
|
||||
"Integer overflow on line number");
|
||||
}
|
||||
else if (YY_START == COMMENT)
|
||||
{
|
||||
yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT,
|
||||
angle::pp::SourceLocation(yyfileno, yylineno),
|
||||
"EOF while in a comment");
|
||||
}
|
||||
yyterminate();
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
namespace angle {
|
||||
|
||||
namespace pp {
|
||||
|
||||
Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
|
||||
{
|
||||
mContext.diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
Tokenizer::~Tokenizer()
|
||||
{
|
||||
destroyScanner();
|
||||
}
|
||||
|
||||
bool Tokenizer::init(size_t count, const char * const string[], const int length[])
|
||||
{
|
||||
if ((count > 0) && (string == 0))
|
||||
return false;
|
||||
|
||||
mContext.input = Input(count, string, length);
|
||||
return initScanner();
|
||||
}
|
||||
|
||||
void Tokenizer::setFileNumber(int file)
|
||||
{
|
||||
// We use column number as file number.
|
||||
// See macro yyfileno.
|
||||
yyset_column(file, mHandle);
|
||||
}
|
||||
|
||||
void Tokenizer::setLineNumber(int line)
|
||||
{
|
||||
yyset_lineno(line, mHandle);
|
||||
}
|
||||
|
||||
void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
|
||||
{
|
||||
mMaxTokenSize = maxTokenSize;
|
||||
}
|
||||
|
||||
void Tokenizer::lex(Token *token)
|
||||
{
|
||||
int tokenType = yylex(&token->text, &token->location, mHandle);
|
||||
|
||||
if (tokenType == Token::GOT_ERROR)
|
||||
{
|
||||
mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
|
||||
token->type = Token::LAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
token->type = tokenType;
|
||||
}
|
||||
|
||||
if (token->text.size() > mMaxTokenSize)
|
||||
{
|
||||
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
|
||||
token->location, token->text);
|
||||
token->text.erase(mMaxTokenSize);
|
||||
}
|
||||
|
||||
token->flags = 0;
|
||||
|
||||
token->setAtStartOfLine(mContext.lineStart);
|
||||
mContext.lineStart = token->type == '\n';
|
||||
|
||||
token->setHasLeadingSpace(mContext.leadingSpace);
|
||||
mContext.leadingSpace = false;
|
||||
}
|
||||
|
||||
bool Tokenizer::initScanner()
|
||||
{
|
||||
if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
|
||||
return false;
|
||||
|
||||
yyrestart(0, mHandle);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Tokenizer::destroyScanner()
|
||||
{
|
||||
if (mHandle == nullptr)
|
||||
return;
|
||||
|
||||
yylex_destroy(mHandle);
|
||||
mHandle = nullptr;
|
||||
}
|
||||
|
||||
} // namespace pp
|
||||
|
||||
} // namespace angle
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "compiler/translator/AtomicCounterFunctionHLSL.h"
|
||||
|
||||
#include "compiler/translator/Common.h"
|
||||
#include "compiler/translator/ImmutableStringBuilder.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
@ -25,10 +24,6 @@ constexpr ImmutableString kAtomicCounterDecrement("atomicCounterDecrement");
|
|||
constexpr ImmutableString kAtomicCounterBaseName("_acbase_");
|
||||
} // namespace
|
||||
|
||||
AtomicCounterFunctionHLSL::AtomicCounterFunctionHLSL(bool forceResolution)
|
||||
: mForceResolution(forceResolution)
|
||||
{}
|
||||
|
||||
ImmutableString AtomicCounterFunctionHLSL::useAtomicCounterFunction(const ImmutableString &name)
|
||||
{
|
||||
// The largest string that will be create created is "_acbase_increment" or "_acbase_decrement"
|
||||
|
@ -70,41 +65,34 @@ void AtomicCounterFunctionHLSL::atomicCounterFunctionHeader(TInfoSinkBase &out)
|
|||
{
|
||||
out << "uint " << atomicFunction.first
|
||||
<< "(in RWByteAddressBuffer counter, int address)\n"
|
||||
"{\n"
|
||||
" uint ret;\n";
|
||||
|
||||
"{\n";
|
||||
switch (atomicFunction.second)
|
||||
{
|
||||
case AtomicCounterFunction::INCREMENT:
|
||||
out << " counter.InterlockedAdd(address, 1u, ret);\n";
|
||||
break;
|
||||
case AtomicCounterFunction::DECREMENT:
|
||||
out << " counter.InterlockedAdd(address, 0u - 1u, ret);\n"
|
||||
" ret -= 1u;\n"; // atomicCounterDecrement is a post-decrement op
|
||||
out << " uint ret;\n"
|
||||
" counter.InterlockedAdd(address, ";
|
||||
if (atomicFunction.second == AtomicCounterFunction::DECREMENT)
|
||||
{
|
||||
out << "0u - ";
|
||||
}
|
||||
out << "1u, ret);\n"
|
||||
<< " return ret;\n";
|
||||
break;
|
||||
case AtomicCounterFunction::LOAD:
|
||||
out << " ret = counter.Load(address);\n";
|
||||
out << " return counter.Load(address);\n";
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
if (mForceResolution && atomicFunction.second != AtomicCounterFunction::LOAD)
|
||||
{
|
||||
out << " if (ret == 0) {\n"
|
||||
" ret = 0 - ret;\n"
|
||||
" }\n";
|
||||
}
|
||||
|
||||
out << " return ret;\n"
|
||||
"}\n\n";
|
||||
out << "}\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
ImmutableString getAtomicCounterNameForBinding(int binding)
|
||||
{
|
||||
std::stringstream counterName = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream counterName;
|
||||
counterName << kAtomicCounterBaseName << binding;
|
||||
return ImmutableString(counterName.str());
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ struct TLayoutQualifier;
|
|||
class AtomicCounterFunctionHLSL final : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
AtomicCounterFunctionHLSL(bool forceResolution);
|
||||
|
||||
ImmutableString useAtomicCounterFunction(const ImmutableString &name);
|
||||
|
||||
void atomicCounterFunctionHeader(TInfoSinkBase &out);
|
||||
|
@ -40,7 +38,6 @@ class AtomicCounterFunctionHLSL final : angle::NonCopyable
|
|||
};
|
||||
|
||||
std::map<ImmutableString, AtomicCounterFunction> mAtomicCounterFunctions;
|
||||
bool mForceResolution;
|
||||
};
|
||||
|
||||
ImmutableString getAtomicCounterNameForBinding(int binding);
|
||||
|
|
|
@ -622,9 +622,6 @@ enum TQualifier
|
|||
|
||||
EvqDrawID, // ANGLE_multi_draw
|
||||
|
||||
EvqBaseVertex, // ANGLE_base_vertex_base_instance
|
||||
EvqBaseInstance, // ANGLE_base_vertex_base_instance
|
||||
|
||||
// built-ins read by fragment shader
|
||||
EvqFragCoord,
|
||||
EvqFrontFacing,
|
||||
|
@ -693,11 +690,6 @@ inline bool IsQualifierUnspecified(TQualifier qualifier)
|
|||
return (qualifier == EvqTemporary || qualifier == EvqGlobal);
|
||||
}
|
||||
|
||||
inline bool IsStorageBuffer(TQualifier qualifier)
|
||||
{
|
||||
return qualifier == EvqBuffer;
|
||||
}
|
||||
|
||||
enum TLayoutImageInternalFormat
|
||||
{
|
||||
EiifUnspecified,
|
||||
|
@ -915,8 +907,6 @@ inline const char *getQualifierString(TQualifier q)
|
|||
case EvqPosition: return "Position";
|
||||
case EvqPointSize: return "PointSize";
|
||||
case EvqDrawID: return "DrawID";
|
||||
case EvqBaseVertex: return "BaseVertex";
|
||||
case EvqBaseInstance: return "BaseInstance";
|
||||
case EvqFragCoord: return "FragCoord";
|
||||
case EvqFrontFacing: return "FrontFacing";
|
||||
case EvqPointCoord: return "PointCoord";
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
|
||||
#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include "compiler/translator/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/translator/VersionGLSL.h"
|
||||
|
@ -88,7 +87,7 @@ void InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *
|
|||
};
|
||||
for (int dim = 2; dim <= 4; ++dim)
|
||||
{
|
||||
std::stringstream ss = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream ss;
|
||||
ss << "emu_precision vec" << dim << " atan_emu(emu_precision vec" << dim
|
||||
<< " y, emu_precision vec" << dim << " x)\n"
|
||||
<< "{\n"
|
||||
|
|
|
@ -171,7 +171,7 @@ class CallDAG::CallDAGCreator : public TIntermTraverser
|
|||
|
||||
InitResult result = INITDAG_SUCCESS;
|
||||
|
||||
std::stringstream errorStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream errorStream;
|
||||
|
||||
while (!functionsToProcess.empty())
|
||||
{
|
||||
|
|
|
@ -175,8 +175,6 @@ class CollectVariablesTraverser : public TIntermTraverser
|
|||
bool mVertexIDAdded;
|
||||
bool mPointSizeAdded;
|
||||
bool mDrawIDAdded;
|
||||
bool mBaseVertexAdded;
|
||||
bool mBaseInstanceAdded;
|
||||
|
||||
// Vertex Shader and Geometry Shader builtins
|
||||
bool mPositionAdded;
|
||||
|
@ -235,8 +233,6 @@ CollectVariablesTraverser::CollectVariablesTraverser(
|
|||
mVertexIDAdded(false),
|
||||
mPointSizeAdded(false),
|
||||
mDrawIDAdded(false),
|
||||
mBaseVertexAdded(false),
|
||||
mBaseInstanceAdded(false),
|
||||
mPositionAdded(false),
|
||||
mPointCoordAdded(false),
|
||||
mFrontFacingAdded(false),
|
||||
|
@ -493,12 +489,6 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
|
|||
case EvqDrawID:
|
||||
recordBuiltInAttributeUsed(symbol->variable(), &mDrawIDAdded);
|
||||
return;
|
||||
case EvqBaseVertex:
|
||||
recordBuiltInAttributeUsed(symbol->variable(), &mBaseVertexAdded);
|
||||
return;
|
||||
case EvqBaseInstance:
|
||||
recordBuiltInAttributeUsed(symbol->variable(), &mBaseInstanceAdded);
|
||||
return;
|
||||
case EvqLastFragData:
|
||||
recordBuiltInVaryingUsed(symbol->variable(), &mLastFragDataAdded, mInputVaryings);
|
||||
return;
|
||||
|
@ -564,8 +554,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
|
|||
else
|
||||
{
|
||||
ASSERT(mShaderType == GL_VERTEX_SHADER &&
|
||||
(IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview2) ||
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview)));
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview2));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -125,15 +125,6 @@ inline const char *AllocatePoolCharArray(const char *str, size_t strLength)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
// Initialize a new stream which must be imbued with the classic locale
|
||||
template <typename T>
|
||||
T InitializeStream()
|
||||
{
|
||||
T stream;
|
||||
stream.imbue(std::locale::classic());
|
||||
return stream;
|
||||
}
|
||||
|
||||
} // namespace sh
|
||||
|
||||
namespace std
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "compiler/translator/tree_ops/ClampPointSize.h"
|
||||
#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h"
|
||||
#include "compiler/translator/tree_ops/DeferGlobalInitializers.h"
|
||||
#include "compiler/translator/tree_ops/EmulateGLDrawID.h"
|
||||
#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h"
|
||||
#include "compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h"
|
||||
#include "compiler/translator/tree_ops/EmulatePrecision.h"
|
||||
#include "compiler/translator/tree_ops/FoldExpressions.h"
|
||||
#include "compiler/translator/tree_ops/InitializeVariables.h"
|
||||
|
@ -49,7 +49,6 @@
|
|||
#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
|
||||
#include "compiler/translator/tree_util/BuiltIn_autogen.h"
|
||||
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
|
||||
#include "compiler/translator/tree_util/ReplaceShadowingVariables.h"
|
||||
#include "compiler/translator/util.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
|
@ -69,7 +68,7 @@ void DumpFuzzerCase(char const *const *shaderStrings,
|
|||
{
|
||||
static int fileIndex = 0;
|
||||
|
||||
std::ostringstream o = sh::InitializeStream<std::ostringstream>();
|
||||
std::ostringstream o;
|
||||
o << "corpus/" << fileIndex++ << ".sample";
|
||||
std::string s = o.str();
|
||||
|
||||
|
@ -121,7 +120,8 @@ bool RemoveInvariant(sh::GLenum shaderType,
|
|||
ShShaderOutput outputType,
|
||||
ShCompileOptions compileOptions)
|
||||
{
|
||||
if (shaderType == GL_FRAGMENT_SHADER && IsGLSL420OrNewer(outputType))
|
||||
if ((compileOptions & SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT) == 0 &&
|
||||
shaderType == GL_FRAGMENT_SHADER && IsGLSL420OrNewer(outputType))
|
||||
return true;
|
||||
|
||||
if ((compileOptions & SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3) != 0 &&
|
||||
|
@ -216,8 +216,6 @@ int MapSpecToShaderVersion(ShShaderSpec spec)
|
|||
case SH_GLES3_1_SPEC:
|
||||
case SH_WEBGL3_SPEC:
|
||||
return 310;
|
||||
case SH_GL3_3_SPEC:
|
||||
return 330;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
|
@ -358,17 +356,6 @@ TIntermBlock *TCompiler::compileTreeImpl(const char *const shaderStrings[],
|
|||
}
|
||||
}
|
||||
|
||||
const bool glBaseVertexBaseInstanceSupported =
|
||||
(compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u;
|
||||
if (!glBaseVertexBaseInstanceSupported)
|
||||
{
|
||||
auto it = mExtensionBehavior.find(TExtension::ANGLE_base_vertex_base_instance);
|
||||
if (it != mExtensionBehavior.end())
|
||||
{
|
||||
mExtensionBehavior.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
// First string is path of source file if flag is set. The actual source follows.
|
||||
size_t firstSource = 0;
|
||||
if (compileOptions & SH_SOURCE_PATH)
|
||||
|
@ -378,8 +365,7 @@ TIntermBlock *TCompiler::compileTreeImpl(const char *const shaderStrings[],
|
|||
}
|
||||
|
||||
TParseContext parseContext(mSymbolTable, mExtensionBehavior, mShaderType, mShaderSpec,
|
||||
compileOptions, !IsDesktopGLSpec(mShaderSpec), &mDiagnostics,
|
||||
getResources());
|
||||
compileOptions, true, &mDiagnostics, getResources());
|
||||
|
||||
parseContext.setFragmentPrecisionHighOnESSL1(mResources.FragmentPrecisionHigh == 1);
|
||||
|
||||
|
@ -552,10 +538,6 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (IsSpecWithFunctionBodyNewScope(mShaderSpec, mShaderVersion))
|
||||
{
|
||||
ReplaceShadowingVariables(root, &mSymbolTable);
|
||||
}
|
||||
|
||||
if (mShaderVersion >= 310 && !ValidateVaryingLocations(root, &mDiagnostics, mShaderType))
|
||||
{
|
||||
|
@ -583,8 +565,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
|||
}
|
||||
|
||||
if ((compileOptions & SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW) &&
|
||||
(parseContext.isExtensionEnabled(TExtension::OVR_multiview2) ||
|
||||
parseContext.isExtensionEnabled(TExtension::OVR_multiview)) &&
|
||||
parseContext.isExtensionEnabled(TExtension::OVR_multiview2) &&
|
||||
getShaderType() != GL_COMPUTE_SHADER)
|
||||
{
|
||||
DeclareAndInitBuiltinsForInstancedMultiview(root, mNumViews, mShaderType, compileOptions,
|
||||
|
@ -645,7 +626,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
|||
if (mShaderType == GL_VERTEX_SHADER &&
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_multi_draw))
|
||||
{
|
||||
if ((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0u)
|
||||
if ((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0)
|
||||
{
|
||||
EmulateGLDrawID(root, &mSymbolTable, &mUniforms,
|
||||
shouldCollectVariables(compileOptions));
|
||||
|
@ -656,22 +637,6 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
|||
}
|
||||
}
|
||||
|
||||
if (mShaderType == GL_VERTEX_SHADER &&
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_base_vertex_base_instance))
|
||||
{
|
||||
if ((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u)
|
||||
{
|
||||
EmulateGLBaseVertex(root, &mSymbolTable, &mUniforms,
|
||||
shouldCollectVariables(compileOptions));
|
||||
EmulateGLBaseInstance(root, &mSymbolTable, &mUniforms,
|
||||
shouldCollectVariables(compileOptions));
|
||||
if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mShaderType == GL_FRAGMENT_SHADER && mShaderVersion == 100 && mResources.EXT_draw_buffers &&
|
||||
mResources.MaxDrawBuffers > 1 &&
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers))
|
||||
|
@ -934,35 +899,17 @@ bool TCompiler::compile(const char *const shaderStrings[],
|
|||
translate(root, compileOptions, &perfDiagnostics);
|
||||
}
|
||||
|
||||
if (mShaderType == GL_VERTEX_SHADER)
|
||||
if (mShaderType == GL_VERTEX_SHADER &&
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_multi_draw))
|
||||
{
|
||||
bool lookForDrawID =
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_multi_draw) &&
|
||||
((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0u);
|
||||
bool lookForBaseVertexBaseInstance =
|
||||
IsExtensionEnabled(mExtensionBehavior,
|
||||
TExtension::ANGLE_base_vertex_base_instance) &&
|
||||
((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u);
|
||||
|
||||
if (lookForDrawID || lookForBaseVertexBaseInstance)
|
||||
if ((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0)
|
||||
{
|
||||
for (auto &uniform : mUniforms)
|
||||
{
|
||||
if (lookForDrawID && uniform.name == "angle_DrawID" &&
|
||||
uniform.mappedName == "angle_DrawID")
|
||||
if (uniform.name == "angle_DrawID" && uniform.mappedName == "angle_DrawID")
|
||||
{
|
||||
uniform.name = "gl_DrawID";
|
||||
}
|
||||
else if (lookForBaseVertexBaseInstance && uniform.name == "angle_BaseVertex" &&
|
||||
uniform.mappedName == "angle_BaseVertex")
|
||||
{
|
||||
uniform.name = "gl_BaseVertex";
|
||||
}
|
||||
else if (lookForBaseVertexBaseInstance &&
|
||||
uniform.name == "angle_BaseInstance" &&
|
||||
uniform.mappedName == "angle_BaseInstance")
|
||||
{
|
||||
uniform.name = "gl_BaseInstance";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -993,7 +940,7 @@ bool TCompiler::initBuiltInSymbolTable(const ShBuiltInResources &resources)
|
|||
|
||||
void TCompiler::setResourceString()
|
||||
{
|
||||
std::ostringstream strstream = sh::InitializeStream<std::ostringstream>();
|
||||
std::ostringstream strstream;
|
||||
|
||||
// clang-format off
|
||||
strstream << ":MaxVertexAttribs:" << mResources.MaxVertexAttribs
|
||||
|
@ -1021,10 +968,8 @@ void TCompiler::setResourceString()
|
|||
<< ":NV_shader_framebuffer_fetch:" << mResources.NV_shader_framebuffer_fetch
|
||||
<< ":ARM_shader_framebuffer_fetch:" << mResources.ARM_shader_framebuffer_fetch
|
||||
<< ":OVR_multiview2:" << mResources.OVR_multiview2
|
||||
<< ":OVR_multiview:" << mResources.OVR_multiview
|
||||
<< ":EXT_YUV_target:" << mResources.EXT_YUV_target
|
||||
<< ":EXT_geometry_shader:" << mResources.EXT_geometry_shader
|
||||
<< ":OES_texture_3D:" << mResources.OES_texture_3D
|
||||
<< ":MaxVertexOutputVectors:" << mResources.MaxVertexOutputVectors
|
||||
<< ":MaxFragmentInputVectors:" << mResources.MaxFragmentInputVectors
|
||||
<< ":MinProgramTexelOffset:" << mResources.MinProgramTexelOffset
|
||||
|
@ -1034,7 +979,6 @@ void TCompiler::setResourceString()
|
|||
<< ":NV_draw_buffers:" << mResources.NV_draw_buffers
|
||||
<< ":WEBGL_debug_shader_precision:" << mResources.WEBGL_debug_shader_precision
|
||||
<< ":ANGLE_multi_draw:" << mResources.ANGLE_multi_draw
|
||||
<< ":ANGLE_base_vertex_base_instance:" << mResources.ANGLE_base_vertex_base_instance
|
||||
<< ":MinProgramTextureGatherOffset:" << mResources.MinProgramTextureGatherOffset
|
||||
<< ":MaxProgramTextureGatherOffset:" << mResources.MaxProgramTextureGatherOffset
|
||||
<< ":MaxImageUnits:" << mResources.MaxImageUnits
|
||||
|
@ -1163,7 +1107,7 @@ bool TCompiler::checkCallDepth()
|
|||
if (depth >= mResources.MaxCallStackDepth)
|
||||
{
|
||||
// Trace back the function chain to have a meaningful info log.
|
||||
std::stringstream errorStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream errorStream;
|
||||
errorStream << "Call stack too deep (larger than " << mResources.MaxCallStackDepth
|
||||
<< ") with the following call chain: "
|
||||
<< record.node->getFunction()->name();
|
||||
|
@ -1429,16 +1373,6 @@ bool TCompiler::isVaryingDefined(const char *varyingName)
|
|||
return false;
|
||||
}
|
||||
|
||||
void EmitWorkGroupSizeGLSL(const TCompiler &compiler, TInfoSinkBase &sink)
|
||||
{
|
||||
if (compiler.isComputeShaderLocalSizeDeclared())
|
||||
{
|
||||
const sh::WorkGroupSize &localSize = compiler.getComputeShaderLocalSize();
|
||||
sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
|
||||
<< ", local_size_z=" << localSize[2] << ") in;\n";
|
||||
}
|
||||
}
|
||||
|
||||
void EmitMultiviewGLSL(const TCompiler &compiler,
|
||||
const ShCompileOptions &compileOptions,
|
||||
const TBehavior behavior,
|
||||
|
|
|
@ -296,7 +296,6 @@ class TCompiler : public TShHandleBase
|
|||
TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
|
||||
void DeleteCompiler(TCompiler *);
|
||||
|
||||
void EmitWorkGroupSizeGLSL(const TCompiler &, TInfoSinkBase &sink);
|
||||
void EmitMultiviewGLSL(const TCompiler &, const ShCompileOptions &, TBehavior, TInfoSinkBase &sink);
|
||||
|
||||
} // namespace sh
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "common/mathutil.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
#include "compiler/translator/util.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -87,16 +86,8 @@ unsigned int TConstantUnion::getUConst() const
|
|||
|
||||
float TConstantUnion::getFConst() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtInt:
|
||||
return static_cast<float>(iConst);
|
||||
case EbtUInt:
|
||||
return static_cast<float>(uConst);
|
||||
default:
|
||||
ASSERT(type == EbtFloat);
|
||||
return fConst;
|
||||
}
|
||||
ASSERT(type == EbtFloat);
|
||||
return fConst;
|
||||
}
|
||||
|
||||
bool TConstantUnion::getBConst() const
|
||||
|
@ -228,37 +219,17 @@ bool TConstantUnion::cast(TBasicType newType, const TConstantUnion &constant)
|
|||
|
||||
bool TConstantUnion::operator==(const int i) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtFloat:
|
||||
return static_cast<float>(i) == fConst;
|
||||
default:
|
||||
return i == iConst;
|
||||
}
|
||||
return i == iConst;
|
||||
}
|
||||
|
||||
bool TConstantUnion::operator==(const unsigned int u) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtFloat:
|
||||
return static_cast<float>(u) == fConst;
|
||||
default:
|
||||
return u == uConst;
|
||||
}
|
||||
return u == uConst;
|
||||
}
|
||||
|
||||
bool TConstantUnion::operator==(const float f) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtInt:
|
||||
return f == static_cast<float>(iConst);
|
||||
case EbtUInt:
|
||||
return f == static_cast<float>(uConst);
|
||||
default:
|
||||
return f == fConst;
|
||||
}
|
||||
return f == fConst;
|
||||
}
|
||||
|
||||
bool TConstantUnion::operator==(const bool b) const
|
||||
|
@ -273,32 +244,23 @@ bool TConstantUnion::operator==(const TYuvCscStandardEXT s) const
|
|||
|
||||
bool TConstantUnion::operator==(const TConstantUnion &constant) const
|
||||
{
|
||||
ImplicitTypeConversion conversion = GetConversion(constant.type, type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtInt:
|
||||
return constant.iConst == iConst;
|
||||
case EbtUInt:
|
||||
return constant.uConst == uConst;
|
||||
case EbtFloat:
|
||||
return constant.fConst == fConst;
|
||||
case EbtBool:
|
||||
return constant.bConst == bConst;
|
||||
case EbtYuvCscStandardEXT:
|
||||
return constant.yuvCscStandardEXTConst == yuvCscStandardEXTConst;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (conversion == ImplicitTypeConversion::Invalid)
|
||||
{
|
||||
if (constant.type != type)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
switch (type)
|
||||
{
|
||||
return constant.getFConst() == getFConst();
|
||||
case EbtInt:
|
||||
return constant.iConst == iConst;
|
||||
case EbtUInt:
|
||||
return constant.uConst == uConst;
|
||||
case EbtFloat:
|
||||
return constant.fConst == fConst;
|
||||
case EbtBool:
|
||||
return constant.bConst == bConst;
|
||||
case EbtYuvCscStandardEXT:
|
||||
return constant.yuvCscStandardEXTConst == yuvCscStandardEXTConst;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,50 +296,33 @@ bool TConstantUnion::operator!=(const TConstantUnion &constant) const
|
|||
|
||||
bool TConstantUnion::operator>(const TConstantUnion &constant) const
|
||||
{
|
||||
|
||||
ImplicitTypeConversion conversion = GetConversion(constant.type, type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
ASSERT(type == constant.type);
|
||||
switch (type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtInt:
|
||||
return iConst > constant.iConst;
|
||||
case EbtUInt:
|
||||
return uConst > constant.uConst;
|
||||
case EbtFloat:
|
||||
return fConst > constant.fConst;
|
||||
default:
|
||||
return false; // Invalid operation, handled at semantic analysis
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
return getFConst() > constant.getFConst();
|
||||
case EbtInt:
|
||||
return iConst > constant.iConst;
|
||||
case EbtUInt:
|
||||
return uConst > constant.uConst;
|
||||
case EbtFloat:
|
||||
return fConst > constant.fConst;
|
||||
default:
|
||||
return false; // Invalid operation, handled at semantic analysis
|
||||
}
|
||||
}
|
||||
|
||||
bool TConstantUnion::operator<(const TConstantUnion &constant) const
|
||||
{
|
||||
ImplicitTypeConversion conversion = GetConversion(constant.type, type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
ASSERT(type == constant.type);
|
||||
switch (type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EbtInt:
|
||||
return iConst < constant.iConst;
|
||||
case EbtUInt:
|
||||
return uConst < constant.uConst;
|
||||
case EbtFloat:
|
||||
return fConst < constant.fConst;
|
||||
default:
|
||||
return false; // Invalid operation, handled at semantic analysis
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
return getFConst() < constant.getFConst();
|
||||
case EbtInt:
|
||||
return iConst < constant.iConst;
|
||||
case EbtUInt:
|
||||
return uConst < constant.uConst;
|
||||
case EbtFloat:
|
||||
return fConst < constant.fConst;
|
||||
default:
|
||||
return false; // Invalid operation, handled at semantic analysis
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,29 +333,20 @@ TConstantUnion TConstantUnion::add(const TConstantUnion &lhs,
|
|||
const TSourceLoc &line)
|
||||
{
|
||||
TConstantUnion returnValue;
|
||||
|
||||
ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
ASSERT(lhs.type == rhs.type);
|
||||
switch (lhs.type)
|
||||
{
|
||||
switch (lhs.type)
|
||||
{
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingSum<int>(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
returnValue.setUConst(gl::WrappingSum<unsigned int>(lhs.uConst, rhs.uConst));
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedSum(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
returnValue.setFConst(CheckedSum(lhs.getFConst(), rhs.getFConst(), diag, line));
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingSum<int>(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
returnValue.setUConst(gl::WrappingSum<unsigned int>(lhs.uConst, rhs.uConst));
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedSum(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
@ -423,29 +359,20 @@ TConstantUnion TConstantUnion::sub(const TConstantUnion &lhs,
|
|||
const TSourceLoc &line)
|
||||
{
|
||||
TConstantUnion returnValue;
|
||||
|
||||
ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
ASSERT(lhs.type == rhs.type);
|
||||
switch (lhs.type)
|
||||
{
|
||||
switch (lhs.type)
|
||||
{
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingDiff<int>(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
returnValue.setUConst(gl::WrappingDiff<unsigned int>(lhs.uConst, rhs.uConst));
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedDiff(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
returnValue.setFConst(CheckedDiff(lhs.getFConst(), rhs.getFConst(), diag, line));
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingDiff<int>(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
returnValue.setUConst(gl::WrappingDiff<unsigned int>(lhs.uConst, rhs.uConst));
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedDiff(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
@ -458,31 +385,22 @@ TConstantUnion TConstantUnion::mul(const TConstantUnion &lhs,
|
|||
const TSourceLoc &line)
|
||||
{
|
||||
TConstantUnion returnValue;
|
||||
|
||||
ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
ASSERT(lhs.type == rhs.type);
|
||||
switch (lhs.type)
|
||||
{
|
||||
switch (lhs.type)
|
||||
{
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingMul(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
// Unsigned integer math in C++ is defined to be done in modulo 2^n, so we rely
|
||||
// on that to implement wrapping multiplication.
|
||||
returnValue.setUConst(lhs.uConst * rhs.uConst);
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedMul(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
returnValue.setFConst(CheckedMul(lhs.getFConst(), rhs.getFConst(), diag, line));
|
||||
case EbtInt:
|
||||
returnValue.setIConst(gl::WrappingMul(lhs.iConst, rhs.iConst));
|
||||
break;
|
||||
case EbtUInt:
|
||||
// Unsigned integer math in C++ is defined to be done in modulo 2^n, so we rely on that
|
||||
// to implement wrapping multiplication.
|
||||
returnValue.setUConst(lhs.uConst * rhs.uConst);
|
||||
break;
|
||||
case EbtFloat:
|
||||
returnValue.setFConst(CheckedMul(lhs.fConst, rhs.fConst, diag, line));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "angle_gl.h"
|
||||
#include "common/debug.h"
|
||||
#include "compiler/translator/Common.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
|
||||
namespace sh
|
||||
|
@ -183,21 +182,18 @@ void TDirectiveHandler::handleExtension(const angle::pp::SourceLocation &loc,
|
|||
}
|
||||
}
|
||||
|
||||
void TDirectiveHandler::handleVersion(const angle::pp::SourceLocation &loc,
|
||||
int version,
|
||||
ShShaderSpec spec)
|
||||
void TDirectiveHandler::handleVersion(const angle::pp::SourceLocation &loc, int version)
|
||||
{
|
||||
if (((version == 100 || version == 300 || version == 310) && !IsDesktopGLSpec(spec)) ||
|
||||
(version == 330 && IsDesktopGLSpec(spec)))
|
||||
if (version == 100 || version == 300 || version == 310)
|
||||
{
|
||||
mShaderVersion = version;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::stringstream stream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream stream;
|
||||
stream << version;
|
||||
std::string str = stream.str();
|
||||
mDiagnostics.error(loc, "client/version number not supported", str.c_str());
|
||||
mDiagnostics.error(loc, "version number not supported", str.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@ class TDirectiveHandler : public angle::pp::DirectiveHandler, angle::NonCopyable
|
|||
const std::string &name,
|
||||
const std::string &behavior) override;
|
||||
|
||||
void handleVersion(const angle::pp::SourceLocation &loc,
|
||||
int version,
|
||||
ShShaderSpec spec) override;
|
||||
void handleVersion(const angle::pp::SourceLocation &loc, int version) override;
|
||||
|
||||
private:
|
||||
TPragma mPragma;
|
||||
|
|
|
@ -29,11 +29,8 @@
|
|||
OP(OES_EGL_image_external_essl3) \
|
||||
OP(OES_standard_derivatives) \
|
||||
OP(OES_texture_storage_multisample_2d_array) \
|
||||
OP(OES_texture_3D) \
|
||||
OP(OVR_multiview) \
|
||||
OP(OVR_multiview2) \
|
||||
OP(ANGLE_multi_draw) \
|
||||
OP(ANGLE_base_vertex_base_instance)
|
||||
OP(ANGLE_multi_draw)
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
|
|
@ -34,11 +34,8 @@ enum class TExtension
|
|||
OES_EGL_image_external_essl3,
|
||||
OES_standard_derivatives,
|
||||
OES_texture_storage_multisample_2d_array,
|
||||
OES_texture_3D,
|
||||
OVR_multiview,
|
||||
OVR_multiview2,
|
||||
ANGLE_multi_draw,
|
||||
ANGLE_base_vertex_base_instance
|
||||
};
|
||||
|
||||
enum TBehavior
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
//
|
||||
|
||||
#include "compiler/translator/FunctionLookup.h"
|
||||
#include "compiler/translator/ImmutableStringBuilder.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -20,27 +19,6 @@ const char kFunctionMangledNameSeparator = '(';
|
|||
|
||||
constexpr const ImmutableString kEmptyName("");
|
||||
|
||||
// Helper function for GetMangledNames
|
||||
// Gets all ordered combinations of elements in list[currentIndex, end]
|
||||
std::vector<std::vector<int>> GetImplicitConversionCombinations(const std::vector<int> &list)
|
||||
{
|
||||
std::vector<std::vector<int>> target;
|
||||
target.push_back(std::vector<int>());
|
||||
|
||||
for (size_t currentIndex = 0; currentIndex < list.size(); currentIndex++)
|
||||
{
|
||||
size_t prevIterSize = target.size();
|
||||
for (size_t copyIndex = 0; copyIndex < prevIterSize; copyIndex++)
|
||||
{
|
||||
std::vector<int> combination = target[copyIndex];
|
||||
combination.push_back(list[currentIndex]);
|
||||
target.push_back(combination);
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
TFunctionLookup::TFunctionLookup(const ImmutableString &name,
|
||||
|
@ -87,60 +65,6 @@ ImmutableString TFunctionLookup::GetMangledName(const char *functionName,
|
|||
return ImmutableString(newName);
|
||||
}
|
||||
|
||||
std::vector<ImmutableString> GetMangledNames(const char *functionName,
|
||||
const TIntermSequence &arguments)
|
||||
{
|
||||
std::vector<ImmutableString> target;
|
||||
|
||||
std::vector<int> indexes;
|
||||
for (int i = 0; i < static_cast<int>(arguments.size()); i++)
|
||||
{
|
||||
TIntermNode *argument = arguments[i];
|
||||
TBasicType argType = argument->getAsTyped()->getType().getBasicType();
|
||||
if (argType == EbtInt || argType == EbtUInt)
|
||||
{
|
||||
indexes.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::vector<int>> combinations = GetImplicitConversionCombinations(indexes);
|
||||
for (const std::vector<int> &combination : combinations)
|
||||
{
|
||||
// combination: ordered list of indexes for arguments that should be converted to float
|
||||
std::string newName(functionName);
|
||||
newName += kFunctionMangledNameSeparator;
|
||||
// combination[currentIndex] represents index of next argument to be converted
|
||||
int currentIndex = 0;
|
||||
for (int i = 0; i < (int)arguments.size(); i++)
|
||||
{
|
||||
TIntermNode *argument = arguments[i];
|
||||
|
||||
if (currentIndex != static_cast<int>(combination.size()) &&
|
||||
combination[currentIndex] == i)
|
||||
{
|
||||
// Convert
|
||||
TType type = argument->getAsTyped()->getType();
|
||||
type.setBasicType(EbtFloat);
|
||||
newName += type.getMangledName();
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't convert
|
||||
newName += argument->getAsTyped()->getType().getMangledName();
|
||||
}
|
||||
}
|
||||
target.push_back(ImmutableString(newName));
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
std::vector<ImmutableString> TFunctionLookup::getMangledNamesForImplicitConversions() const
|
||||
{
|
||||
return GetMangledNames(mName.data(), mArguments);
|
||||
}
|
||||
|
||||
bool TFunctionLookup::isConstructor() const
|
||||
{
|
||||
return mConstructorType != nullptr;
|
||||
|
|
|
@ -28,7 +28,6 @@ class TFunctionLookup : angle::NonCopyable
|
|||
ImmutableString getMangledName() const;
|
||||
static ImmutableString GetMangledName(const char *functionName,
|
||||
const TIntermSequence &arguments);
|
||||
std::vector<ImmutableString> getMangledNamesForImplicitConversions() const;
|
||||
|
||||
bool isConstructor() const;
|
||||
const TType &constructorType() const;
|
||||
|
|
|
@ -69,7 +69,7 @@ TInfoSinkBase &TInfoSinkBase::operator<<(const TType &type)
|
|||
|
||||
void TInfoSinkBase::location(int file, int line)
|
||||
{
|
||||
TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
|
||||
TPersistStringStream stream;
|
||||
if (line)
|
||||
stream << file << ":" << line;
|
||||
else
|
||||
|
|
|
@ -41,7 +41,7 @@ class TInfoSinkBase
|
|||
template <typename T>
|
||||
TInfoSinkBase &operator<<(const T &t)
|
||||
{
|
||||
TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
|
||||
TPersistStringStream stream;
|
||||
stream << t;
|
||||
sink.append(stream.str());
|
||||
return *this;
|
||||
|
@ -79,7 +79,7 @@ class TInfoSinkBase
|
|||
// does not have a fractional part, the default precision format does
|
||||
// not write the decimal portion which gets interpreted as integer by
|
||||
// the compiler.
|
||||
TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
|
||||
TPersistStringStream stream;
|
||||
if (fractionalPart(f) == 0.0f)
|
||||
{
|
||||
stream.precision(1);
|
||||
|
|
|
@ -61,10 +61,6 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
|
|||
{
|
||||
extBehavior[TExtension::ARM_shader_framebuffer_fetch] = EBhUndefined;
|
||||
}
|
||||
if (resources.OVR_multiview)
|
||||
{
|
||||
extBehavior[TExtension::OVR_multiview] = EBhUndefined;
|
||||
}
|
||||
if (resources.OVR_multiview2)
|
||||
{
|
||||
extBehavior[TExtension::OVR_multiview2] = EBhUndefined;
|
||||
|
@ -81,10 +77,6 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
|
|||
{
|
||||
extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
|
||||
}
|
||||
if (resources.OES_texture_3D)
|
||||
{
|
||||
extBehavior[TExtension::OES_texture_3D] = EBhUndefined;
|
||||
}
|
||||
if (resources.ANGLE_texture_multisample)
|
||||
{
|
||||
extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
|
||||
|
@ -93,10 +85,6 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
|
|||
{
|
||||
extBehavior[TExtension::ANGLE_multi_draw] = EBhUndefined;
|
||||
}
|
||||
if (resources.ANGLE_base_vertex_base_instance)
|
||||
{
|
||||
extBehavior[TExtension::ANGLE_base_vertex_base_instance] = EBhUndefined;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetExtensionBehavior(TExtensionBehavior &extBehavior)
|
||||
|
|
|
@ -2105,138 +2105,132 @@ const TConstantUnion *TIntermConstantUnion::FoldBinary(TOperator op,
|
|||
resultArray = new TConstantUnion[objectSize];
|
||||
for (size_t i = 0; i < objectSize; i++)
|
||||
{
|
||||
if (IsFloatDivision(leftType.getBasicType(), rightType.getBasicType()))
|
||||
switch (leftType.getBasicType())
|
||||
{
|
||||
// Float division requested, possibly with implicit conversion
|
||||
ASSERT(op == EOpDiv);
|
||||
float dividend = leftArray[i].getFConst();
|
||||
float divisor = rightArray[i].getFConst();
|
||||
|
||||
if (divisor == 0.0f)
|
||||
case EbtFloat:
|
||||
{
|
||||
if (dividend == 0.0f)
|
||||
ASSERT(op == EOpDiv);
|
||||
float dividend = leftArray[i].getFConst();
|
||||
float divisor = rightArray[i].getFConst();
|
||||
if (divisor == 0.0f)
|
||||
{
|
||||
if (dividend == 0.0f)
|
||||
{
|
||||
diagnostics->warning(
|
||||
line,
|
||||
"Zero divided by zero during constant folding generated NaN",
|
||||
"/");
|
||||
resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
else
|
||||
{
|
||||
diagnostics->warning(line, "Divide by zero during constant folding",
|
||||
"/");
|
||||
bool negativeResult =
|
||||
std::signbit(dividend) != std::signbit(divisor);
|
||||
resultArray[i].setFConst(
|
||||
negativeResult ? -std::numeric_limits<float>::infinity()
|
||||
: std::numeric_limits<float>::infinity());
|
||||
}
|
||||
}
|
||||
else if (gl::isInf(dividend) && gl::isInf(divisor))
|
||||
{
|
||||
diagnostics->warning(line,
|
||||
"Zero divided by zero during constant "
|
||||
"Infinity divided by infinity during constant "
|
||||
"folding generated NaN",
|
||||
"/");
|
||||
resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
else
|
||||
{
|
||||
diagnostics->warning(line, "Divide by zero during constant folding",
|
||||
"/");
|
||||
bool negativeResult = std::signbit(dividend) != std::signbit(divisor);
|
||||
resultArray[i].setFConst(negativeResult
|
||||
? -std::numeric_limits<float>::infinity()
|
||||
: std::numeric_limits<float>::infinity());
|
||||
float result = dividend / divisor;
|
||||
if (!gl::isInf(dividend) && gl::isInf(result))
|
||||
{
|
||||
diagnostics->warning(
|
||||
line, "Constant folded division overflowed to infinity", "/");
|
||||
}
|
||||
resultArray[i].setFConst(result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (gl::isInf(dividend) && gl::isInf(divisor))
|
||||
{
|
||||
diagnostics->warning(line,
|
||||
"Infinity divided by infinity during constant "
|
||||
"folding generated NaN",
|
||||
"/");
|
||||
resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
|
||||
}
|
||||
else
|
||||
{
|
||||
float result = dividend / divisor;
|
||||
if (!gl::isInf(dividend) && gl::isInf(result))
|
||||
case EbtInt:
|
||||
if (rightArray[i] == 0)
|
||||
{
|
||||
diagnostics->warning(
|
||||
line, "Constant folded division overflowed to infinity", "/");
|
||||
line, "Divide by zero error during constant folding", "/");
|
||||
resultArray[i].setIConst(INT_MAX);
|
||||
}
|
||||
resultArray[i].setFConst(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Types are either both int or both uint
|
||||
switch (leftType.getBasicType())
|
||||
{
|
||||
case EbtInt:
|
||||
else
|
||||
{
|
||||
if (rightArray[i] == 0)
|
||||
int lhs = leftArray[i].getIConst();
|
||||
int divisor = rightArray[i].getIConst();
|
||||
if (op == EOpDiv)
|
||||
{
|
||||
diagnostics->warning(
|
||||
line, "Divide by zero error during constant folding", "/");
|
||||
resultArray[i].setIConst(INT_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
int lhs = leftArray[i].getIConst();
|
||||
int divisor = rightArray[i].getIConst();
|
||||
if (op == EOpDiv)
|
||||
// Check for the special case where the minimum representable number
|
||||
// is
|
||||
// divided by -1. If left alone this leads to integer overflow in
|
||||
// C++.
|
||||
// ESSL 3.00.6 section 4.1.3 Integers:
|
||||
// "However, for the case where the minimum representable value is
|
||||
// divided by -1, it is allowed to return either the minimum
|
||||
// representable value or the maximum representable value."
|
||||
if (lhs == -0x7fffffff - 1 && divisor == -1)
|
||||
{
|
||||
// Check for the special case where the minimum
|
||||
// representable number is divided by -1. If left alone this
|
||||
// leads to integer overflow in C++. ESSL 3.00.6
|
||||
// section 4.1.3 Integers: "However, for the case where the
|
||||
// minimum representable value is divided by -1, it is
|
||||
// allowed to return either the minimum representable value
|
||||
// or the maximum representable value."
|
||||
if (lhs == -0x7fffffff - 1 && divisor == -1)
|
||||
{
|
||||
resultArray[i].setIConst(0x7fffffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultArray[i].setIConst(lhs / divisor);
|
||||
}
|
||||
resultArray[i].setIConst(0x7fffffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(op == EOpIMod);
|
||||
if (lhs < 0 || divisor < 0)
|
||||
{
|
||||
// ESSL 3.00.6 section 5.9: Results of modulus are
|
||||
// undefined when either one of the operands is
|
||||
// negative.
|
||||
diagnostics->warning(line,
|
||||
"Negative modulus operator operand "
|
||||
"encountered during constant folding. "
|
||||
"Results are undefined.",
|
||||
"%");
|
||||
resultArray[i].setIConst(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultArray[i].setIConst(lhs % divisor);
|
||||
}
|
||||
resultArray[i].setIConst(lhs / divisor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EbtUInt:
|
||||
{
|
||||
if (rightArray[i] == 0)
|
||||
{
|
||||
diagnostics->warning(
|
||||
line, "Divide by zero error during constant folding", "/");
|
||||
resultArray[i].setUConst(UINT_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (op == EOpDiv)
|
||||
ASSERT(op == EOpIMod);
|
||||
if (lhs < 0 || divisor < 0)
|
||||
{
|
||||
resultArray[i].setUConst(leftArray[i].getUConst() /
|
||||
rightArray[i].getUConst());
|
||||
// ESSL 3.00.6 section 5.9: Results of modulus are undefined
|
||||
// when either one of the operands is negative.
|
||||
diagnostics->warning(line,
|
||||
"Negative modulus operator operand "
|
||||
"encountered during constant folding. "
|
||||
"Results are undefined.",
|
||||
"%");
|
||||
resultArray[i].setIConst(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(op == EOpIMod);
|
||||
resultArray[i].setUConst(leftArray[i].getUConst() %
|
||||
rightArray[i].getUConst());
|
||||
resultArray[i].setIConst(lhs % divisor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
|
||||
case EbtUInt:
|
||||
if (rightArray[i] == 0)
|
||||
{
|
||||
diagnostics->warning(
|
||||
line, "Divide by zero error during constant folding", "/");
|
||||
resultArray[i].setUConst(UINT_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (op == EOpDiv)
|
||||
{
|
||||
resultArray[i].setUConst(leftArray[i].getUConst() /
|
||||
rightArray[i].getUConst());
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(op == EOpIMod);
|
||||
resultArray[i].setUConst(leftArray[i].getUConst() %
|
||||
rightArray[i].getUConst());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3752,20 +3746,6 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
|
|||
return resultArray;
|
||||
}
|
||||
|
||||
bool TIntermConstantUnion::IsFloatDivision(TBasicType t1, TBasicType t2)
|
||||
{
|
||||
ImplicitTypeConversion conversion = GetConversion(t1, t2);
|
||||
ASSERT(conversion != ImplicitTypeConversion::Invalid);
|
||||
if (conversion == ImplicitTypeConversion::Same)
|
||||
{
|
||||
if (t1 == EbtFloat)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
ASSERT(t1 == EbtFloat || t2 == EbtFloat);
|
||||
return true;
|
||||
}
|
||||
|
||||
// TIntermPreprocessorDirective implementation.
|
||||
TIntermPreprocessorDirective::TIntermPreprocessorDirective(PreprocessorDirective directive,
|
||||
ImmutableString command)
|
||||
|
|
|
@ -358,7 +358,6 @@ class TIntermConstantUnion : public TIntermExpression
|
|||
int index);
|
||||
static TConstantUnion *FoldAggregateBuiltIn(TIntermAggregate *aggregate,
|
||||
TDiagnostics *diagnostics);
|
||||
static bool IsFloatDivision(TBasicType t1, TBasicType t2);
|
||||
|
||||
protected:
|
||||
// Same data may be shared between multiple constant unions, so it can't be modified.
|
||||
|
|
|
@ -417,4 +417,4 @@ bool IsAtomicFunction(TOperator op)
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,9 +98,8 @@ ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &nam
|
|||
// Extensions
|
||||
"texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod",
|
||||
"textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
|
||||
"texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", "texture3D",
|
||||
"texture", "texture3DProj", "textureProj", "texture3DLod", "textureLod", "texture3DProjLod",
|
||||
"textureProjLod", nullptr, nullptr};
|
||||
"texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", nullptr,
|
||||
nullptr};
|
||||
const char **mapping =
|
||||
(sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
|
||||
|
||||
|
|
|
@ -61,12 +61,11 @@ class CommaSeparatedListItemPrefixGenerator
|
|||
private:
|
||||
bool mFirst;
|
||||
|
||||
template <typename Stream>
|
||||
friend Stream &operator<<(Stream &out, CommaSeparatedListItemPrefixGenerator &gen);
|
||||
friend TInfoSinkBase &operator<<(TInfoSinkBase &out,
|
||||
CommaSeparatedListItemPrefixGenerator &gen);
|
||||
};
|
||||
|
||||
template <typename Stream>
|
||||
Stream &operator<<(Stream &out, CommaSeparatedListItemPrefixGenerator &gen)
|
||||
TInfoSinkBase &operator<<(TInfoSinkBase &out, CommaSeparatedListItemPrefixGenerator &gen)
|
||||
{
|
||||
if (gen.mFirst)
|
||||
{
|
||||
|
@ -161,90 +160,6 @@ void TOutputGLSLBase::writeBuiltInFunctionTriplet(Visit visit,
|
|||
}
|
||||
}
|
||||
|
||||
// Outputs what goes inside layout(), except for location and binding qualifiers, as they are
|
||||
// handled differently between GL GLSL and Vulkan GLSL.
|
||||
std::string TOutputGLSLBase::getCommonLayoutQualifiers(TIntermTyped *variable)
|
||||
{
|
||||
std::ostringstream out;
|
||||
CommaSeparatedListItemPrefixGenerator listItemPrefix;
|
||||
|
||||
const TType &type = variable->getType();
|
||||
const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
|
||||
|
||||
if (type.getQualifier() == EvqFragmentOut || type.getQualifier() == EvqVertexIn ||
|
||||
IsVarying(type.getQualifier()))
|
||||
{
|
||||
if (type.getQualifier() == EvqFragmentOut && layoutQualifier.index >= 0)
|
||||
{
|
||||
out << listItemPrefix << "index = " << layoutQualifier.index;
|
||||
}
|
||||
}
|
||||
|
||||
if (type.getQualifier() == EvqFragmentOut)
|
||||
{
|
||||
if (layoutQualifier.yuv == true)
|
||||
{
|
||||
out << listItemPrefix << "yuv";
|
||||
}
|
||||
}
|
||||
|
||||
if (IsImage(type.getBasicType()))
|
||||
{
|
||||
if (layoutQualifier.imageInternalFormat != EiifUnspecified)
|
||||
{
|
||||
ASSERT(type.getQualifier() == EvqTemporary || type.getQualifier() == EvqUniform);
|
||||
out << listItemPrefix
|
||||
<< getImageInternalFormatString(layoutQualifier.imageInternalFormat);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAtomicCounter(type.getBasicType()))
|
||||
{
|
||||
out << listItemPrefix << "offset = " << layoutQualifier.offset;
|
||||
}
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
// Outputs what comes after in/out/uniform/buffer storage qualifier.
|
||||
std::string TOutputGLSLBase::getMemoryQualifiers(const TType &type)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
const TMemoryQualifier &memoryQualifier = type.getMemoryQualifier();
|
||||
if (memoryQualifier.readonly)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
|
||||
out << "readonly ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.writeonly)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
|
||||
out << "writeonly ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.coherent)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
|
||||
out << "coherent ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.restrictQualifier)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
|
||||
out << "restrict ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.volatileQualifier)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
|
||||
out << "volatile ";
|
||||
}
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
|
||||
{
|
||||
const TType &type = variable->getType();
|
||||
|
@ -274,6 +189,18 @@ void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
|
|||
{
|
||||
out << listItemPrefix << "location = " << layoutQualifier.location;
|
||||
}
|
||||
if (type.getQualifier() == EvqFragmentOut && layoutQualifier.index >= 0)
|
||||
{
|
||||
out << listItemPrefix << "index = " << layoutQualifier.index;
|
||||
}
|
||||
}
|
||||
|
||||
if (type.getQualifier() == EvqFragmentOut)
|
||||
{
|
||||
if (layoutQualifier.yuv == true)
|
||||
{
|
||||
out << listItemPrefix << "yuv";
|
||||
}
|
||||
}
|
||||
|
||||
if (IsOpaqueType(type.getBasicType()))
|
||||
|
@ -284,24 +211,31 @@ void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
|
|||
}
|
||||
}
|
||||
|
||||
std::string otherQualifiers = getCommonLayoutQualifiers(variable);
|
||||
if (!otherQualifiers.empty())
|
||||
if (IsImage(type.getBasicType()))
|
||||
{
|
||||
out << listItemPrefix << otherQualifiers;
|
||||
if (layoutQualifier.imageInternalFormat != EiifUnspecified)
|
||||
{
|
||||
ASSERT(type.getQualifier() == EvqTemporary || type.getQualifier() == EvqUniform);
|
||||
out << listItemPrefix
|
||||
<< getImageInternalFormatString(layoutQualifier.imageInternalFormat);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAtomicCounter(type.getBasicType()))
|
||||
{
|
||||
out << listItemPrefix << "offset = " << layoutQualifier.offset;
|
||||
}
|
||||
|
||||
out << ") ";
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::writeQualifier(TQualifier qualifier, const TType &type, const TSymbol *symbol)
|
||||
void TOutputGLSLBase::writeQualifier(TQualifier qualifier, const TSymbol *symbol)
|
||||
{
|
||||
const char *result = mapQualifierToString(qualifier);
|
||||
if (result && result[0] != '\0')
|
||||
{
|
||||
objSink() << result << " ";
|
||||
}
|
||||
|
||||
objSink() << getMemoryQualifiers(type);
|
||||
}
|
||||
|
||||
const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier)
|
||||
|
@ -350,7 +284,38 @@ void TOutputGLSLBase::writeVariableType(const TType &type, const TSymbol *symbol
|
|||
}
|
||||
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
|
||||
{
|
||||
writeQualifier(qualifier, type, symbol);
|
||||
writeQualifier(qualifier, symbol);
|
||||
}
|
||||
|
||||
const TMemoryQualifier &memoryQualifier = type.getMemoryQualifier();
|
||||
if (memoryQualifier.readonly)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()));
|
||||
out << "readonly ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.writeonly)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()));
|
||||
out << "writeonly ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.coherent)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()));
|
||||
out << "coherent ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.restrictQualifier)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()));
|
||||
out << "restrict ";
|
||||
}
|
||||
|
||||
if (memoryQualifier.volatileQualifier)
|
||||
{
|
||||
ASSERT(IsImage(type.getBasicType()));
|
||||
out << "volatile ";
|
||||
}
|
||||
|
||||
// Declare the struct if we have not done so already.
|
||||
|
|
|
@ -40,8 +40,6 @@ class TOutputGLSLBase : public TIntermTraverser
|
|||
TInfoSinkBase &objSink() { return mObjSink; }
|
||||
void writeFloat(TInfoSinkBase &out, float f);
|
||||
void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
|
||||
std::string getCommonLayoutQualifiers(TIntermTyped *variable);
|
||||
std::string getMemoryQualifiers(const TType &type);
|
||||
virtual void writeLayoutQualifier(TIntermTyped *variable);
|
||||
void writeInvariantQualifier(const TType &type);
|
||||
virtual void writeVariableType(const TType &type, const TSymbol *symbol);
|
||||
|
@ -79,7 +77,7 @@ class TOutputGLSLBase : public TIntermTraverser
|
|||
virtual ImmutableString translateTextureFunction(const ImmutableString &name) { return name; }
|
||||
|
||||
void declareStruct(const TStructure *structure);
|
||||
virtual void writeQualifier(TQualifier qualifier, const TType &type, const TSymbol *symbol);
|
||||
virtual void writeQualifier(TQualifier qualifier, const TSymbol *symbol);
|
||||
bool structDeclared(const TStructure *structure) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -39,7 +39,7 @@ constexpr const char kImage2DFunctionString[] = "// @@ IMAGE2D DECLARATION FUNCT
|
|||
|
||||
TString ArrayHelperFunctionName(const char *prefix, const TType &type)
|
||||
{
|
||||
TStringStream fnName = sh::InitializeStream<TStringStream>();
|
||||
TStringStream fnName;
|
||||
fnName << prefix << "_";
|
||||
if (type.isArray())
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ const char *kZeros = "_ANGLE_ZEROS_";
|
|||
constexpr int kZeroCount = 256;
|
||||
std::string DefineZeroArray()
|
||||
{
|
||||
std::stringstream ss = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream ss;
|
||||
// For 'static', if the declaration does not include an initializer, the value is set to zero.
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-syntax
|
||||
ss << "static uint " << kZeros << "[" << kZeroCount << "];\n";
|
||||
|
@ -141,9 +141,9 @@ std::string DefineZeroArray()
|
|||
|
||||
std::string GetZeroInitializer(size_t size)
|
||||
{
|
||||
std::stringstream ss = sh::InitializeStream<std::stringstream>();
|
||||
size_t quotient = size / kZeroCount;
|
||||
size_t reminder = size % kZeroCount;
|
||||
std::stringstream ss;
|
||||
size_t quotient = size / kZeroCount;
|
||||
size_t reminder = size % kZeroCount;
|
||||
|
||||
for (size_t i = 0; i < quotient; ++i)
|
||||
{
|
||||
|
@ -173,49 +173,6 @@ TReferencedBlock::TReferencedBlock(const TInterfaceBlock *aBlock,
|
|||
: block(aBlock), instanceVariable(aInstanceVariable)
|
||||
{}
|
||||
|
||||
bool OutputHLSL::needStructMapping(TIntermTyped *node)
|
||||
{
|
||||
ASSERT(node->getBasicType() == EbtStruct);
|
||||
for (unsigned int n = 0u; getAncestorNode(n) != nullptr; ++n)
|
||||
{
|
||||
TIntermNode *ancestor = getAncestorNode(n);
|
||||
const TIntermBinary *ancestorBinary = ancestor->getAsBinaryNode();
|
||||
if (ancestorBinary)
|
||||
{
|
||||
switch (ancestorBinary->getOp())
|
||||
{
|
||||
case EOpIndexDirectStruct:
|
||||
{
|
||||
const TStructure *structure = ancestorBinary->getLeft()->getType().getStruct();
|
||||
const TIntermConstantUnion *index =
|
||||
ancestorBinary->getRight()->getAsConstantUnion();
|
||||
const TField *field = structure->fields()[index->getIConst(0)];
|
||||
if (field->type()->getStruct() == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const TIntermAggregate *ancestorAggregate = ancestor->getAsAggregate();
|
||||
if (ancestorAggregate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OutputHLSL::writeFloat(TInfoSinkBase &out, float f)
|
||||
{
|
||||
// This is known not to work for NaN on all drivers but make the best effort to output NaNs
|
||||
|
@ -296,8 +253,7 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType,
|
|||
mMaxDualSourceDrawBuffers(maxDualSourceDrawBuffers),
|
||||
mCurrentFunctionMetadata(nullptr),
|
||||
mWorkGroupSize(workGroupSize),
|
||||
mPerfDiagnostics(perfDiagnostics),
|
||||
mNeedStructMapping(false)
|
||||
mPerfDiagnostics(perfDiagnostics)
|
||||
{
|
||||
mUsesFragColor = false;
|
||||
mUsesFragData = false;
|
||||
|
@ -308,7 +264,6 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType,
|
|||
mUsesPointSize = false;
|
||||
mUsesInstanceID = false;
|
||||
mHasMultiviewExtensionEnabled =
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview) ||
|
||||
IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview2);
|
||||
mUsesViewID = false;
|
||||
mUsesVertexID = false;
|
||||
|
@ -333,11 +288,10 @@ OutputHLSL::OutputHLSL(sh::GLenum shaderType,
|
|||
|
||||
mExcessiveLoopIndex = nullptr;
|
||||
|
||||
mStructureHLSL = new StructureHLSL;
|
||||
mTextureFunctionHLSL = new TextureFunctionHLSL;
|
||||
mImageFunctionHLSL = new ImageFunctionHLSL;
|
||||
mAtomicCounterFunctionHLSL =
|
||||
new AtomicCounterFunctionHLSL((compileOptions & SH_FORCE_ATOMIC_VALUE_RESOLUTION) != 0);
|
||||
mStructureHLSL = new StructureHLSL;
|
||||
mTextureFunctionHLSL = new TextureFunctionHLSL;
|
||||
mImageFunctionHLSL = new ImageFunctionHLSL;
|
||||
mAtomicCounterFunctionHLSL = new AtomicCounterFunctionHLSL;
|
||||
|
||||
unsigned int firstUniformRegister =
|
||||
((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u;
|
||||
|
@ -465,7 +419,7 @@ TString OutputHLSL::structInitializerString(int indent,
|
|||
init += indentString + "{\n";
|
||||
for (unsigned int arrayIndex = 0u; arrayIndex < type.getOutermostArraySize(); ++arrayIndex)
|
||||
{
|
||||
TStringStream indexedString = sh::InitializeStream<TStringStream>();
|
||||
TStringStream indexedString;
|
||||
indexedString << name << "[" << arrayIndex << "]";
|
||||
TType elementType = type;
|
||||
elementType.toArrayElementType();
|
||||
|
@ -608,11 +562,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
|||
const std::vector<MappedStruct> &std140Structs,
|
||||
const BuiltInFunctionEmulator *builtInFunctionEmulator) const
|
||||
{
|
||||
TString mappedStructs;
|
||||
if (mNeedStructMapping)
|
||||
{
|
||||
mappedStructs = generateStructMapping(std140Structs);
|
||||
}
|
||||
TString mappedStructs = generateStructMapping(std140Structs);
|
||||
|
||||
out << mStructureHLSL->structsHeader();
|
||||
|
||||
|
@ -926,11 +876,6 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
|||
mResourcesHLSL->samplerMetadataUniforms(out, 4);
|
||||
}
|
||||
|
||||
if (mUsesVertexID)
|
||||
{
|
||||
out << " uint dx_VertexID : packoffset(c3.w);\n";
|
||||
}
|
||||
|
||||
out << "};\n"
|
||||
"\n";
|
||||
}
|
||||
|
@ -973,8 +918,8 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
|||
|
||||
out << kImage2DFunctionString << "\n";
|
||||
|
||||
std::ostringstream systemValueDeclaration = sh::InitializeStream<std::ostringstream>();
|
||||
std::ostringstream glBuiltinInitialization = sh::InitializeStream<std::ostringstream>();
|
||||
std::ostringstream systemValueDeclaration;
|
||||
std::ostringstream glBuiltinInitialization;
|
||||
|
||||
systemValueDeclaration << "\nstruct CS_INPUT\n{\n";
|
||||
glBuiltinInitialization << "\nvoid initGLBuiltins(CS_INPUT input)\n"
|
||||
|
@ -1059,11 +1004,6 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
|||
out << "#define GL_ANGLE_MULTIVIEW_ENABLED\n";
|
||||
}
|
||||
|
||||
if (mUsesVertexID)
|
||||
{
|
||||
out << "#define GL_USES_VERTEX_ID\n";
|
||||
}
|
||||
|
||||
if (mUsesViewID)
|
||||
{
|
||||
out << "#define GL_USES_VIEW_ID\n";
|
||||
|
@ -1102,10 +1042,8 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
|
|||
TInfoSinkBase &out = getInfoSink();
|
||||
|
||||
// Handle accessing std140 structs by value
|
||||
if (IsInStd140UniformBlock(node) && node->getBasicType() == EbtStruct &&
|
||||
needStructMapping(node))
|
||||
if (IsInStd140UniformBlock(node) && node->getBasicType() == EbtStruct)
|
||||
{
|
||||
mNeedStructMapping = true;
|
||||
out << "map";
|
||||
}
|
||||
|
||||
|
@ -1644,12 +1582,10 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
|
|||
case EOpIndexDirectInterfaceBlock:
|
||||
{
|
||||
ASSERT(!IsInShaderStorageBlock(node->getLeft()));
|
||||
bool structInStd140UniformBlock = node->getBasicType() == EbtStruct &&
|
||||
IsInStd140UniformBlock(node->getLeft()) &&
|
||||
needStructMapping(node);
|
||||
bool structInStd140UniformBlock =
|
||||
node->getBasicType() == EbtStruct && IsInStd140UniformBlock(node->getLeft());
|
||||
if (visit == PreVisit && structInStd140UniformBlock)
|
||||
{
|
||||
mNeedStructMapping = true;
|
||||
out << "map";
|
||||
}
|
||||
if (visit == InVisit)
|
||||
|
@ -2001,7 +1937,7 @@ ImmutableString OutputHLSL::samplerNamePrefixFromStruct(TIntermTyped *node)
|
|||
{
|
||||
int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
|
||||
|
||||
std::stringstream prefixSink = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream prefixSink;
|
||||
prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_" << index;
|
||||
return ImmutableString(prefixSink.str());
|
||||
}
|
||||
|
@ -2011,7 +1947,7 @@ ImmutableString OutputHLSL::samplerNamePrefixFromStruct(TIntermTyped *node)
|
|||
int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
|
||||
const TField *field = s->fields()[index];
|
||||
|
||||
std::stringstream prefixSink = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream prefixSink;
|
||||
prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_"
|
||||
<< field->name();
|
||||
return ImmutableString(prefixSink.str());
|
||||
|
@ -2214,11 +2150,8 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
|
|||
{
|
||||
symbol->traverse(this);
|
||||
out << ArrayString(symbol->getType());
|
||||
// Temporarily disable shadred memory initialization. It is very slow for D3D11
|
||||
// drivers to compile a compute shader if we add code to initialize a
|
||||
// groupshared array variable with a large array size. And maybe produce
|
||||
// incorrect result. See http://anglebug.com/3226.
|
||||
if (declarator->getQualifier() != EvqShared)
|
||||
if (declarator->getQualifier() != EvqShared ||
|
||||
mCompileOptions & SH_INIT_SHARED_VARIABLES)
|
||||
{
|
||||
out << " = " + zeroInitializer(symbol->getType());
|
||||
}
|
||||
|
@ -2305,8 +2238,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
|
|||
{
|
||||
TIntermSequence *arguments = node->getSequence();
|
||||
|
||||
bool lod0 = (mInsideDiscontinuousLoop || mOutputLod0Function) &&
|
||||
mShaderType == GL_FRAGMENT_SHADER;
|
||||
bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
|
||||
if (node->getOp() == EOpCallFunctionInAST)
|
||||
{
|
||||
if (node->isArray())
|
||||
|
|
|
@ -267,12 +267,7 @@ class OutputHLSL : public TIntermTraverser
|
|||
TString generateStructMapping(const std::vector<MappedStruct> &std140Structs) const;
|
||||
ImmutableString samplerNamePrefixFromStruct(TIntermTyped *node);
|
||||
bool ancestorEvaluatesToSamplerInStruct();
|
||||
// We need to do struct mapping when pass the struct to a function or copy the struct via
|
||||
// assignment.
|
||||
bool needStructMapping(TIntermTyped *node);
|
||||
|
||||
ShaderStorageBlockOutputHLSL *mSSBOOutputHLSL;
|
||||
bool mNeedStructMapping;
|
||||
};
|
||||
} // namespace sh
|
||||
|
||||
|
|
|
@ -216,18 +216,11 @@ TParseContext::TParseContext(TSymbolTable &symt,
|
|||
mGeometryShaderInvocations(0),
|
||||
mGeometryShaderMaxVertices(-1),
|
||||
mMaxGeometryShaderInvocations(resources.MaxGeometryShaderInvocations),
|
||||
mMaxGeometryShaderMaxVertices(resources.MaxGeometryOutputVertices),
|
||||
mFunctionBodyNewScope(false)
|
||||
mMaxGeometryShaderMaxVertices(resources.MaxGeometryOutputVertices)
|
||||
{}
|
||||
|
||||
TParseContext::~TParseContext() {}
|
||||
|
||||
bool TParseContext::anyMultiviewExtensionAvailable()
|
||||
{
|
||||
return isExtensionEnabled(TExtension::OVR_multiview) ||
|
||||
isExtensionEnabled(TExtension::OVR_multiview2);
|
||||
}
|
||||
|
||||
bool TParseContext::parseVectorFields(const TSourceLoc &line,
|
||||
const ImmutableString &compString,
|
||||
int vecSize,
|
||||
|
@ -618,7 +611,7 @@ bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIn
|
|||
return true;
|
||||
}
|
||||
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
reasonStream << "l-value required";
|
||||
if (!message.empty())
|
||||
{
|
||||
|
@ -909,7 +902,7 @@ bool TParseContext::checkIsNotOpaqueType(const TSourceLoc &line,
|
|||
{
|
||||
if (ContainsSampler(pType.userDef))
|
||||
{
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
reasonStream << reason << " (structure contains a sampler)";
|
||||
std::string reasonStr = reasonStream.str();
|
||||
error(line, reasonStr.c_str(), getBasicString(pType.type));
|
||||
|
@ -1354,7 +1347,8 @@ void TParseContext::declarationQualifierErrorCheck(const sh::TQualifier qualifie
|
|||
|
||||
// If multiview extension is enabled, "in" qualifier is allowed in the vertex shader in previous
|
||||
// parsing steps. So it needs to be checked here.
|
||||
if (anyMultiviewExtensionAvailable() && mShaderVersion < 300 && qualifier == EvqVertexIn)
|
||||
if (isExtensionEnabled(TExtension::OVR_multiview2) && mShaderVersion < 300 &&
|
||||
qualifier == EvqVertexIn)
|
||||
{
|
||||
error(location, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
|
||||
}
|
||||
|
@ -2372,6 +2366,11 @@ void TParseContext::checkAtomicCounterOffsetDoesNotOverlap(bool forceAppend,
|
|||
const TSourceLoc &loc,
|
||||
TType *type)
|
||||
{
|
||||
if (!IsAtomicCounter(type->getBasicType()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t size = type->isArray() ? kAtomicCounterArrayStride * type->getArraySizeProduct()
|
||||
: kAtomicCounterSize;
|
||||
TLayoutQualifier layoutQualifier = type->getLayoutQualifier();
|
||||
|
@ -2394,17 +2393,6 @@ void TParseContext::checkAtomicCounterOffsetDoesNotOverlap(bool forceAppend,
|
|||
type->setLayoutQualifier(layoutQualifier);
|
||||
}
|
||||
|
||||
void TParseContext::checkAtomicCounterOffsetAlignment(const TSourceLoc &location, const TType &type)
|
||||
{
|
||||
TLayoutQualifier layoutQualifier = type.getLayoutQualifier();
|
||||
|
||||
// OpenGL ES 3.1 Table 6.5, Atomic counter offset must be a multiple of 4
|
||||
if (layoutQualifier.offset % 4 != 0)
|
||||
{
|
||||
error(location, "Offset must be multiple of 4", "atomic counter");
|
||||
}
|
||||
}
|
||||
|
||||
void TParseContext::checkGeometryShaderInputAndSetArraySize(const TSourceLoc &location,
|
||||
const ImmutableString &token,
|
||||
TType *type)
|
||||
|
@ -2466,7 +2454,11 @@ TIntermDeclaration *TParseContext::parseSingleDeclaration(
|
|||
// the way this is currently implemented we have to enable this compiler option before
|
||||
// parsing the shader and determining the shading language version it uses. If this were
|
||||
// implemented as a post-pass, the workaround could be more targeted.
|
||||
if (qualifier == EvqVaryingOut || qualifier == EvqVertexOut)
|
||||
//
|
||||
// 3. Inputs in ESSL 1.00 fragment shaders (EvqVaryingIn). This is somewhat in violation of
|
||||
// the specification, but there are desktop OpenGL drivers that expect that this is the
|
||||
// behavior of the #pragma when specified in ESSL 1.00 fragment shaders.
|
||||
if (qualifier == EvqVaryingOut || qualifier == EvqVertexOut || qualifier == EvqVaryingIn)
|
||||
{
|
||||
type->setInvariant(true);
|
||||
}
|
||||
|
@ -2503,12 +2495,7 @@ TIntermDeclaration *TParseContext::parseSingleDeclaration(
|
|||
|
||||
checkCanBeDeclaredWithoutInitializer(identifierOrTypeLocation, identifier, type);
|
||||
|
||||
if (IsAtomicCounter(type->getBasicType()))
|
||||
{
|
||||
checkAtomicCounterOffsetDoesNotOverlap(false, identifierOrTypeLocation, type);
|
||||
|
||||
checkAtomicCounterOffsetAlignment(identifierOrTypeLocation, *type);
|
||||
}
|
||||
checkAtomicCounterOffsetDoesNotOverlap(false, identifierOrTypeLocation, type);
|
||||
|
||||
TVariable *variable = nullptr;
|
||||
if (declareVariable(identifierOrTypeLocation, identifier, type, &variable))
|
||||
|
@ -2550,12 +2537,7 @@ TIntermDeclaration *TParseContext::parseSingleArrayDeclaration(
|
|||
|
||||
checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, arrayType);
|
||||
|
||||
if (IsAtomicCounter(arrayType->getBasicType()))
|
||||
{
|
||||
checkAtomicCounterOffsetDoesNotOverlap(false, identifierLocation, arrayType);
|
||||
|
||||
checkAtomicCounterOffsetAlignment(identifierLocation, *arrayType);
|
||||
}
|
||||
checkAtomicCounterOffsetDoesNotOverlap(false, identifierLocation, arrayType);
|
||||
|
||||
TIntermDeclaration *declaration = new TIntermDeclaration();
|
||||
declaration->setLine(identifierLocation);
|
||||
|
@ -2713,12 +2695,7 @@ void TParseContext::parseDeclarator(TPublicType &publicType,
|
|||
|
||||
checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, type);
|
||||
|
||||
if (IsAtomicCounter(type->getBasicType()))
|
||||
{
|
||||
checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, type);
|
||||
|
||||
checkAtomicCounterOffsetAlignment(identifierLocation, *type);
|
||||
}
|
||||
checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, type);
|
||||
|
||||
TVariable *variable = nullptr;
|
||||
if (declareVariable(identifierLocation, identifier, type, &variable))
|
||||
|
@ -2755,12 +2732,7 @@ void TParseContext::parseArrayDeclarator(TPublicType &elementType,
|
|||
|
||||
checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, arrayType);
|
||||
|
||||
if (IsAtomicCounter(arrayType->getBasicType()))
|
||||
{
|
||||
checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, arrayType);
|
||||
|
||||
checkAtomicCounterOffsetAlignment(identifierLocation, *arrayType);
|
||||
}
|
||||
checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, arrayType);
|
||||
|
||||
TVariable *variable = nullptr;
|
||||
if (declareVariable(identifierLocation, identifier, arrayType, &variable))
|
||||
|
@ -3094,7 +3066,7 @@ void TParseContext::parseGlobalLayoutQualifier(const TTypeQualifierBuilder &type
|
|||
if (mComputeShaderLocalSize[i] < 1 ||
|
||||
mComputeShaderLocalSize[i] > maxComputeWorkGroupSizeValue)
|
||||
{
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
reasonStream << "invalid value: Value must be at least 1 and no greater than "
|
||||
<< maxComputeWorkGroupSizeValue;
|
||||
const std::string &reason = reasonStream.str();
|
||||
|
@ -3134,7 +3106,8 @@ void TParseContext::parseGlobalLayoutQualifier(const TTypeQualifierBuilder &type
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (anyMultiviewExtensionAvailable() && typeQualifier.qualifier == EvqVertexIn)
|
||||
else if (isExtensionEnabled(TExtension::OVR_multiview2) &&
|
||||
typeQualifier.qualifier == EvqVertexIn)
|
||||
{
|
||||
// This error is only specified in WebGL, but tightens unspecified behavior in the native
|
||||
// specification.
|
||||
|
@ -3287,13 +3260,6 @@ TIntermFunctionDefinition *TParseContext::addFunctionDefinition(
|
|||
TIntermBlock *functionBody,
|
||||
const TSourceLoc &location)
|
||||
{
|
||||
// Undo push at end of parseFunctionDefinitionHeader() below for ESSL1.00 case
|
||||
if (mFunctionBodyNewScope)
|
||||
{
|
||||
mFunctionBodyNewScope = false;
|
||||
symbolTable.pop();
|
||||
}
|
||||
|
||||
// Check that non-void functions have at least one return statement.
|
||||
if (mCurrentFunctionType->getBasicType() != EbtVoid && !mFunctionReturnsValue)
|
||||
{
|
||||
|
@ -3333,13 +3299,6 @@ void TParseContext::parseFunctionDefinitionHeader(const TSourceLoc &location,
|
|||
|
||||
*prototypeOut = createPrototypeNodeFromFunction(*function, location, true);
|
||||
setLoopNestingLevel(0);
|
||||
|
||||
// ESSL 1.00 spec allows for variable in function body to redefine parameter
|
||||
if (IsSpecWithFunctionBodyNewScope(mShaderSpec, mShaderVersion))
|
||||
{
|
||||
mFunctionBodyNewScope = true;
|
||||
symbolTable.push();
|
||||
}
|
||||
}
|
||||
|
||||
TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TFunction *function)
|
||||
|
@ -3932,7 +3891,7 @@ void TParseContext::checkIsBelowStructNestingLimit(const TSourceLoc &line, const
|
|||
// one to the field's struct nesting.
|
||||
if (1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting)
|
||||
{
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
if (field.type()->getStruct()->symbolType() == SymbolType::Empty)
|
||||
{
|
||||
// This may happen in case there are nested struct definitions. While they are also
|
||||
|
@ -4126,7 +4085,7 @@ int TParseContext::checkIndexLessThan(bool outOfRangeIndexIsError,
|
|||
ASSERT(index >= 0);
|
||||
if (index >= arraySize)
|
||||
{
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
reasonStream << reason << " '" << index << "'";
|
||||
std::string token = reasonStream.str();
|
||||
outOfRangeError(outOfRangeIndexIsError, location, reason, "[]");
|
||||
|
@ -4428,7 +4387,7 @@ void TParseContext::parseLocalSize(const ImmutableString &qualifierType,
|
|||
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
|
||||
if (intValue < 1)
|
||||
{
|
||||
std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream reasonStream;
|
||||
reasonStream << "out of range: " << getWorkGroupSizeString(index) << " must be positive";
|
||||
std::string reason = reasonStream.str();
|
||||
error(intValueLine, reason.c_str(), intValueString.c_str());
|
||||
|
@ -4576,9 +4535,7 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qual
|
|||
}
|
||||
else if (qualifierType == "num_views" && mShaderType == GL_VERTEX_SHADER)
|
||||
{
|
||||
if (checkCanUseOneOfExtensions(
|
||||
qualifierTypeLine, std::array<TExtension, 2u>{
|
||||
{TExtension::OVR_multiview, TExtension::OVR_multiview2}}))
|
||||
if (checkCanUseExtension(qualifierTypeLine, TExtension::OVR_multiview2))
|
||||
{
|
||||
parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews);
|
||||
}
|
||||
|
@ -4640,7 +4597,7 @@ TStorageQualifierWrapper *TParseContext::parseInQualifier(const TSourceLoc &loc)
|
|||
{
|
||||
case GL_VERTEX_SHADER:
|
||||
{
|
||||
if (mShaderVersion < 300 && !anyMultiviewExtensionAvailable())
|
||||
if (mShaderVersion < 300 && !isExtensionEnabled(TExtension::OVR_multiview2))
|
||||
{
|
||||
error(loc, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
|
||||
}
|
||||
|
@ -5217,11 +5174,9 @@ bool TParseContext::binaryOpCommonCheck(TOperator op,
|
|||
break;
|
||||
}
|
||||
|
||||
ImplicitTypeConversion conversion = GetConversion(left->getBasicType(), right->getBasicType());
|
||||
|
||||
// Implicit type casting only supported for GL shaders
|
||||
if (!isBitShift && conversion != ImplicitTypeConversion::Same &&
|
||||
(!IsDesktopGLSpec(mShaderSpec) || !IsValidImplicitConversion(conversion, op)))
|
||||
// GLSL ES 1.00 and 3.00 do not support implicit type casting.
|
||||
// So the basic type should usually match.
|
||||
if (!isBitShift && left->getBasicType() != right->getBasicType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -5717,7 +5672,7 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
|
|||
int offsetValue = values[i].getIConst();
|
||||
if (offsetValue > maxOffsetValue || offsetValue < minOffsetValue)
|
||||
{
|
||||
std::stringstream tokenStream = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream tokenStream;
|
||||
tokenStream << offsetValue;
|
||||
std::string token = tokenStream.str();
|
||||
error(offset->getLine(), "Texture offset value out of valid range",
|
||||
|
@ -5915,14 +5870,6 @@ TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunctionLookup *fnCa
|
|||
// There are no inner functions, so it's enough to look for user-defined functions in the
|
||||
// global scope.
|
||||
const TSymbol *symbol = symbolTable.findGlobal(fnCall->getMangledName());
|
||||
|
||||
if (symbol == nullptr && IsDesktopGLSpec(mShaderSpec))
|
||||
{
|
||||
// If using Desktop GL spec, need to check for implicit conversion
|
||||
symbol = symbolTable.findGlobalWithConversion(
|
||||
fnCall->getMangledNamesForImplicitConversions());
|
||||
}
|
||||
|
||||
if (symbol != nullptr)
|
||||
{
|
||||
// A user-defined function - could be an overloaded built-in as well.
|
||||
|
@ -5937,15 +5884,11 @@ TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunctionLookup *fnCa
|
|||
}
|
||||
|
||||
symbol = symbolTable.findBuiltIn(fnCall->getMangledName(), mShaderVersion);
|
||||
|
||||
if (symbol == nullptr && IsDesktopGLSpec(mShaderSpec))
|
||||
if (symbol == nullptr)
|
||||
{
|
||||
// If using Desktop GL spec, need to check for implicit conversion
|
||||
symbol = symbolTable.findBuiltInWithConversion(
|
||||
fnCall->getMangledNamesForImplicitConversions(), mShaderVersion);
|
||||
error(loc, "no matching overloaded function found", fnCall->name());
|
||||
}
|
||||
|
||||
if (symbol != nullptr)
|
||||
else
|
||||
{
|
||||
// A built-in function.
|
||||
ASSERT(symbol->symbolType() == SymbolType::BuiltIn);
|
||||
|
@ -5993,10 +5936,6 @@ TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunctionLookup *fnCa
|
|||
functionCallRValueLValueErrorCheck(fnCandidate, callNode);
|
||||
return callNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
error(loc, "no matching overloaded function found", fnCall->name());
|
||||
}
|
||||
}
|
||||
|
||||
// Error message was already written. Put on a dummy node for error recovery.
|
||||
|
|
|
@ -43,7 +43,6 @@ class TParseContext : angle::NonCopyable
|
|||
const ShBuiltInResources &resources);
|
||||
~TParseContext();
|
||||
|
||||
bool anyMultiviewExtensionAvailable();
|
||||
const angle::pp::Preprocessor &getPreprocessor() const { return mPreprocessor; }
|
||||
angle::pp::Preprocessor &getPreprocessor() { return mPreprocessor; }
|
||||
void *getScanner() const { return mScanner; }
|
||||
|
@ -516,8 +515,6 @@ class TParseContext : angle::NonCopyable
|
|||
void checkAtomicCounterOffsetDoesNotOverlap(bool forceAppend,
|
||||
const TSourceLoc &loc,
|
||||
TType *type);
|
||||
void checkAtomicCounterOffsetAlignment(const TSourceLoc &location, const TType &type);
|
||||
|
||||
void checkIndexIsNotSpecified(const TSourceLoc &location, int index);
|
||||
void checkBindingIsValid(const TSourceLoc &identifierLocation, const TType &type);
|
||||
void checkBindingIsNotSpecified(const TSourceLoc &location, int binding);
|
||||
|
@ -652,9 +649,6 @@ class TParseContext : angle::NonCopyable
|
|||
int mGeometryShaderMaxVertices;
|
||||
int mMaxGeometryShaderInvocations;
|
||||
int mMaxGeometryShaderMaxVertices;
|
||||
|
||||
// Track when we add new scope for func body in ESSL 1.00 spec
|
||||
bool mFunctionBodyNewScope;
|
||||
};
|
||||
|
||||
int PaParseStrings(size_t count,
|
||||
|
|
|
@ -21,42 +21,42 @@ namespace BuiltInGroup
|
|||
bool isTextureOffsetNoBias(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 677 && id <= 746;
|
||||
return id >= 671 && id <= 740;
|
||||
}
|
||||
bool isTextureOffsetBias(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 747 && id <= 766;
|
||||
return id >= 741 && id <= 760;
|
||||
}
|
||||
bool isTextureGatherOffset(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 844 && id <= 857;
|
||||
return id >= 838 && id <= 851;
|
||||
}
|
||||
bool isTextureGather(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 820 && id <= 857;
|
||||
return id >= 814 && id <= 851;
|
||||
}
|
||||
bool isAtomicMemory(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 874 && id <= 891;
|
||||
return id >= 868 && id <= 885;
|
||||
}
|
||||
bool isImageLoad(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 916 && id <= 927;
|
||||
return id >= 910 && id <= 921;
|
||||
}
|
||||
bool isImageStore(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 928 && id <= 939;
|
||||
return id >= 922 && id <= 933;
|
||||
}
|
||||
bool isImage(const TFunction *func)
|
||||
{
|
||||
int id = func->uniqueId().get();
|
||||
return id >= 892 && id <= 939;
|
||||
return id >= 886 && id <= 933;
|
||||
}
|
||||
|
||||
} // namespace BuiltInGroup
|
||||
|
|
|
@ -385,9 +385,8 @@ void ResourcesHLSL::outputAtomicCounterBuffer(TInfoSinkBase &out,
|
|||
const int binding,
|
||||
const unsigned int registerIndex)
|
||||
{
|
||||
// Atomic counter memory access is not incoherent
|
||||
out << "uniform globallycoherent RWByteAddressBuffer "
|
||||
<< getAtomicCounterNameForBinding(binding) << " : register(u" << registerIndex << ");\n";
|
||||
out << "uniform RWByteAddressBuffer " << getAtomicCounterNameForBinding(binding)
|
||||
<< " : register(u" << registerIndex << ");\n";
|
||||
}
|
||||
|
||||
void ResourcesHLSL::uniformsHeader(TInfoSinkBase &out,
|
||||
|
@ -592,8 +591,7 @@ void ResourcesHLSL::imageMetadataUniforms(TInfoSinkBase &out, unsigned int regIn
|
|||
out << " struct ImageMetadata\n"
|
||||
" {\n"
|
||||
" int layer;\n"
|
||||
" uint level;\n"
|
||||
" int2 padding;\n"
|
||||
" int3 padding;\n"
|
||||
" };\n";
|
||||
|
||||
if (mReadonlyImageCount > 0)
|
||||
|
|
|
@ -199,15 +199,12 @@ void InitBuiltInResources(ShBuiltInResources *resources)
|
|||
resources->EXT_shader_framebuffer_fetch = 0;
|
||||
resources->NV_shader_framebuffer_fetch = 0;
|
||||
resources->ARM_shader_framebuffer_fetch = 0;
|
||||
resources->OVR_multiview = 0;
|
||||
resources->OVR_multiview2 = 0;
|
||||
resources->EXT_YUV_target = 0;
|
||||
resources->EXT_geometry_shader = 0;
|
||||
resources->OES_texture_storage_multisample_2d_array = 0;
|
||||
resources->OES_texture_3D = 0;
|
||||
resources->ANGLE_texture_multisample = 0;
|
||||
resources->ANGLE_multi_draw = 0;
|
||||
resources->ANGLE_base_vertex_base_instance = 0;
|
||||
|
||||
resources->NV_draw_buffers = 0;
|
||||
|
||||
|
|
|
@ -634,11 +634,6 @@ bool ShaderStorageBlockOutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
|
|||
break;
|
||||
}
|
||||
case EOpIndexDirectInterfaceBlock:
|
||||
if (!IsInShaderStorageBlock(node->getLeft()))
|
||||
{
|
||||
return mOutputHLSL->visitBinary(visit, node);
|
||||
}
|
||||
|
||||
if (visit == InVisit)
|
||||
{
|
||||
ASSERT(IsInShaderStorageBlock(node->getLeft()));
|
||||
|
|
|
@ -53,7 +53,7 @@ constexpr StaticMangledName BuildStaticMangledName(TBasicType basicType,
|
|||
|
||||
// This "variable" contains the mangled names for every constexpr-generated TType.
|
||||
// If kMangledNameInstance<B, P, Q, PS, SS> is used anywhere (specifally
|
||||
// in instance, below), this is where the appropriate type will be stored.
|
||||
// in kInstance, below), this is where the appropriate type will be stored.
|
||||
template <TBasicType basicType,
|
||||
TPrecision precision,
|
||||
TQualifier qualifier,
|
||||
|
@ -67,18 +67,14 @@ static constexpr StaticMangledName kMangledNameInstance =
|
|||
//
|
||||
|
||||
// This "variable" contains every constexpr-generated TType.
|
||||
// If instance<B, P, Q, PS, SS> is used anywhere (specifally
|
||||
// If kInstance<B, P, Q, PS, SS> is used anywhere (specifally
|
||||
// in Get, below), this is where the appropriate type will be stored.
|
||||
//
|
||||
// TODO(crbug.com/981610): This is constexpr but doesn't follow the kConstant naming convention
|
||||
// because TType has a mutable member that prevents it from being in .data.rel.ro and makes the
|
||||
// Android Binary Size builder complain when ANGLE is rolled in Chromium.
|
||||
template <TBasicType basicType,
|
||||
TPrecision precision,
|
||||
TQualifier qualifier,
|
||||
unsigned char primarySize,
|
||||
unsigned char secondarySize>
|
||||
static constexpr TType instance =
|
||||
static constexpr TType kInstance =
|
||||
TType(basicType,
|
||||
precision,
|
||||
qualifier,
|
||||
|
@ -101,7 +97,7 @@ constexpr const TType *Get()
|
|||
{
|
||||
static_assert(1 <= primarySize && primarySize <= 4, "primarySize out of bounds");
|
||||
static_assert(1 <= secondarySize && secondarySize <= 4, "secondarySize out of bounds");
|
||||
return &Helpers::instance<basicType, precision, qualifier, primarySize, secondarySize>;
|
||||
return &Helpers::kInstance<basicType, precision, qualifier, primarySize, secondarySize>;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -115,7 +115,7 @@ void TStructure::createSamplerSymbols(const char *namePrefix,
|
|||
const TType *fieldType = field->type();
|
||||
if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
|
||||
{
|
||||
std::stringstream fieldName = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream fieldName;
|
||||
fieldName << namePrefix << "_" << field->name();
|
||||
TString fieldApiName = apiNamePrefix + ".";
|
||||
fieldApiName += field->name().data();
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "compiler/translator/ImmutableString.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/StaticType.h"
|
||||
#include "compiler/translator/util.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -197,7 +196,7 @@ void TSymbolTable::addInvariantVarying(const TVariable &variable)
|
|||
bool TSymbolTable::isVaryingInvariant(const TVariable &variable) const
|
||||
{
|
||||
ASSERT(atGlobalLevel());
|
||||
if (mGlobalInvariant && (IsShaderOutput(variable.getType().getQualifier())))
|
||||
if (mGlobalInvariant)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -252,32 +251,6 @@ const TSymbol *TSymbolTable::findGlobal(const ImmutableString &name) const
|
|||
return mTable[0]->find(name);
|
||||
}
|
||||
|
||||
const TSymbol *TSymbolTable::findGlobalWithConversion(
|
||||
const std::vector<ImmutableString> &names) const
|
||||
{
|
||||
const TSymbol *target;
|
||||
for (ImmutableString name : names)
|
||||
{
|
||||
target = findGlobal(name);
|
||||
if (target != nullptr)
|
||||
break;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
const TSymbol *TSymbolTable::findBuiltInWithConversion(const std::vector<ImmutableString> &names,
|
||||
int shaderVersion) const
|
||||
{
|
||||
const TSymbol *target;
|
||||
for (ImmutableString name : names)
|
||||
{
|
||||
target = findBuiltIn(name, shaderVersion);
|
||||
if (target != nullptr)
|
||||
break;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
bool TSymbolTable::declare(TSymbol *symbol)
|
||||
{
|
||||
ASSERT(!mTable.empty());
|
||||
|
@ -364,29 +337,20 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type,
|
|||
// We need just one precision stack level for predefined precisions.
|
||||
mPrecisionStack.emplace_back(new PrecisionStackLevel);
|
||||
|
||||
if (IsDesktopGLSpec(spec))
|
||||
switch (type)
|
||||
{
|
||||
setDefaultPrecision(EbtInt, EbpUndefined);
|
||||
setDefaultPrecision(EbtFloat, EbpUndefined);
|
||||
case GL_FRAGMENT_SHADER:
|
||||
setDefaultPrecision(EbtInt, EbpMedium);
|
||||
break;
|
||||
case GL_VERTEX_SHADER:
|
||||
case GL_COMPUTE_SHADER:
|
||||
case GL_GEOMETRY_SHADER_EXT:
|
||||
setDefaultPrecision(EbtInt, EbpHigh);
|
||||
setDefaultPrecision(EbtFloat, EbpHigh);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GL_FRAGMENT_SHADER:
|
||||
setDefaultPrecision(EbtInt, EbpMedium);
|
||||
break;
|
||||
case GL_VERTEX_SHADER:
|
||||
case GL_COMPUTE_SHADER:
|
||||
case GL_GEOMETRY_SHADER_EXT:
|
||||
setDefaultPrecision(EbtInt, EbpHigh);
|
||||
setDefaultPrecision(EbtFloat, EbpHigh);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
// Set defaults for sampler types that have default precision, even those that are
|
||||
// only available if an extension exists.
|
||||
// New sampler types in ESSL3 don't have default precision. ESSL1 types do.
|
||||
|
|
|
@ -116,11 +116,8 @@ class TSymbolTable : angle::NonCopyable, TSymbolTableBase
|
|||
TFunction *findUserDefinedFunction(const ImmutableString &name) const;
|
||||
|
||||
const TSymbol *findGlobal(const ImmutableString &name) const;
|
||||
const TSymbol *findGlobalWithConversion(const std::vector<ImmutableString> &names) const;
|
||||
|
||||
const TSymbol *findBuiltIn(const ImmutableString &name, int shaderVersion) const;
|
||||
const TSymbol *findBuiltInWithConversion(const std::vector<ImmutableString> &names,
|
||||
int shaderVersion) const;
|
||||
|
||||
void setDefaultPrecision(TBasicType type, TPrecision prec);
|
||||
|
||||
|
|
|
@ -524,12 +524,6 @@ constexpr const TSymbolUniqueId BuiltInId::texture2DLodEXT_Sampler2D1_Float2_Flo
|
|||
constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float3_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float4_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::textureCubeLodEXT_SamplerCube1_Float3_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3D_Sampler3D1_Float3;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3D_Sampler3D1_Float3_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3DProj_Sampler3D1_Float4;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3DProj_Sampler3D1_Float4_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3DLod_Sampler3D1_Float3_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture3DProjLod_Sampler3D1_Float4_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture2DLod_Sampler2D1_Float2_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float3_Float1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float4_Float1;
|
||||
|
@ -978,8 +972,6 @@ constexpr const TSymbolUniqueId BuiltInId::gl_ViewportIndex;
|
|||
constexpr const TSymbolUniqueId BuiltInId::gl_LayerVS;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_DrawID;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_DrawIDESSL1;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_BaseVertex;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_BaseInstance;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_NumWorkGroups;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupSize;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupID;
|
||||
|
@ -997,7 +989,7 @@ constexpr const TSymbolUniqueId BuiltInId::gl_PositionGS;
|
|||
constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVR;
|
||||
constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVRESSL1;
|
||||
|
||||
const int TSymbolTable::kLastBuiltInId = 1033;
|
||||
const int TSymbolTable::kLastBuiltInId = 1025;
|
||||
|
||||
namespace BuiltInName
|
||||
{
|
||||
|
@ -1084,8 +1076,6 @@ constexpr const ImmutableString frexp("frexp");
|
|||
constexpr const ImmutableString frexp_3B3C("frexp(3B3C");
|
||||
constexpr const ImmutableString fwidth("fwidth");
|
||||
constexpr const ImmutableString fwidthExt("fwidth");
|
||||
constexpr const ImmutableString gl_BaseInstance("gl_BaseInstance");
|
||||
constexpr const ImmutableString gl_BaseVertex("gl_BaseVertex");
|
||||
constexpr const ImmutableString gl_DepthRange("gl_DepthRange");
|
||||
constexpr const ImmutableString gl_DepthRangeParameters("gl_DepthRangeParameters");
|
||||
constexpr const ImmutableString gl_DrawID("gl_DrawID");
|
||||
|
@ -1283,12 +1273,6 @@ constexpr const ImmutableString texture2DProjLod_0H2B0B("texture2DProjLod(0H2B0B
|
|||
constexpr const ImmutableString texture2DProj_0H2B0B("texture2DProj(0H2B0B");
|
||||
constexpr const ImmutableString texture2DRect("texture2DRect");
|
||||
constexpr const ImmutableString texture2DRectProj("texture2DRectProj");
|
||||
constexpr const ImmutableString texture3D("texture3D");
|
||||
constexpr const ImmutableString texture3DLod("texture3DLod");
|
||||
constexpr const ImmutableString texture3DProj("texture3DProj");
|
||||
constexpr const ImmutableString texture3DProjLod("texture3DProjLod");
|
||||
constexpr const ImmutableString texture3DProj_0I3B0B("texture3DProj(0I3B0B");
|
||||
constexpr const ImmutableString texture3D_0I2B0B("texture3D(0I2B0B");
|
||||
constexpr const ImmutableString textureCube("textureCube");
|
||||
constexpr const ImmutableString textureCubeGradEXT("textureCubeGradEXT");
|
||||
constexpr const ImmutableString textureCubeGradEXT_0J2B2B2B("textureCubeGradEXT(0J2B2B2B");
|
||||
|
@ -1472,18 +1456,6 @@ constexpr const ImmutableString yuv_2_rgb("yuv_2_rgb");
|
|||
namespace BuiltInVariable
|
||||
{
|
||||
|
||||
constexpr const TVariable kVar_gl_BaseInstance(
|
||||
BuiltInId::gl_BaseInstance,
|
||||
BuiltInName::gl_BaseInstance,
|
||||
SymbolType::BuiltIn,
|
||||
TExtension::ANGLE_base_vertex_base_instance,
|
||||
StaticType::Get<EbtInt, EbpHigh, EvqBaseInstance, 1, 1>());
|
||||
constexpr const TVariable kVar_gl_BaseVertex(
|
||||
BuiltInId::gl_BaseVertex,
|
||||
BuiltInName::gl_BaseVertex,
|
||||
SymbolType::BuiltIn,
|
||||
TExtension::ANGLE_base_vertex_base_instance,
|
||||
StaticType::Get<EbtInt, EbpHigh, EvqBaseVertex, 1, 1>());
|
||||
constexpr const TVariable kVar_gl_DrawID(BuiltInId::gl_DrawID,
|
||||
BuiltInName::gl_DrawID,
|
||||
SymbolType::BuiltIn,
|
||||
|
@ -1631,13 +1603,13 @@ constexpr const TVariable kVar_gl_ViewID_OVR(
|
|||
BuiltInId::gl_ViewID_OVR,
|
||||
BuiltInName::gl_ViewID_OVR,
|
||||
SymbolType::BuiltIn,
|
||||
TExtension::UNDEFINED,
|
||||
TExtension::OVR_multiview2,
|
||||
StaticType::Get<EbtUInt, EbpHigh, EvqViewIDOVR, 1, 1>());
|
||||
constexpr const TVariable kVar_gl_ViewID_OVRESSL1(
|
||||
BuiltInId::gl_ViewID_OVRESSL1,
|
||||
BuiltInName::gl_ViewID_OVR,
|
||||
SymbolType::BuiltIn,
|
||||
TExtension::UNDEFINED,
|
||||
TExtension::OVR_multiview2,
|
||||
StaticType::Get<EbtInt, EbpHigh, EvqViewIDOVR, 1, 1>());
|
||||
constexpr const TVariable kVar_gl_ViewportIndex(
|
||||
BuiltInId::gl_ViewportIndex,
|
||||
|
@ -2072,16 +2044,6 @@ constexpr const TVariable kVar_pt_o_3D(BuiltInId::pt_o_3D,
|
|||
TExtension::UNDEFINED,
|
||||
StaticType::Get<EbtUInt, EbpUndefined, EvqOut, 4, 1>());
|
||||
|
||||
const TVariable *gl_BaseInstance()
|
||||
{
|
||||
return &kVar_gl_BaseInstance;
|
||||
}
|
||||
|
||||
const TVariable *gl_BaseVertex()
|
||||
{
|
||||
return &kVar_gl_BaseVertex;
|
||||
}
|
||||
|
||||
const TVariable *gl_DrawID()
|
||||
{
|
||||
return &kVar_gl_DrawID;
|
||||
|
@ -2758,7 +2720,6 @@ constexpr const UnmangledBuiltIn EXT_YUV_target(TExtension::EXT_YUV_target);
|
|||
constexpr const UnmangledBuiltIn EXT_geometry_shader(TExtension::EXT_geometry_shader);
|
||||
constexpr const UnmangledBuiltIn EXT_shader_texture_lod(TExtension::EXT_shader_texture_lod);
|
||||
constexpr const UnmangledBuiltIn OES_standard_derivatives(TExtension::OES_standard_derivatives);
|
||||
constexpr const UnmangledBuiltIn OES_texture_3D(TExtension::OES_texture_3D);
|
||||
constexpr const UnmangledBuiltIn UNDEFINED(TExtension::UNDEFINED);
|
||||
|
||||
} // namespace UnmangledBuiltIns
|
||||
|
@ -7274,60 +7235,6 @@ constexpr const TFunction kFunction_textureCubeLodEXT_0J2B0B(
|
|||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3D_0I2B(
|
||||
BuiltInId::texture3D_Sampler3D1_Float3,
|
||||
BuiltInName::texture3D,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I2B0B2C,
|
||||
2,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3D_0I2B0B(
|
||||
BuiltInId::texture3D_Sampler3D1_Float3_Float1,
|
||||
BuiltInName::texture3D,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I2B0B2C,
|
||||
3,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3DProj_0I3B(
|
||||
BuiltInId::texture3DProj_Sampler3D1_Float4,
|
||||
BuiltInName::texture3DProj,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I3B2C0B,
|
||||
2,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3DProj_0I3B0B(
|
||||
BuiltInId::texture3DProj_Sampler3D1_Float4_Float1,
|
||||
BuiltInName::texture3DProj,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I3B0B2C,
|
||||
3,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3DLod_0I2B0B(
|
||||
BuiltInId::texture3DLod_Sampler3D1_Float3_Float1,
|
||||
BuiltInName::texture3DLod,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I2B0B2C,
|
||||
3,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture3DProjLod_0I3B0B(
|
||||
BuiltInId::texture3DProjLod_Sampler3D1_Float4_Float1,
|
||||
BuiltInName::texture3DProjLod,
|
||||
TExtension::OES_texture_3D,
|
||||
BuiltInParameters::p0I3B0B2C,
|
||||
3,
|
||||
StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
false);
|
||||
constexpr const TFunction kFunction_texture2DLod_0H1B0B(
|
||||
BuiltInId::texture2DLod_Sampler2D1_Float2_Float1,
|
||||
BuiltInName::texture2DLod,
|
||||
|
@ -7440,7 +7347,7 @@ constexpr const TFunction kFunction_texture_0Y2B(
|
|||
BuiltInId::texture_USamplerCube1_Float3,
|
||||
BuiltInName::texture,
|
||||
TExtension::UNDEFINED,
|
||||
BuiltInParameters::p0Y2B2B2B,
|
||||
BuiltInParameters::p0Y2B0B,
|
||||
2,
|
||||
StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
|
@ -9717,7 +9624,7 @@ constexpr const TFunction kFunction_textureGather_0Y2B(
|
|||
BuiltInId::textureGather_USamplerCube1_Float3,
|
||||
BuiltInName::textureGather,
|
||||
TExtension::UNDEFINED,
|
||||
BuiltInParameters::p0Y2B2B2B,
|
||||
BuiltInParameters::p0Y2B0B,
|
||||
2,
|
||||
StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
|
||||
EOpCallBuiltInFunction,
|
||||
|
@ -16899,30 +16806,7 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((mShaderType == GL_VERTEX_SHADER) && (mResources.ANGLE_base_vertex_base_instance))
|
||||
{
|
||||
switch (nameHash)
|
||||
{
|
||||
case 0x7e695e00u:
|
||||
{
|
||||
if (name == BuiltInName::gl_BaseVertex)
|
||||
{
|
||||
return &BuiltInVariable::kVar_gl_BaseVertex;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e785b75u:
|
||||
{
|
||||
if (name == BuiltInName::gl_BaseInstance)
|
||||
{
|
||||
return &BuiltInVariable::kVar_gl_BaseInstance;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
|
||||
mShaderType != GL_COMPUTE_SHADER)
|
||||
if (mResources.OVR_multiview2 && mShaderType != GL_COMPUTE_SHADER)
|
||||
{
|
||||
switch (nameHash)
|
||||
{
|
||||
|
@ -17213,23 +17097,6 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x12764e24u:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture3D))
|
||||
{
|
||||
ASSERT(name.length() == 14);
|
||||
return &BuiltInFunction::kFunction_texture3D_0I2B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x12810dc6u:
|
||||
{
|
||||
if (name == BuiltInName::texture3D_0I2B0B)
|
||||
{
|
||||
return &BuiltInFunction::kFunction_texture3D_0I2B0B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x12846ba6u:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture2D))
|
||||
|
@ -17248,24 +17115,6 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x189e8416u:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture3DLod))
|
||||
{
|
||||
ASSERT(name.length() == 19);
|
||||
return &BuiltInFunction::kFunction_texture3DLod_0I2B0B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x1a93312fu:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture3DProj))
|
||||
{
|
||||
ASSERT(name.length() == 18);
|
||||
return &BuiltInFunction::kFunction_texture3DProj_0I3B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x1aa197a7u:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture2DProj))
|
||||
|
@ -17283,14 +17132,6 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x1aa7eecdu:
|
||||
{
|
||||
if (name == BuiltInName::texture3DProj_0I3B0B)
|
||||
{
|
||||
return &BuiltInFunction::kFunction_texture3DProj_0I3B0B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x1eb43b6cu:
|
||||
{
|
||||
if (name == BuiltInName::texture2DLodEXT_0H1B0B)
|
||||
|
@ -17299,15 +17140,6 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x20b9ceecu:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::texture3DProjLod))
|
||||
{
|
||||
ASSERT(name.length() == 23);
|
||||
return &BuiltInFunction::kFunction_texture3DProjLod_0I3B0B;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x22c206a5u:
|
||||
{
|
||||
if (name.beginsWith(BuiltInName::textureCubeLodEXT))
|
||||
|
@ -17464,8 +17296,7 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
|
||||
mShaderType != GL_COMPUTE_SHADER)
|
||||
if (mResources.OVR_multiview2 && mShaderType != GL_COMPUTE_SHADER)
|
||||
{
|
||||
switch (nameHash)
|
||||
{
|
||||
|
@ -20501,30 +20332,6 @@ const UnmangledBuiltIn *TSymbolTable::getUnmangledBuiltInForShaderVersion(
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e4db1c8u:
|
||||
{
|
||||
if (name == BuiltInName::texture3D)
|
||||
{
|
||||
return &UnmangledBuiltIns::OES_texture_3D;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e63c1d1u:
|
||||
{
|
||||
if (name == BuiltInName::texture3DLod)
|
||||
{
|
||||
return &UnmangledBuiltIns::OES_texture_3D;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e687e40u:
|
||||
{
|
||||
if (name == BuiltInName::texture3DProj)
|
||||
{
|
||||
return &UnmangledBuiltIns::OES_texture_3D;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e7b843eu:
|
||||
{
|
||||
if (name == BuiltInName::texture2DLodEXT)
|
||||
|
@ -20533,14 +20340,6 @@ const UnmangledBuiltIn *TSymbolTable::getUnmangledBuiltInForShaderVersion(
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e85692eu:
|
||||
{
|
||||
if (name == BuiltInName::texture3DProjLod)
|
||||
{
|
||||
return &UnmangledBuiltIns::OES_texture_3D;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x7e8b81cau:
|
||||
{
|
||||
if (name == BuiltInName::textureCubeLodEXT)
|
||||
|
|
|
@ -602,23 +602,12 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
const ImmutableString &textureReference,
|
||||
ImmutableString *texCoordX,
|
||||
ImmutableString *texCoordY,
|
||||
ImmutableString *texCoordZ,
|
||||
bool getDimensionsIgnoresBaseLevel)
|
||||
ImmutableString *texCoordZ)
|
||||
{
|
||||
if (!IsIntegerSampler(textureFunction.sampler))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getDimensionsIgnoresBaseLevel)
|
||||
{
|
||||
out << " int baseLevel = samplerMetadata[samplerIndex].baseLevel;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << " int baseLevel = 0;\n";
|
||||
}
|
||||
|
||||
if (IsSamplerCube(textureFunction.sampler))
|
||||
{
|
||||
out << " float width; float height; float layers; float levels;\n";
|
||||
|
@ -626,10 +615,10 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
out << " uint mip = 0;\n";
|
||||
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel + mip, width, height, layers, levels);\n";
|
||||
<< ".GetDimensions(mip, width, height, layers, levels);\n";
|
||||
|
||||
out << " bool xMajor = abs(t.x) >= abs(t.y) && abs(t.x) >= abs(t.z);\n";
|
||||
out << " bool yMajor = abs(t.y) >= abs(t.z) && abs(t.y) > abs(t.x);\n";
|
||||
out << " bool xMajor = abs(t.x) > abs(t.y) && abs(t.x) > abs(t.z);\n";
|
||||
out << " bool yMajor = abs(t.y) > abs(t.z) && abs(t.y) > abs(t.x);\n";
|
||||
out << " bool zMajor = abs(t.z) > abs(t.x) && abs(t.z) > abs(t.y);\n";
|
||||
out << " bool negative = (xMajor && t.x < 0.0f) || (yMajor && t.y < 0.0f) || "
|
||||
"(zMajor && t.z < 0.0f);\n";
|
||||
|
@ -646,7 +635,6 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
out << " float v = yMajor ? t.z : (negative ? t.y : -t.y);\n";
|
||||
out << " float m = xMajor ? t.x : (yMajor ? t.y : t.z);\n";
|
||||
|
||||
out << " float3 r = any(t) ? t : float3(1, 0, 0);\n";
|
||||
out << " t.x = (u * 0.5f / m) + 0.5f;\n";
|
||||
out << " t.y = (v * 0.5f / m) + 0.5f;\n";
|
||||
|
||||
|
@ -657,76 +645,10 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
{
|
||||
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT)
|
||||
{
|
||||
// We would like to calculate tha maximum of how many texels we move in the major
|
||||
// face's texture as we move across the screen in any direction. Namely, we want the
|
||||
// length of the directional derivative of the function p (defined below), maximized
|
||||
// over screen space directions. (For short: we want the norm of Dp.) For
|
||||
// simplicity, assume that z-axis is the major axis. By symmetry, we can assume that
|
||||
// the positive z direction is major. (The calculated value will be the same even if
|
||||
// this is false.) Let r denote the function from screen position to cube texture
|
||||
// coordinates. Then p can be written as p = s . P . r, where P(r) = (r.x, r.y)/r.z
|
||||
// is the projection onto the major cube face, and s = diag(width, height)/2. (s
|
||||
// linearly maps from the cube face into texture space, so that p(r) is in units of
|
||||
// texels.) The derivative is
|
||||
// Dp(r) = s |1 0 -r.x/r.z|
|
||||
// |0 1 -r.y/r.z| |ddx(r) ddy(r)| / r.z
|
||||
// = |dot(a, ddx(r)) dot(a, ddy(r))|
|
||||
// |dot(b, ddx(r)) dot(b, ddy(r))| / (2 r.z)
|
||||
// where a = w * vec3(1, 0, -r.x/r.z)
|
||||
// b = h * vec3(0, 1, -r.y/r.z)
|
||||
// We would like to know max(L(x)) over unit vectors x, where L(x) = |Dp(r) x|^2.
|
||||
// Since ddx(r) and ddy(r) are unknown, the best we can do is to sample L in some
|
||||
// directions and take the maximum across the samples.
|
||||
//
|
||||
// Some implementations use max(L(n1), L(n2)) where n1 = vec2(1,0) and n2 =
|
||||
// vec2(0,1).
|
||||
//
|
||||
// Some implementations use max(L(n1), L(n2), L(n3), L(n4)),
|
||||
// where n3 = (n1 + n2) / |n1 + n2| = (n1 + n2)/sqrt(2)
|
||||
// n4 = (n1 - n2) / |n1 - n2| = (n1 - n2)/sqrt(2).
|
||||
// In other words, two samples along the diagonal screen space directions have been
|
||||
// added, giving a strictly better estimate of the true maximum.
|
||||
//
|
||||
// It turns out we can get twice the sample count very cheaply.
|
||||
// We can use the linearity of Dp(r) to get these extra samples of L cheaply in
|
||||
// terms of the already taken samples, L(n1) and L(n2):
|
||||
// Denoting
|
||||
// dpx = Dp(r)n1
|
||||
// dpy = Dp(r)n2
|
||||
// dpxx = dot(dpx, dpx)
|
||||
// dpyy = dot(dpy, dpy)
|
||||
// dpxy = dot(dpx, dpy)
|
||||
// we obtain
|
||||
// L(n3) = |Dp(r)n1 + Dp(r)n2|^2/2 = (dpxx + dpyy)/2 + dpxy
|
||||
// L(n4) = |Dp(r)n1 - Dp(r)n2|^2/2 = (dpxx + dpyy)/2 - dpxy
|
||||
// max(L(n1), L(n2), L(n3), L(n4))
|
||||
// = max(max(L(n1), L(n2)), max(L(n3), L(n4)))
|
||||
// = max(max(dpxx, dpyy), (dpxx + dpyy)/2 + abs(dpxy))
|
||||
// So the extra cost is: one dot, one abs, one add, one multiply-add and one max.
|
||||
// (All scalar.)
|
||||
//
|
||||
// In section 3.8.10.1, the OpenGL ES 3 specification defines the "scale factor",
|
||||
// rho. In our terminology, this definition works out to taking sqrt(max(L(n1),
|
||||
// L(n2))). Some implementations will use this estimate, here we use the strictly
|
||||
// better sqrt(max(L(n1), L(n2), L(n3), L(n4))), since it's not much more expensive
|
||||
// to calculate.
|
||||
|
||||
// Swap coordinates such that we can assume that the positive z-axis is major, in
|
||||
// what follows.
|
||||
out << " float3 ddxr = xMajor ? ddx(r).yzx : yMajor ? ddx(r).zxy : ddx(r).xyz;\n"
|
||||
" float3 ddyr = xMajor ? ddy(r).yzx : yMajor ? ddy(r).zxy : ddy(r).xyz;\n"
|
||||
" r = xMajor ? r.yzx : yMajor ? r.zxy : r.xyz;\n";
|
||||
|
||||
out << " float2 s = 0.5*float2(width, height);\n"
|
||||
" float2 dpx = s * (ddxr.xy - ddxr.z*r.xy/r.z)/r.z;\n"
|
||||
" float2 dpy = s * (ddyr.xy - ddyr.z*r.xy/r.z)/r.z;\n"
|
||||
" float dpxx = dot(dpx, dpx);\n;"
|
||||
" float dpyy = dot(dpy, dpy);\n;"
|
||||
" float dpxy = dot(dpx, dpy);\n"
|
||||
" float ma = max(dpxx, dpyy);\n"
|
||||
" float mb = 0.5 * (dpxx + dpyy) + abs(dpxy);\n"
|
||||
" float mab = max(ma, mb);\n"
|
||||
" float lod = 0.5f * log2(mab);\n";
|
||||
out << " float2 tSized = float2(t.x * width, t.y * height);\n"
|
||||
" float2 dx = ddx(tSized);\n"
|
||||
" float2 dy = ddy(tSized);\n"
|
||||
" float lod = 0.5f * log2(max(dot(dx, dx), dot(dy, dy)));\n";
|
||||
}
|
||||
else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
|
||||
{
|
||||
|
@ -764,7 +686,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
}
|
||||
out << " mip = uint(min(max(round(lod), 0), levels - 1));\n"
|
||||
<< " " << textureReference
|
||||
<< ".GetDimensions(baseLevel + mip, width, height, layers, levels);\n";
|
||||
<< ".GetDimensions(mip, width, height, layers, levels);\n";
|
||||
}
|
||||
|
||||
// Convert from normalized floating-point to integer
|
||||
|
@ -786,6 +708,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
if (IsSamplerArray(textureFunction.sampler))
|
||||
{
|
||||
out << " float width; float height; float layers; float levels;\n";
|
||||
|
||||
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0)
|
||||
{
|
||||
out << " uint mip = 0;\n";
|
||||
|
@ -798,7 +721,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
{
|
||||
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel, width, height, layers, levels);\n";
|
||||
<< ".GetDimensions(0, width, height, layers, levels);\n";
|
||||
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
|
||||
textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
|
||||
{
|
||||
|
@ -825,7 +748,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
}
|
||||
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel + mip, width, height, layers, levels);\n";
|
||||
<< ".GetDimensions(mip, width, height, layers, levels);\n";
|
||||
}
|
||||
else if (IsSampler2D(textureFunction.sampler))
|
||||
{
|
||||
|
@ -841,8 +764,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
}
|
||||
else
|
||||
{
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel, width, height, levels);\n";
|
||||
out << " " << textureReference << ".GetDimensions(0, width, height, levels);\n";
|
||||
|
||||
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
|
||||
textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
|
||||
|
@ -869,8 +791,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
|
||||
}
|
||||
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel + mip, width, height, levels);\n";
|
||||
out << " " << textureReference << ".GetDimensions(mip, width, height, levels);\n";
|
||||
}
|
||||
else if (IsSampler3D(textureFunction.sampler))
|
||||
{
|
||||
|
@ -887,7 +808,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
else
|
||||
{
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel, width, height, depth, levels);\n";
|
||||
<< ".GetDimensions(0, width, height, depth, levels);\n";
|
||||
|
||||
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
|
||||
textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
|
||||
|
@ -915,7 +836,7 @@ void OutputIntegerTextureSampleFunctionComputations(
|
|||
}
|
||||
|
||||
out << " " << textureReference
|
||||
<< ".GetDimensions(baseLevel + mip, width, height, depth, levels);\n";
|
||||
<< ".GetDimensions(mip, width, height, depth, levels);\n";
|
||||
}
|
||||
else
|
||||
UNREACHABLE();
|
||||
|
@ -1537,9 +1458,9 @@ void TextureFunctionHLSL::textureFunctionHeader(TInfoSinkBase &out,
|
|||
else
|
||||
{
|
||||
ProjectTextureCoordinates(textureFunction, &texCoordX, &texCoordY, &texCoordZ);
|
||||
OutputIntegerTextureSampleFunctionComputations(
|
||||
out, textureFunction, outputType, textureReference, &texCoordX, &texCoordY,
|
||||
&texCoordZ, getDimensionsIgnoresBaseLevel);
|
||||
OutputIntegerTextureSampleFunctionComputations(out, textureFunction, outputType,
|
||||
textureReference, &texCoordX,
|
||||
&texCoordY, &texCoordZ);
|
||||
OutputTextureSampleFunctionReturnStatement(out, textureFunction, outputType,
|
||||
textureReference, samplerReference,
|
||||
texCoordX, texCoordY, texCoordZ);
|
||||
|
|
|
@ -84,9 +84,11 @@ void TranslatorESSL::translate(TIntermBlock *root,
|
|||
// Write array bounds clamping emulation if needed.
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
||||
if (getShaderType() == GL_COMPUTE_SHADER)
|
||||
if (getShaderType() == GL_COMPUTE_SHADER && isComputeShaderLocalSizeDeclared())
|
||||
{
|
||||
EmitWorkGroupSizeGLSL(*this, sink);
|
||||
const sh::WorkGroupSize &localSize = getComputeShaderLocalSize();
|
||||
sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
|
||||
<< ", local_size_z=" << localSize[2] << ") in;\n";
|
||||
}
|
||||
|
||||
if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
|
||||
|
@ -127,8 +129,7 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
|
|||
{
|
||||
if (iter->second != EBhUndefined)
|
||||
{
|
||||
const bool isMultiview = (iter->first == TExtension::OVR_multiview) ||
|
||||
(iter->first == TExtension::OVR_multiview2);
|
||||
const bool isMultiview = (iter->first == TExtension::OVR_multiview2);
|
||||
if (getResources().NV_shader_framebuffer_fetch &&
|
||||
iter->first == TExtension::EXT_shader_framebuffer_fetch)
|
||||
{
|
||||
|
@ -166,12 +167,6 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
|
|||
ASSERT((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0);
|
||||
continue;
|
||||
}
|
||||
else if (iter->first == TExtension::ANGLE_base_vertex_base_instance)
|
||||
{
|
||||
// Don't emit anything. This extension is emulated
|
||||
ASSERT((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
sink << "#extension " << GetExtensionNameString(iter->first) << " : "
|
||||
|
|
|
@ -194,9 +194,11 @@ void TranslatorGLSL::translate(TIntermBlock *root,
|
|||
}
|
||||
}
|
||||
|
||||
if (getShaderType() == GL_COMPUTE_SHADER)
|
||||
if (getShaderType() == GL_COMPUTE_SHADER && isComputeShaderLocalSizeDeclared())
|
||||
{
|
||||
EmitWorkGroupSizeGLSL(*this, sink);
|
||||
const sh::WorkGroupSize &localSize = getComputeShaderLocalSize();
|
||||
sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
|
||||
<< ", local_size_z=" << localSize[2] << ") in;\n";
|
||||
}
|
||||
|
||||
if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
|
||||
|
@ -275,8 +277,7 @@ void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root, ShCompileOptions
|
|||
}
|
||||
}
|
||||
|
||||
const bool isMultiview =
|
||||
(iter.first == TExtension::OVR_multiview) || (iter.first == TExtension::OVR_multiview2);
|
||||
const bool isMultiview = (iter.first == TExtension::OVR_multiview2);
|
||||
if (isMultiview)
|
||||
{
|
||||
EmitMultiviewGLSL(*this, compileOptions, iter.second, sink);
|
||||
|
|
|
@ -756,7 +756,7 @@ void TType::createSamplerSymbols(const ImmutableString &namePrefix,
|
|||
elementType.toArrayElementType();
|
||||
for (unsigned int arrayIndex = 0u; arrayIndex < getOutermostArraySize(); ++arrayIndex)
|
||||
{
|
||||
std::stringstream elementName = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream elementName;
|
||||
elementName << namePrefix << "_" << arrayIndex;
|
||||
TStringStream elementApiName;
|
||||
elementApiName << apiNamePrefix << "[" << arrayIndex << "]";
|
||||
|
|
|
@ -329,7 +329,6 @@ class TType
|
|||
void realize();
|
||||
|
||||
bool isSampler() const { return IsSampler(type); }
|
||||
bool isAtomicCounter() const { return IsAtomicCounter(type); }
|
||||
|
||||
private:
|
||||
void invalidateMangledName();
|
||||
|
|
|
@ -119,7 +119,7 @@ void ValidateOutputsTraverser::validate(TDiagnostics *diagnostics) const
|
|||
const size_t offsetLocation = location + elementIndex;
|
||||
if ((*validOutputsToUse)[offsetLocation])
|
||||
{
|
||||
std::stringstream strstr = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream strstr;
|
||||
strstr << "conflicting output locations with previously defined output '"
|
||||
<< (*validOutputsToUse)[offsetLocation]->getName() << "'";
|
||||
error(*symbol, strstr.str().c_str(), diagnostics);
|
||||
|
|
|
@ -83,7 +83,7 @@ void ValidateShaderInterface(TDiagnostics *diagnostics,
|
|||
const int offsetLocation = location + elementIndex;
|
||||
if (locationMap.find(offsetLocation) != locationMap.end())
|
||||
{
|
||||
std::stringstream strstr = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream strstr;
|
||||
strstr << "'" << varying->getName()
|
||||
<< "' conflicting location with previously defined '"
|
||||
<< locationMap[offsetLocation]->getName() << "'";
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "common/mathutil.h"
|
||||
#include "common/utilities.h"
|
||||
#include "compiler/translator/Common.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -133,7 +132,7 @@ void TraverseArrayOfArraysVariable(const ShaderVariable &variable,
|
|||
|
||||
std::string CollapseNameStack(const std::vector<std::string> &nameStack)
|
||||
{
|
||||
std::stringstream strstr = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream strstr;
|
||||
for (const std::string &part : nameStack)
|
||||
{
|
||||
strstr << part;
|
||||
|
@ -416,7 +415,7 @@ void VariableNameVisitor::exitArray(const ShaderVariable &arrayVar)
|
|||
void VariableNameVisitor::enterArrayElement(const ShaderVariable &arrayVar,
|
||||
unsigned int arrayElement)
|
||||
{
|
||||
std::stringstream strstr = sh::InitializeStream<std::stringstream>();
|
||||
std::stringstream strstr;
|
||||
strstr << "[" << arrayElement << "]";
|
||||
std::string elementString = strstr.str();
|
||||
mNameStack.push_back(elementString);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче