src/compiler/translator/util.cpp


Log

Author Commit Date CI Message
Yuly Novikov 5dd05578 2025-04-14T07:34:57 Revert "GL: Allow untranslated shaders to pass through on GLES" This reverts commit 4e77552b86a89b449ada6d6c18f84285f5812b1d. Reason for revert: breaks ChromeOS and fuzzers Bug: angleproject:398857482 Original change's description: > GL: Allow untranslated shaders to pass through on GLES > > Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which > uses the NULL translator and passes the original shader to the driver. > The parser is still used for shader reflection. > > Bug: angleproject:398857482 > Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: angleproject:398857482, angleproject:410423936 Bug: chromium:410114655, chromium:410100607, chromium:410121218 Bug: chromium:410052365, chromium:410290507, chromium:410178288 No-Presubmit: true Change-Id: I45b01960637a1cda05d21a7df6d07465f6a8f5e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6448984 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 4e77552b 2025-02-24T18:04:32 GL: Allow untranslated shaders to pass through on GLES Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which uses the NULL translator and passes the original shader to the driver. The parser is still used for shader reflection. Bug: angleproject:398857482 Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cody Northrop d27a1fd0 2025-04-03T19:59:20 Compiler: Allow denorm float values in the lexer This adds an option to preserve denorm values in the lexer, skipping the explicit zero conversions for below range floats. There are applications in the wild that expect to be able to use denorm float values. They are typically immediately converted to integer values, not used in floating point operations. The option is only enabled for Vulkan backends. Test: FloatLexTest, DenormFloatsToIntValues, app traces Bug: b/406827038 Change-Id: Iab5a1a69a540b78ccbce8ea90b532d2d4976e29e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6432237 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Kimmo Kinnunen 0cfea380 2025-01-15T10:46:54 Rename sh::TSpan as general purpose angle::Span Span abstraction is useful for making buffer manipulation more consistent. The commit makes the Span available to all code until std::span can be used. Bug: angleproject:389951202 Change-Id: Id0c6b54bb6e75d3cc4e85af854d9e61b66906752 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6170997 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen b8d546b2 2024-10-30T15:40:58 Fix immutable string concats with ints `BuildConcatenatedImmutableString("a", 10, "b")` would construct "a\nb" because the implementation lacked int overloads and ints would be promoted to chars implicitly. Fix by implementing simpler way to calculate digits for numbers and then add useful overloads. Remove ImmutableStringBuilder::appendDecimal() since the code is already expecting << for all other types, and the bug was due to this expectation. Bug: angleproject:376417347 Change-Id: Iea5e14a6e2fede068b704754b9203db794dd5bf0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5972641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Alexey Knyazev 2f644ed8 2024-10-16T00:00:00 Implement NULL translator output Fixed: angleproject:373818287 Change-Id: If862e8e66a043ef968daea91d95717af97e3a0de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5937827 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a8138547 2024-10-09T23:33:24 Translator: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I46ce6d75a76bdf04a9e8feea1a480e8a0badba2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5924140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Rafael Cintron d1a4b0ff 2019-05-04T17:15:42 Remove Feature Level 9_3 code Feature Level 9_3 was originally added for developers creating apps for devices which did not have the DirectX 9 API and are no longer supported. Hence, we can remove the corresponding code in the 11 backend. Bug: angleproject:355462523 Change-Id: I22db15640b435c61db4d82a815edbc65cecc4e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5824661 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 67fc293a 2024-04-05T13:25:12 WebGPU: Add shader translation and program linking stubs. Add a TranslatorWGSL which outputs the same translated shaders every time. Implement the compile and link tasks. Bug: angleproject:8662 Change-Id: I62bbd6c528e1d671d0f4becc38f15f1eceb0336c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5428807 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Kimmo Kinnunen 18fa02be 2024-03-12T10:23:55 Rewrite exprs using separated decl variables Rewrite expressions that use the rewritten struct declaration variables. Declaration that specfies a struct and defines multiple variables will get its variable declarations separated. The type of the variable changes when a struct specifier is removed for the second and rest of the variable declarations. The type of the variable changes also when a anonymous struct is named. The expressions that used the separated variables used the old struct as their types. Fix by using TIntermRebuild. Upon creating a new symbol node referencing the new type, the rebuilder will instantiate also all the needed intermediate nodes, which then get the correct struct type. For consistency, fix the case of anonymous struct -> named struct transform naming the variables similar to named struct separation. Consider base case: struct S { .. } a, b; -> struct S { .. } a; S b; Compare against case: struct { .. } a, b; Before, inconsistency: struct s1 { .. }; s1 a; s1 b; After, fixed: struct s1 { .. } a; s1 b; Bug: angleproject:8590 Change-Id: Iffb0ef4441d6021e076b04485b808b26a7fa4dcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5365201 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Stephen White 3892ac14 2023-10-12T13:35:33 Do not flush normal float constants to zero. It's ok to flush denormalized constants to zero. It's not ok to flush perfectly valid normal float constants >= FLT_MIN to zero. Two problems: 1) Values when parsed as doubles with a value less than FLT_MIN are being flushed to zero. This is incorrect when the comparison is done in double, since some values below FLT_MIN in double are equal to FLT_MIN when cast to float. The fix is to perform the comparison in float. 2) Values with a decimal exponent less than FLT_MIN_10_EXP are being flushed to zero. FLT_MIN_10_EXP is -37 but FLT_MIN is 1.1754943E-38. 10^-37 may be the "minimum negative integer such that 10 raised to that power is a normalized float", but being constrained to powers of ten it's above FLT_MIN (which is 2^-126). Since this comparison is done before #1 above, it's only present (AFAIK) to ensure that the exponent will not make the pow() function overflow. Comparing against -38 (FLT_MIN_10_EXP - 1) instead will do the trick. Bug: angleproject:8373, dawn:2077 Change-Id: I1ddf410c2caa9f0d1ba3529ace693dcd326a2cb3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4936714 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Jonah Ryan-Davis 280e79e1 2023-08-10T14:08:00 Rescope globals only used in one function to function-local. We can demote global variables when they are only used in one function. This has performance implications on Metal. Bug: angleproject:8311 Change-Id: Id666e6b167be771c14768cd73efa61fdacd897d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4771215 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 5032f08b 2023-07-13T15:23:49 Translator: Unconditionally limit variable sizes ... instead of just for WebGL. This is to avoid hitting driver bugs that were prevented with this check for WebGL on a compromised renderer that can create non-WebGL contexts. Bug: chromium:1464682 Change-Id: I47a9d9690bd1ca9d701391fb7d70932f2dbe7334 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4685307 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 9b63700b 2023-07-11T10:25:40 Translator: Reorganize files This change makes the translator files more organized by: - Grouping files that are specific to a certain output under their own directory, - Moving transformations under tree_ops - Removing Direct from metal translation now that that SPIR-V Cross path is removed Bug: angleproject:6394 Change-Id: Iaf5bb8d5604b84748dece029821b1f77b2813967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678780 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 1ee27fcd 2023-03-24T00:00:00 Fix translation of noperspective interpolation qualifier Auxiliary storage qualifiers used with 'noperspective' interpolation must be retained during ESSL translation * Added new qualifiers: * EvqNoPerspectiveCentroid * EvqNoPerspectiveCentroidIn * EvqNoPerspectiveCentroidOut * EvqNoPerspectiveSample * EvqNoPerspectiveSampleIn * EvqNoPerspectiveSampleOut * Adjusted GLSL and SPIR-V output * Adjusted 'sample' rank to be the same as 'centroid' Fixed: angleproject:4388 Change-Id: Iffc80a7a3b057beffd3bcbbc9446eeed77183c99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4368471 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev ad52f12e 2023-03-21T00:00:00 Implement EXT_conservative_depth Added translator frontend and GLSL backend support for gl_FragDepth redeclaration and layout qualifiers. Added mappings to DepthGreater, DepthLess, and DepthUnchanged SPIR-V execution modes. Bug: angleproject:8046 Change-Id: I23f19ff54380741107970a44055ea269eef179f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4355028 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sean Risser b96d1955 2023-01-20T16:06:34 Implement GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch allows fragment shaders to read gl_LastFragColorARM. The extension is similar to GL_EXT_shader_framebuffer_fetch, but is more limited in its capabilities. GL_ARM_shader_framebuffer_fetch was removed from HasFramebufferFetch() because it acts differently from GL_EXT_shader_framebuffer_fetch in significant enough ways that it should not be included in that single-use function. Tests: FramebufferFetchES31.*_ARM Bug: b/242419750 Bug: angleproject:7882 Change-Id: Id3a25c8ee50ca3e2a4c30a2261f507b0b53511ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4083108 Commit-Queue: Sean Risser <srisser@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 5b218196 2022-11-06T11:39:23 Metal: Remove compilation through SPIR-V Direct metal generation is stable. Bug: angleproject:6081 Change-Id: If9e76f61ad38f2fc9963f0181dfd03c99ffa3e2b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4003675 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton b5514bb2 2022-09-21T20:47:00 Support pixel local storage on ES 3.0 Now that the application-facing API is implemented, we don't have to rely on ES 3.1 anymore. Expose and test the extension on ES 3.0. Bug: angleproject:7279 Change-Id: I5635620b9088201c20bafd283813092a329225d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3915327 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton c460c299 2022-06-21T11:20:45 Implement GLSL additions for ANGLE_shader_pixel_local_storage Specs out, implements, and thoroughly tests the GLSL additions for ANGLE_shader_pixel_local_storage. Adds a simple transformation that rewrites PLS directly into shader images. Updates the existing PLS tests to use the newly built-in PLS features and ensures they continue passing. For now, applications call glBindImageTexture to configure their pixel local storage. The OpenGL ES API side of this extension will follow shortly. Bug: angleproject:7279 Change-Id: I141183069b5cbfcca01cbb77b5b36d3e5f834bf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3761876 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Faye Zhang c608df69 2022-05-23T17:19:02 Code Cleanup In Debug.h, we unconditionally set UNREACHABLE_IS_NORETURN to 0. Since UNREACHABLE_IS_NORETURN is only used in #if directives and it is always false, we can remove all uses of UNREACHABLE_IS_NORETURN. Bug: angleproject:6134 Change-Id: I3aa88d802099d70990eae697d4f056a3f650b48d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3661376 Commit-Queue: Faye Zhang <ffz@google.com> Auto-Submit: Faye Zhang <ffz@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Faye Zhang <ffz@google.com>
Brandon Schade aadc6434 2022-01-24T18:28:19 Vulkan: Fix to correctly redefine gl_PerVertex in GS Angle translator structures were inconsistent of data lookup of gl_PerVertex data when it is user defined. Bug: angleproject:5579 Test: KHR-GLES32.core.geometry_shader.api.getProgramiv3 Test: GLSLTest_ES31.PerVertex* Change-Id: Ied9ea25ce86ade29261f4f75ce0b48af15061760 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2962352 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Shahbaz Youssefi 0cd99779 2021-08-05T10:35:10 Translator: Propagate precision to children nodes Similarly to glslang, when the precision of a node is determined, propagate that precision to any of its children that doesn't already have a precision. Ultimately these should only include TIntermConstantUnion nodes. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I121231d04c7cf92fc3f07716019ffe88eca48b88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3075126 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ebe943e2 2021-07-29T11:19:33 Vulkan: SPIR-V Gen: Fix gl_Clip/CullDistance These built-ins can be redeclared in the shader. The translator took these redeclarations (and gl_LastFragData) as UserDefined symbols. There were a number of hacks such as in name generation and CollectVariables, to special-case these redeclarations. This change instead makes sure that these variables continue to be considered built-ins with the appropriate qualifiers. A number of fixes are made accordingly: - Hacks are removed. - In fragment shaders, ANGLEClipDistance was initialized with gl_ClipDistance for further use by the shader. The code generation however mistakenly produced `gl_ClipDistance[0] = ANGLEClipDistance[0];`, which caused compilation failures by glslang, but passed the tests accidentally because they expected link failures (see next item). - CollectVariables is fixed to correctly collect gl_Clip/CullDistance in fragment shaders; previously they were collected as output varyings, and therefore the aforementioned link error was not produced in the tests after the compilation error was fixed. Additional fixes: - The transformation of gl_Clip/CullDistance was always ever done on one of them due to misplaced breaks in the loop that detected their presence. - The transformation of gl_CullDistance was skipped when it was not redeclared. Validation is added to make sure these built-ins always have the correct qualifier even when redeclared. SPIR-V gen support for these variables have been fixed as well. Bug: angleproject:4889 Change-Id: Ic8bf2c508357035cb937ef41a28ae22ffc533ebe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3059921 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 96ccf3f4 2021-07-29T12:38:21 Translator: Consolidate EvqFragDepth and EvqFragDepthEXT They were the same thing. Fixes SPIR-V generation which only handled EvqFragDepth. Bug: angleproject:4889 Change-Id: Id2c35f4c5a26e43ad16a420cc0306756a1add082 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3059922 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5e579a18 2021-07-13T01:22:48 Vulkan: SPIR-V Gen: Support row-major blocks The SPIR-V type generation is refactored to contain all type-differentiating properties in a specific struct that is passed around. The following can lead to different SPIR-V types generated from the same GLSL type: - Block storage for blocks - Invariant for blocks - Row-major for blocks with matrices - Row-major for matrix arrays in blocks - Bool when used inside an interface block (not yet implemented) Previously, block storage and invariant were passed around. Instead, with this change the aggregate of all the above is passed around. The row-major specialization is added in this change. This change also refactors the uniform/buffer block encoding to use the existing encoders in blocklayout.h. Bug: angleproject:4889 Change-Id: I3cfa8bd96bb380a1f1f05fbbd6b3eebd702c9e24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3021670 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Kyle Piddington d7aa0130 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile translator. This change is meant to merge the translator changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the translator code in a state that compiles, but not to switch the Metal backend over to use this translator backend yet. Bug: angleproject:5505 Change-Id: I68a6354604498cd5fd1eb96c13fc56f3b38f2bd0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897536 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi 2f737c25 2021-02-25T16:55:14 Translator: Rename GLSL to SPIR-V in Vulkan and Metal output Preparation for actual SPIR-V output instead of GLSL. Bug: angleproject:4889 Change-Id: Ic279b23d3a817bd5dca66a844905378207afdbac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2721194 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 550f2a3e 2021-02-24T09:49:42 Vulkan: Shader support for EXT_shader_framebuffer_fetch_non_coherent Translator can accept gl_LastFragData and 'inout' variable to gain access to framebuffer attachment data. The Vulkan translator replaces it with the SubpassInput type variable. Note that this works only for the noncoherent version of the extension. Bug: angleproject:5454 Test: *EXTShaderFramebufferFetchNoncoherent*.* Change-Id: I392f84ee3ad3eb9fbd09d0b7ff83731a9a3f33f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598060 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill e670fc72 2021-01-18T15:51:42 Implement shader compiler changes for Tessellation. Numerous rule changes to support validating Tessellation Control and Evaluation shaders. New per-patch inputs and output variable support. Includes a new traverser step that validates barrier function calls. Functionality changes upcoming in http://crrev.com/c/2568234 Bug: angleproject:3572 Change-Id: If8da1c21d30efa12c60ed0d6c3f8cf0b27e4c86f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633936 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi abe96578 2020-11-30T14:09:11 Vulkan: I/O blocks: Support unsized arrays Geometry shader inputs have an extra array dimension, which can be unsized as it can be derived from the primitive type. This change fixes the grammar to support such arrays. Additionally, it enables EXT_shader_io_blocks automatically with EXT_geometry_shader and EXT_tessellation_shader per spec. Bug: angleproject:3580 Change-Id: Ia7eb3e8be28c2eef2072dbe2a546fa34973104ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568242 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8797714c 2020-12-01T11:39:25 Vulkan: Support OES_shader_io_blocks Enables OES/EXT_shader_io_blocks extensions in Vulkan backends. With shader I/O blocks, the varyings can now be an array of struct (the block itself) of struct (nested in the block). This change is missing a number of features. In particular, if the shader I/O block has a location decoration in the middle of the block, that is not handled yet. Based on changes from m.maiya@samsung.com and jmadill@chromium.org. Bug: angleproject:3580 Tests: dEQP-GLES31.functional.shaders.linkage.es31.io_block.* dEQP-GLES31.functional.separate_shader.validation.es31.io_blocks.* dEQP-GLES31.functional.program_interface_query.program_input.* dEQP-GLES31.functional.program_interface_query.program_output.* Change-Id: I593840475d2365ff6c9ce7b2290f5ee462a30dfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2567645 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 43acf3ba 2020-07-31T15:43:57 GL: Compiler changes for GL_OES_texture_buffer This extension is core in GLES 3.2 This CL enables the extension, added 412 new dEQP tests for texture buffer. 410 of these tests pass, but there are two tests that fail, detailed in anglebug.com/4933 Also includes a fix for completeness checks. Based on a CL by Jonah Ryan-Davis. Bug: angleproject:3573 Bug: angleproject:4933 Change-Id: I45759d765c88c64f21b592eab01d910dc4bc8da3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2521239 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Mohan Maiya 5d0458fa 2020-10-23T12:52:34 Vulkan: Add OES_shader_multisample_interpolation support Support OES_shader_multisample_interpolation extension if maxInterpolationOffset >= 0.5 Bug: angleproject:3589 Tests: dEQP-GLES31.functional.shaders.multisample_interpolation.* dEQP-GLES31.functional.state_query.multisample_interpolation.* Change-Id: I42997f10be82e3be8b63c56833cbbf791bf4be9b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477905 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Le Hoang Quyen 9277ee74 2020-07-06T12:40:58 Metal: Implement MSAA default framebuffer. GL_SAMPLE_COVERAGE_VALUE is implemented by inserting gl_SampleMask writing logic to fragment shader. New test added: MultisampleTest.ContentPresevedAfterInterruption. - Skip on D3D11 (Bug: angleproject:4609) Bug: angleproject:2634 Change-Id: Ib44daf0baccc36ea320596d81713156047da059c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2281783 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis eadc387c 2020-04-01T16:53:31 GL: Support GL_OES_texture_cube_map_array in shader translator GL_OES_texture_cube_map_array is core in 3.2. This CL adds support for this extension in the shader translator. Now passes dEQP.KHR_GLES31/core_texture_cube_map_array.*, dEQP.GLES31/functional_fbo_color_texcubearray_*, and dEQP.GLES31/functional_opaque_type_indexing*samplercubearray* with GL backend. Bug: angleproject:3584 Change-Id: I1a8485c7d9d3fffb9b5109d292b35b0c56a3c665 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2133086 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen dadd1986 2020-04-21T01:50:00 Implement GL_APPLE_clip_distance - Built-in variable gl_ClipDistance has been added to compiler. - Desktop GL: gl_ClipDistance is supported since GL 3.0. Enable/Disable each gl_ClipDistances[i] works out of the box via glEnable(). - Vulkan/Metal: Use uniform variable to control writing to each gl_ClipDistance. One bit flag controls one element in the gl_ClipDistance array. The writing to the disabled element in vertex shader will be ignored, and turned into zero assignment instead. - Direct3D/Mobile GL: Not implemented yet. - Added ClipDistanceTest to gl_tests and compiler unittests. - GL_APPLE_clip_distance is a subset of GL_EXT_clip_cull_distance, so GL_EXT_clip_cull_distance could be implemented in future if needed. Bug: angleproject:4452 Change-Id: I571ac8b56826989808a680226a04bec4cf59988e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2084324 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 96c26c68 2020-04-03T07:52:52 Add support for NV_shader_noperspective_interpolation Added support for GL_NV_shader_noperspective_interpolation on the Vulkan and Desktop OpenGL backends Bug: angleproject:4388 Test: angle_end2end_tests --gtest_filter=ShaderInterpTest.NoPerspective/* Change-Id: I12473830c0ea8b4fffeae9c4a8ec92d979c8e18c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2107234 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 86d9c93a 2019-12-16T16:07:04 Use TSpan for TType's array sizes Until C++20, std::vector doesn't have a constexpr constructor, which means TType cannot use a `TVector` for `mArraySizes` if an arrayed type needs to be created constexpr. This is needed for the upcoming textureGatherOffsets implementation. A new TSpan class is introduced, based on std::span (from C++20) that holds the pointer/size allocated from a TVector without owning it. Since TVector's allocation are made from a pool, the allocated memory will live beyond the vector's destruction. `TType::mArraySizes` is changed to this type. This change will allow a new constexpr constructor to be added to TType that takes a TSpan as array directly, a value which is constexpr initialized from a static array (instead of TVector). Bug: angleproject:3569 Change-Id: I78793b0f4c64519e0ebe30cf6e0de995ba70035d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1968260 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yan 17b3c2f3 2019-10-14T14:13:59 Implement SamplerVideoWEBGL for WEBGL_video_texture extension on desktop WEBGL_video_texture is an extension that will improve uploading video frame to WebGL performance. (https://www.khronos.org/registry/webgl/extensions/proposals/WEBGL_video_texture/) This extension introduced a new texture type TEXTURE_VIDEO_IMAGE_WEBGL and a new sampler type samplerVideoWEBGL to sample it. In chromium implementation, TEXTURE_VIDEO_IMAGE_WEBGL maps to different native texture type based on platform. On desktop, it maps to GL_TEXTURE2D(Currently supported). On Android, it should map to GL_TEXTURE_EXTERNAL(TODO). SamplerVideoWEBGL needs to be mapped to sampler2D or samplerExternalOES according to TEXTURE_VIDEO_IMAGE_WEBGL implementation. This patch implements samplerVideoWEBGL in Angle to support WEBGL_video_texture on desktop. In this case, samplerVideoWEBGL should map to sampler2D. Bug: chromium:776222, angleproject:3889 Change-Id: Idb0a5fcde37ca75ccc1181226b91f257212e7500 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866274 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis 240befe5 2019-11-15T14:40:31 Add support for gl_HelperInvocation Added HelperInvocation to builtin_variables.json, regenerate the codegen portions of compiler, and plumb support for HelperInvocation through the rest of the compiler. Skipping some fails on Android and Swiftshader for this initial change and will debug/fix those issues in a follow-on. Bug: angleproject:4110 Change-Id: I781a2782ace84200bc615a2cc26b908a62e2aa26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1922061 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Quyen d200a77a 2019-10-10T00:44:01 Metal backend skeleton implementation. Bug: angleproject:2634 Change-Id: I34be82f4a80a6851fecb53a51e069b134d82613a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1849079 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Clemen Deng 592539fd 2019-07-10T13:15:59 Implicit conversions for Desktop GL shaders Need to support implicit conversions between types for GL shaders Other small fixes to support GL shaders Bug: angleproject:3673 Change-Id: I5341cb7195054ccc4cd36aad5dc8c801c7e1a14f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1698649 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Clemen Deng 1d672749 2019-07-08T15:42:05 WGL implemetation for OpenGL tutorial Fixes to make WGL implementation work with OpenGL tutorial - Give directive parser the correct shader spec when on Desktop GL - Minor changes to parse Desktop GL shaders - Moved clientType parameter from Context to Context->mState - Minor fixes to WGL functions Bug: angleproject:3666 Change-Id: I01ddb828f6d581ad445f49942589436849eae5d9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1693244 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis 38ff3c70 2019-05-15T10:07:09 Vulkan:Allow same-named var in nested scope ESSL 1.00 spec allows for variable with same name to override outer variable inside of a nested scope. This change adds new scope to symbol table inside of a function defintion, but after function parameters for ESSL 1.00 shaders (but not webGL). This prevents an error while parsing. This also includes some new code in translator to rename any vars that are redefined between the function body and the function parameters. This prevents an error later on when the translated shader is then parsed as a desktop GLSL version. Bug: angleproject:3287 Change-Id: I3f025805cf8d65bf912283bb15e6dad6e5e9b967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1601553 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tobin Ehlis e9421b2c 2019-04-08T15:16:56 Vulkan:Only apply invariant pragma to output vars The "#pragma STDGL invariant(all)" directive should only be applied to shader output vars. This change also removes the workaround SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT which is no longer needed. This change fixes two tests that were incorrectly assuming that the pragma would be applied to inputs: GLSLTest.InvariantAll[Both|In]. Bug: angleproject:1293 Bug: angleproject:3285 Change-Id: I4eb03fa89fbc7c560150ee0cc32382024b0cb3e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1558678 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Xinghua Cao f3179a6a 2018-07-12T16:22:06 ES31: Implement bindImageTexture binds a single layer on D3D backend Dynamically generate image2D variables' declaration and function definition in libANGLE. Bug: angleproject:1987 TEST=angle_end2end_tests.ComputeShaderTest.* Change-Id: Idacc756f7bd15f22eccb1d689e18e997f3e74159 Reviewed-on: https://chromium-review.googlesource.com/c/1142885 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Qin Jiajia a6e8a0c5 2018-11-02T15:11:50 ES31: Simplify IsInShaderStorageBlock function Bug: angleproject:1951 Change-Id: I0501502fa2201953a3dad4b18103ff5ae20db1bf Reviewed-on: https://chromium-review.googlesource.com/c/1314298 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qin Jiajia 6d765b07 2018-09-28T14:16:06 ES31: Fix some bugs in ShaderStorageBlockOutputHLSL When EOpIndexDirect/EOpIndexIndirect/EOpIndexDirectStruct/TIntermSwizzle appear in [] in ssbo access chain, we should transfer the process of them to OutputHLSL. For example: instance.v[gl_GlobalInvocationID.x] = data; // becomes float_Store(dx_instance, 0 + 16 * gl_GlobalInvocationID.x, _data); instance.v[s.index[0].x] = data; // becomes float_Store(dx_instance, 0 + 16 * _s.index[0].x, _data); Bug: angleproject:1951 Change-Id: I333e238400a10a799a6294f8759cf9c4ef2451c8 Reviewed-on: https://chromium-review.googlesource.com/c/1250661 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Qin Jiajia a735ee2f 2018-05-18T13:29:09 ES31: Support shader storage block in D3D11 compiler - Part1 This patch is the first step to implement a basic skeleton to translate shader storage block to HLSL RWByteAddressBuffer. In GLSL each shader storage block is just one structured block and in API side it corresponds to a buffer range where stores the whole structure. RWStructuredBuffer is an array-like object and can have many structured elements. The structured element doesn't support unsized array and also have a small limitation on the element size. So we choose RWByteAddressBuffer as the counterpart of shader storage block in HLSL. Due to RWByteAddressBuffer does not support using an index to reference a specific location, we must use Load and Store to process the read/write operation of a buffer variable. Moreover, in the compiler tree, since we can't use variable name to get the resource value in RWByteAddressBuffer, we have to calculate the offset of buffer variable in a shader storage block, then call the corresponding wrapper function to get the right value. In this patch, we only process below situations: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; The translation is like below: // GLSL #version 310 es layout(local_size_x=8) in; layout(std140, binding = 0) buffer blockA { float f[8]; } instanceA; layout(std140, binding = 1) buffer blockB { float f[8]; }; void main() { float data = instanceA.f[gl_LocalInvocationIndex]; f[gl_LocalInvocationIndex] = data; } // HLSL RWByteAddressBuffer _instanceA: register(u0); RWByteAddressBuffer _blockB: register(u1); float float_Load(RWByteAddressBuffer buffer, uint loc) { float result = asfloat(buffer.Load(loc)); return result; } void float_Store(RWByteAddressBuffer buffer, uint loc, float value) { buffer.Store(loc, asuint(value)); } void gl_main() { float _data = float_Load(_instanceA, 0 + 16 * gl_LocalInvocationIndex); float_Store(_blockB, 0 + 16 * gl_LocalInvocationIndex, _data); } We will do below things in the following patches: 1. Modify the intermediate tree to flatten all ssbo usages to: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; e.g. intanceA.a +=1; ->tmp = intanceA.a; intanceA.a = tmp + 1; while(++instanceA.a < 16) { } -> int PreIncrement(out int a) { a += 1; return a; } tmp = instanceA.a; while(PreIncrement(tmp) < 16) { instanceA.a = tmp } 2. Add offset calculation for structure and array of arrays. TODOs have been marked in the corresponding places in this patch. 3. Improve helper functions so that they can process all possible types. TODOs have been marked in the corresponding places in this patch. 4. Process the swizzle situation. TODOs have been marked in the corresponding places in this patch. A possible method is to extend current helper functions like below: *_Load(RWByteAddressBuffer buffer, uint loc, bool isSwizzle, uint4 swizzleOffset) Bug: angleproject:1951 Test: angle_end2end_tests Change-Id: I68ae68d5bb77d0d5627c8272627a7f689b8dc38b Reviewed-on: https://chromium-review.googlesource.com/848215 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Olli Etuaho dff32a0d 2018-08-28T14:35:50 Support multisample arrays in shader programs The added tests check that using textureSize() and texelFetch() on textures with a fixed point format return expected results. texelFetch is also covered for integer format textures. dEQP GLES 3.1 tests also cover a variety of multisampled array texture formats. BUG=angleproject:2775 TEST=angle_end2end_tests, angle_deqp_gles31_tests Change-Id: I99b422e24b39e3563ed72f0fb85c9c1907df807d Reviewed-on: https://chromium-review.googlesource.com/1196521 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d8b1c5c5 2018-06-20T12:08:46 Return ImmutableString from ArrayString() This makes the compiler a few kilobytes smaller, and prepares getting rid of TString altogether. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I93a003fe27b99bef72f872fa1066e2e108f934c5 Reviewed-on: https://chromium-review.googlesource.com/1107713 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Luc Ferron e18b8147 2018-06-07T11:53:19 Vulkan: Fix point coord management The gl_PointCoord.y coordinate needs to be flipped around the X axis in Vulkan to have correct results. Bug: angleproject:2457 Change-Id: I0d87ad28366623c2be0867c610cc35678a4af43f Reviewed-on: https://chromium-review.googlesource.com/1090824 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Olli Etuaho c3907efa 2018-06-08T13:03:15 Always use custom float parsing in GLSL We now always use custom parsing code for parsing floats in GLSL shaders. Previously this code was only used in corner cases that stringstream parsing did not handle according to the GLSL spec. This is slightly faster in compiler perftests, and results in a smaller binary as well. Some new test cases are added to make sure that the custom float parsing behaves correctly. BUG=chromium:849245 TEST=angle_unittests, angle_perftests Change-Id: I2a88ec6a8b427016e34519d72bc98216947a4c64 Reviewed-on: https://chromium-review.googlesource.com/1092697 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 197d5294 2018-04-25T14:29:00 Wrap all preprocessor code in the angle namespace. BUG=836820 BUG=801364 Change-Id: I08b6a2f9f12b689e09df6efd916c313e71e8a051 Reviewed-on: https://chromium-review.googlesource.com/1028581 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Nico Weber b5db2b49 2018-02-12T15:31:56 Enable -Wimplicit-fallthrough for ANGLE. Also teach MSVC that ANGLE_CRASH() can't return. Also fix instances of the warning in build configurations where UNREACHABLE() can return (e.g. release without dcheck_always_on or debug). If the UNREACHABLE()s are truly unreachable, this change has no behavior change. Bug: chromium:810767 Change-Id: I68f3587cf3e268c3ef634dce7ae3d70399859d0f Reviewed-on: https://chromium-review.googlesource.com/914842 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 8b5e8fdb 2017-12-15T14:59:15 Replace remaining usage of TName with TSymbol TName used to contain just a subset of the information stored in TSymbol. It makes more sense to use TSymbol directly instead of converting it to TName. This also improves type safety a bit by making some functions only take in TVariable or TFunction instead of the more generic TName. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Icb46923c25d33ebbbbc06ddc487da25957dda771 Reviewed-on: https://chromium-review.googlesource.com/829143 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao bd924af1 2017-11-16T15:28:04 ES31: Remove support of GL_OES_geometry_shader in compiler This patch intends to remove the support of GL_OES_geometry_shader in ANGLE compiler. To make the implementation simpler, currently we decide to only support "GL_EXT_geometry_shader" as the extension string of geometry shader in ANGLE. This patch also updates all the related shaders in angle_unittests into R"()" format. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ife9858abeedfb46b02c5c2fb1cda16fa27198511 Reviewed-on: https://chromium-review.googlesource.com/773451 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kai Ninomiya 57ea533f 2017-11-22T14:04:48 TType: Store array sizes vector as a pointer. This makes TType a literal type, and thus is something that could be constexpr. Work started by jmadill here: https://crrev.com/c/776278 Bug: angleproject:1432 Change-Id: I707ddf81eaf029f49d62d2836b7166d265cbdfa1 Reviewed-on: https://chromium-review.googlesource.com/786316 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao 8e4b355b 2017-08-30T14:20:58 ES31: Implement Geometry Shader inputs and outputs This patch intends to implement Geometry Shader inputs and outputs in ANGLE GLSL compiler. 1. Only accept arrays as the inputs of a Geometry Shader. 2. Allow unsized arrays as the inputs of a Geometry Shader after a valid input primitive declaration and assign size to them. 3. Implement Geometry Shader outputs. 4. Allow Geometry Shader inputs and outputs using interpolation qualifiers ('flat', 'smooth', 'centroid'). 5. Allow using 'location' layout qualifier on Geometry Shader inputs and outputs. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ia7e250277c61f45c8479437b567c2831ff26b433 Reviewed-on: https://chromium-review.googlesource.com/650211 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6276b922 2017-09-25T02:35:57 Vulkan: Implement basic uniform shader parsing. This is a first step at implementing uniforms with descriptor sets. It does not actually bind uniforms and upload data, but it does implement uniform shader parsing. Uniforms are gathered into a single uniform block which is bound to set 0, with binding 0 for vertex uniforms and binding 1 for fragment uniforms. Also adds a ReplaceSubstring helper to string_utils. Also removes the precision writing from OutputVulkanGLSL since this was generating warnings with glslang. BUG=angleproject:2167 Change-Id: I9ec8351ec1973e583100f99292b0080ee968067b Reviewed-on: https://chromium-review.googlesource.com/699938 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho 96f6adfa 2017-08-16T11:18:54 Add support for arrays of arrays in AST processing Data concerning arrays of arrays is added in TType. Parsing arrays of arrays and support for arrays of arrays in TPublicType are still left to be implemented later. ShaderVariable interface for arrays of arrays is also left to be implemented later. We rely on existing test coverage to make sure that arrays of arrays are not accidentally exposed. BUG=angleproject:2125 TEST=angle_unittests, angle_end2end_tests, angle_deqp_gles31_tests Change-Id: Ie17d5ac9b8d33958e9126dc0fb40bf1c81ddeec9 Reviewed-on: https://chromium-review.googlesource.com/616146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 13c0dd46 2017-07-04T18:27:01 Add texture rectangle extension. This is needed to support binding IOSurfaces to textures on OSX. This commit adds support in the API and tests, but didn't need to implement compiler changes as it already supported ARB_texture_rectangle. Implementation of CHROMIUM_opy_texture for rectangle texture and the spec are left for follow-up commits. Change-Id: I45c66be763a9d3f6f619640f9f95f39b05c70867 Reviewed-on: https://chromium-review.googlesource.com/559106 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 37d96cce 2017-07-11T14:14:03 Fix accepting arrays as array indices Previously, arrays were being incorrectly accepted as array indices. This was because the isScalar() check only checked that the type was not a vector or matrix, but still returned true for scalar arrays. This patch changes the isScalar() check so that it returns false for arrays. This makes usage of the term "scalar" more consistent in the shader translator. Most of the code using isScalar() was compatible with this change. Code in util.cpp that used to assume that isScalar() doesn't care about arrayness is refactored to work with the new behavior. BUG=angleproject:2102 TEST=angle_unittests Change-Id: I2a7f4c30fca7917d1099d0400efe3de859338b2a
Martin Radev e469de8a 2017-07-04T11:58:35 Refactor translator construction The patch adds functionality to determine whether compiler output belongs to the ESSL, GLSL, HLSL or Vulkan output family. The new functions can be now used in other parts of the compiler in which code paths are selected based on the compiler output. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I45ccf63f0a756c60df47a679c2da9f60856d5918 Reviewed-on: https://chromium-review.googlesource.com/558990 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
jchen10 4cdac9eb 2017-05-08T11:01:20 ES31: Add atomic counter for GLSL parsing This makes shader compiler support the new basic type 'atomic_uint' and validate its layout qualifiers properly. BUG=angleproject:1729 TEST=angle_unittests:AtomicCounterTest angle_deqp_gles31_tests:dEQP-GLES31.functional.atomic_counter.layout.invalid* angle_deqp_gles31_tests:dEQP-GLES31.functional.debug.negative_coverage.*.atomic* Change-Id: Ia237eadf6ea72314f436a0abbb93a05598e71eba Reviewed-on: https://chromium-review.googlesource.com/500088 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8fab320c 2017-05-08T18:22:22 Share a single TOperator enum among all constructor AST nodes The code is a lot simpler when the type information is only carried in the TType of the node, instead of being partially duplicated in the enum value. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I956376225ec01e469c7afb7378fa48cc097c0cea Reviewed-on: https://chromium-review.googlesource.com/498768 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Andrei Volykhin a5527071 2017-03-22T16:46:30 Add support for EXT_YUV_target Add new sampler type "__samplerExternal2DY2YEXT" to sample a YUV texture image and output color value without any color conversion, new additional type to specify color space standard formula and built-in functions for yuv to rgb transformation. Change-Id: I1780650fe84cd75191c1ca1e4118e89d585bfd92 Reviewed-on: https://chromium-review.googlesource.com/454697 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho a55102c5 2017-02-24T12:36:50 Unify and simplify shader variable collection Instead of setting variable information in both CollectVariables and the GetVariableTraverser helper class it uses, keep all of this functionality in CollectVariables. A single helper function handles setting variable information that doesn't depend on variable type, and the rest is done in "record" functions that are implemented for each variable type. This removes templates from the code, making it leaner and easier to understand, and will help with implementing future features like adding binding and location layout qualifiers for uniforms. BUG=angleproject:1442 TEST=angle_unittests, angle_end2end_tests, dEQP-GLES2.functional.shaders.* Change-Id: I79148b7b3fa9cb46634a22bdcc9ce0c04f970384 Reviewed-on: https://chromium-review.googlesource.com/446838 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
JiangYizhou 4021932f 2016-12-09T09:50:51 translator: Add ES3.1 multisample texture support. Implement shader objects, [iu]sampler2DMS, textureSize(gsampler2DMS). as well as texelFetch(gsampler2DMS,P,sample) for the glsl. BUG=angleproject:1590 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I781023f7bec34ad0264af69f34bb182b50bd1fbd Reviewed-on: https://chromium-review.googlesource.com/423175 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 99bd5f40 2016-11-07T12:44:29 Fix GLSL float parsing corner cases This fixes parsing floats that are out-of-range, and floats that have more digits than the standard library float parsing functions can handle. In these cases, we now fall back to a custom implementation of float parsing. The custom parsing path can correctly process floats with up to hundreds of millions of digits in their mantissa part. Rounding behavior of the custom float parser may not be entirely consistent with the standard parser, but the error should be at most a few ULP. This can be considered acceptable since floating point operations are not expected to be exact in GLSL in general. Settling for lower accuracy also enables the parser to run in constant memory, instead of having to store all the significant digits of the decimal mantissa being parsed. BUG=angleproject:1613 TEST=angle_unittests Change-Id: I04a5d9ae5aaca48ef14b79cca5b997078614eb1c Reviewed-on: https://chromium-review.googlesource.com/412082 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Zhenyao Mo d7490967 2016-11-09T15:49:51 Fix linkage.html failures on Mac. The failure is due to when we initialize variables to 0, we re-create the struct TType, and it contains a different unique id from the original struct TType, thus leading to a different hashed name. BUG=chromium:641129 TEST=webgl_conformance,webgl2_conformance Change-Id: I267b97fa496f55ea59dacee93af8f6a90f3e66cb Reviewed-on: https://chromium-review.googlesource.com/409602 Commit-Queue: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 2cc85b3b 2016-08-05T16:22:53 Add support for images in the compiler The patch adds support for GLSL ES 3.1 image types. Internal format layout qualifiers for images are added. Support for the readonly and writeonly qualifiers are added. The other memory qualifiers are omitted as to make the patch simpler. Tests are added which check for correct and incorrect usage of images, internal format layout and memory qualifiers. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: Ie4d3acb2a195de11b405ad54110a04c4c1de0b7e Reviewed-on: https://chromium-review.googlesource.com/378855 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Qin Jiajia 7835b525 2016-10-08T11:20:17 Reland "Add workaround for unused std140 and shared uniform blocks on MacOS" On some Mac drivers with shader version 4.1, they will treat unused std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140 layout qualifier to be considered active. The uniform block itself is also considered active. This workaround is to reference all members of unused std140 and shared uniform blocks at the beginning of the vertex/fragment shader's main(). BUG=chromium:618464 TEST=UniformBufferTest.ActiveUniformBlockNumber Change-Id: I18da4e2b61b0170068bf5ea38ce54667b0737780 Reviewed-on: https://chromium-review.googlesource.com/395648 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kenneth Russell c9e6026c 2016-09-30T17:15:07 Revert "Add workaround for unused std140 and shared uniform blocks on MacOS" This reverts commit 9aa83fe302578d226f195fff5fb3f0e2fb723a4c. The new test UniformBufferTest.ActiveUniformNumberAndName/ES3_OPENGL is failing on multiple platforms. Examples: https://build.chromium.org/p/chromium.gpu.fyi/builders/Mac%2010.10%20Release%20%28ATI%29/builds/12285 https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20(ATI) Change-Id: I78b1a4d58e9a291e40ad304eb32f990e0518f7ee Reviewed-on: https://chromium-review.googlesource.com/391049 Reviewed-by: Kenneth Russell <kbr@chromium.org>
Qin Jiajia 9aa83fe3 2016-09-29T08:42:42 Add workaround for unused std140 and shared uniform blocks on MacOS On some Mac drivers with shader version 4.1, they will treat unused std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140 layout qualifier to be considered active. The uniform block itself is also considered active. This workaround is to reference all members of unused std140 and shared uniform blocks at the beginning of the vertex/fragment shader's main(). BUG=chromium:618464 TEST=UniformBufferTest.ActiveUniformBlockNumber Change-Id: I1d2c5e3e8da04786ac6a37fd26f7bb9c14cd76ed Reviewed-on: https://chromium-review.googlesource.com/387169 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 509e4560 2016-08-25T14:55:44 compiler: Work around a HLSL compiler aliasing opt bug. BUG=angleproject:1448 Change-Id: I7d5bcbd100069152cea0cb03bc4fa6af1044460b Reviewed-on: https://chromium-review.googlesource.com/376020 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 70866b89 2016-07-22T15:27:42 Change grammar to support features from es31 The grammar has been changed so that ES31 grammar is followed more closely. The ES31 grammar is not fully supported, only functionality related to qualifier enumeration is added. The ParseContext is changed so that type qualifiers can be now joined together (i.e. like layout qualifiers). This will allow enumeration of multiple storage qualifiers (i.e. uniform readonly coherent) which is essential for support of ES31 features. Some of the error checks had to be moved closer to the root of the parse tree since some of the information about the expression might be missing. Unfortunately, as there is no explicit ordering imposed by the grammar, additional checks for proper order of qualifiers had to be added. I also included unit tests which test against malformed shaders. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests TEST=dEQP-GLES3.functional.shaders.*precision* TEST=dEQP-GLES3.functional.shaders.*function* TEST=dEQP-GLES2.functional.shaders.* Change-Id: Ib3653a1ed1bfced099a6b2cbf35a7cd480c9100d Reviewed-on: https://chromium-review.googlesource.com/362940 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 856c497e 2016-08-08T11:38:39 Clarify error checking function names in the GLSL parser Most error checking functions in ParseContext used to follow a format like <property>ErrorCheck. Sometimes this function would check that the node/value would have <property>, sometimes it would check that the node/value would not have it, which was confusing. Change most of these functions to use a lot more descriptive names, which clearly communicate what they are checking for. Also includes a bit of refactoring in constructorErrorCheck(), so that the function only checks for errors rather than also setting the type of the constructor node. Also make TType::arraySize unsigned, and return a sanitized size from checkIsValidArraySize() instead of using an output parameter. BUG=angleproject:911 TEST=angle_unittests Change-Id: Id9767b8c79594ad3f782f801ea68eb96df721a31 Reviewed-on: https://chromium-review.googlesource.com/367070 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 156d7197 2016-07-21T16:11:00 HLSL: Insert return statements into functions that are missing them. It's allowed to not have all code paths return a value in ESSL but the HLSL compiler detects this and generates an error. Work around this by adding dummy return statements at the end of each function that doesn't have one. TEST=deqp/data/gles2/shaders/functions.html BUG=angleproject:1015 BUG=478572 Change-Id: I2913f90f0994d4caf25cc43b16b9fc4e9efb19a5 Reviewed-on: https://chromium-review.googlesource.com/362085 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Zhenyao Mo 72111915 2016-07-20T17:45:56 Initialize all output variables. BUG=angleproject:1441 TEST=bots Change-Id: Ia4cf415d8346c3234bf0f548a178ee3ea8cd35c4 Reviewed-on: https://chromium-review.googlesource.com/362110 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho f541f529 2015-10-13T12:21:01 Fix parsing integers larger than 0x7FFFFFFF Parsing should accept all values between 0 and 0xFFFFFFFF as specified in ESSL 3.00 section 4.1.3. When a signed literal is parsed, it's interpreted as if it specifies the bit pattern of a two's complement integer. For example, parsing "0xFFFFFFFF" results in -1. Decimal literals behave the same way, so for example parsing "3000000000" results in -1294967296. This change affects parsing of literals in ESSL 1.00 as well. In ESSL 3.00, an out-of-range integer literal now generates a compiler error. Unit tests are added based on examples in the ESSL 3.00 spec and one example in GLSL 4.5 spec that ESSL should match. BUG=541550 TEST=angle_unittests Change-Id: I82f8ef5cfa2881019a3f80d77ff99707d61c000d Reviewed-on: https://chromium-review.googlesource.com/305420 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@google.com>
Corentin Wallez e2adce1b 2015-06-19T23:06:32 Workaround for some STLs not parsing floats with a suffix BUG=angleproject:1046 BUG=angleproject:891 Change-Id: I01c3f024142e573385a5f40d721171ad752ffd19 Reviewed-on: https://chromium-review.googlesource.com/278210 Reviewed-by: Brandon Jones <bajones@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 37ad4744 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. A shading language version dependent varying matching check is added to the translator API to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. A previous revision of this change that broke API compatibility was reverted since it broke Chromium FYI bots. This revision keeps deprecated API functionality around for now so that changes can be rolled step-by-step to Chromium without breakage. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: Iecb64e3afd23e267ba999bc17f44390affcdfc13 Reviewed-on: https://chromium-review.googlesource.com/269940 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 9e64edce 2015-05-07T14:08:06 Revert "Add support for parsing ESSL3 invariant qualifiers" Build breaks in GPU FYI bots. BUG=angleproject:987 This reverts commit 4008879357159c7850cf105f2ae842bc68dd3c18. Change-Id: Ia88ad302c403c65516c050eb7741316b5097bcfb Reviewed-on: https://chromium-review.googlesource.com/269847 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 40088793 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. The varying matching check in the translator API is changed to be shading language version dependent to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I3982feff7380c4dfc647940ee03a020692dd0c59 Reviewed-on: https://chromium-review.googlesource.com/267663 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 214c2d8e 2015-04-27T14:49:13 Separate invariance from qualifiers ESSL3 makes it possible to combine invariant with several more different qualifiers. To avoid combinatorial explosion of the qualifier enum, track invariance with a separate boolean. TEST=WebGL conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I0c6629e5ca2ded06db9ac9e5bab2fb6480299a5a Reviewed-on: https://chromium-review.googlesource.com/267662 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 2c43325d 2014-12-03T12:36:54 Fix double delete with invariant varyings. The compiler would leave some TString variables lying around after the pool gets released, leading to a potential crash. BUG=angle:846 Change-Id: I484ed9b14bba9bf653f6ed4001ae79f87791b0dd Reviewed-on: https://chromium-review.googlesource.com/232780 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Jamie Madill 70a0b2a1 2014-10-21T11:48:39 Fix varying interpolation parsing. This was broken sometime in the CollectVariables refactor. BUG=angle:803 Change-Id: Iaa09449f02290c4547f87c1560465dc8998d957c Reviewed-on: https://chromium-review.googlesource.com/224104 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Zhenyao Mo 94ac7b78 2014-10-15T18:22:08 Invariant related processing. * Fix a bug in PreProcessor for STDGL pragma. * Record all invariant settings and set them in ShaderVariable. * Write #pragma STDGL invariant(all) in GL BUG=angle:776 TEST=https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shaders-with-invariance.html Change-Id: Ie28b75480deed79f0c9f26e3b98f1778d1290182 Reviewed-on: https://chromium-review.googlesource.com/223610 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 54ad4f81 2014-09-03T09:40:46 Use the CollectVariables path on the HLSL translator. This approach consolidates our two methods, and lets us reuse the same code for both methods of variable collection. BUG=angle:466 Change-Id: Ie92f76ff0b6d0d0dbfd211a234d0ab86290fa798 Reviewed-on: https://chromium-review.googlesource.com/213504 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill a6f267f9 2014-08-27T11:44:15 Fix row-major layout tracking in interface blocks. Some block field types, such as nested structs, were bugged. This only affects our "CollectVariables" path, not our current HLSL UBO path. BUG=angle:466 Change-Id: I2b8daf58aa7ec1ad06a80d38f57e76087eacccdc Reviewed-on: https://chromium-review.googlesource.com/213503 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 42bcf32e 2014-08-25T16:20:46 Refactor ShaderVariables to store fields in the base. Instead of only storing structure information in Varyings, Uniforms and Interface Block Fields, store it in the base class. Also only store base variable information for struct fields, instead of fully typed information. This works because stuff like interpolation type, invariance, and other properties are for the entire variable, not individual fields. Also add new fields for interface block instance name, varying invariance and structure name for all struct types. BUG=angle:466 Change-Id: If03fc071e6becb7aad6dea5093989bba7daee69e Reviewed-on: https://chromium-review.googlesource.com/213501 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 1c28e1f0 2014-08-04T11:37:54 Fix shaders with invariant keyword. We would trigger assertion failures in Debug mode, and fail to parse and translate correctly in Release. BUG=angle:711 Change-Id: Ibb7f33b288376617598578f48c7bbdbdec044279 Reviewed-on: https://chromium-review.googlesource.com/210822 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>