src/compiler/translator/CollectVariables.cpp


Log

Author Commit Date CI Message
Kimmo Kinnunen 8d12b278 2024-03-15T15:39:39 Make separated anonymous in/out structs work better Fixes failing case for other backends than GLSL output: VS: out struct { .. } a, b; FS: in struct { .. } a, b Make the ANGLE VS-FS interface matching work by using the anonymous name as the variable structOrBlock name. Bug: angleproject:42267047 Change-Id: If8107387c02b5520134857fb210a27a8f92a2db0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372727 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
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>
Roman Lavrov 0197826b 2024-03-22T14:42:34 Revert "Add conversion operator from ImmutableString to std::string" This reverts commit 8c0dae388bccb00f11cd94d641d719cc68325826. Reason for revert: Breaks Android rolls: external/angle/src/compiler/translator/ImmutableString.h:103:15: error: constexpr function's return type 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char>>') is not a literal type 103 | constexpr operator std::string() const { return std::string(data(), length()); } | ^ external/libcxx/include/string:4332:64: note: 'basic_string<char>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors 4332 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>) Original change's description: > Add conversion operator from ImmutableString to std::string > > Also use the operator in a couple of places. Sometimes saves a strlen. > > Bug: angleproject:8614 > Change-Id: I429f3ac02af04b568ac7d1adf22ab65e5007fbda > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372728 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:8614 Change-Id: I46963686f9506f7029e164250b1bf81f8ab2c519 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5388255 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Kimmo Kinnunen 8c0dae38 2024-03-15T16:09:04 Add conversion operator from ImmutableString to std::string Also use the operator in a couple of places. Sometimes saves a strlen. Bug: angleproject:8614 Change-Id: I429f3ac02af04b568ac7d1adf22ab65e5007fbda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372728 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Ho Cheung 0510fb49 2023-09-11T18:11:50 [code health] Use more standard enumerator names Use more standard enumerator names in ANGLE https://google.github.io/styleguide/cppguide.html#Enumerator_Names There are still some non-standard enumerator names in the //cc directory, which will be modified in subsequent patches. Bug: chromium:1480233 Change-Id: I96d534f0eb74a8583237c754f6ef867bd1b33d4a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4853030 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ho Cheung <uioptt24@gmail.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8b79410b 2023-04-02T22:25:12 Vulkan: Treat readonly SSBOs as readonly! Instead of assuming SSBOs are always written to, this change adds plumbing for the backend to know when an SSBO is declared readonly and marks the buffer readonly accordingly. With this change, BufferVk can optimize uploads and copies to and from the buffer with the knowledge that it can be safely mapped on the CPU for read while it's being used by the GPU. Bug: b/276002151 Change-Id: I75342148c07949a83436054a738395bbd88caec5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4392720 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
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>
Chris Dalton 5e95a4d9 2022-10-07T00:52:38 Add an EXT_shader_pixel_local_storage impl of PLS Translates ANGLE_shader_pixel_local_storage shaders directly to EXT_shader_pixel_local_storage. Polyfills load/store operations using internal fullscreen draws. Since the ANGLE extension needs the ability to preserve all active PLS planes to textures, we can only support this extension when the backend context also has access to ES 3.1 shader images. Bug: angleproject:7279 Bug: angleproject:7771 Change-Id: Id348bde412efcc081ff29ee05ec59ad652f77569 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3966075 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 9d41585e 2022-08-12T14:20:34 Make PLS coherent on D3D 11.3 Adds a new internal memory qualifier to the compiler called "rasterOrdered", which we set in RewritePixelLocalStorage.cpp when D3D 11.3 Rasterizer Order Views are supported. The HLSL translator then generates RasterizerOrderedTexture2D<> instead of RWTexture2D<> when this qualifier is set. Bug: angleproject:7279 Change-Id: I39b8c3279b7bff93b7e57272e8fb84d9c0312616 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3830288 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi 6f80f0f0 2022-08-06T02:29:19 Translator: Clean up the compile flag passing interface Historically, compile flags were sent to the translator as a bitmask. Recently, we were getting close to running out of bits. Additionally, direct-to-metal work had started to introduce constants to be passed to the translator, which were misplaced in ShBuiltInResources and Caps. Recent work on Pixel Local Storage adds even more constants, aggravating the situation. In this change, the interface to passing compile flags is reworked. A struct is passed (instead of a bitmask) that has one bit for each flag. This can be indefinitely extended. Additionally, the constants needed by metal and PLS are also placed in this struct. In turn, the backends can set these options directly, and don't have to hack them into Caps to further get hacked into ShBuiltInResources. Bug: angleproject:7559 Change-Id: If93f1e1b8818ad3a0ac708ab04ab93b4b397d114 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812562 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 87ea0c7d 2022-05-17T22:33:57 Vulkan: SPIR-V Gen: Apply Flat to gl_Layer in FS Not directly specified by the spec on gl_Layer itself, but required according to this more generic statement: > Fragment shader inputs that are, or contain, integral types must be > qualified with the interpolation qualifier flat. Bug: angleproject:7332 Change-Id: Ieaa389e9b1318d3f13147cba7949cff6491c4b61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3652746 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Brandon Schade <b.schade@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 38fada35 2022-01-27T18:16:18 Vulkan: Add support for OES_primitive_bounding_box Add OES version of the primitive bound box extension Bug: angleproject:3576 Test: dEQP-GLES31.functional.primitive_bounding_box.* Change-Id: Ie44d952992a68dfffd5c124dda8dd11069f0c1e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3425086 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.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>
Gert Wollny 5f7c3ba6 2021-11-01T13:27:15 Capture/Replay: Don't force initialization of FS inout vars Since these variables are to be considered inputs as well as outputs initializing them would overwrite the valid input values, hence skip initialization. Bug: angleproject:6608 Change-Id: Id8baf856a23ac84d18c61dd54cd6095128190075 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3253377 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gert Wollny <gert.wollny@collabora.com>
Jamie Madill c31855ea 2021-10-28T13:29:17 translator: Always report gl_FragData array size. Previously we would report it as size 1 always if the extension was missing. This was breaking a dEQP. The test may have a bug, but we need to work around the issue until the upstream test is fixed. See https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3259 Bug: angleproject:6566 Change-Id: I5ac654f472f0e227d63804896ecc388081bec5e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251586 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Brandon Schade 217acac2 2021-07-21T12:42:56 Vulkan: Add support for EXT_primitive_bounding_box 1. Added support for EXT_primitive_bounding_box extension 2. Renamed shader variable gl_BoundingBoxEXT[] to ANGLEBoundingBox[] Bug: angleproject:3576 Test: dEQP-GLES31.functional.primitive_bounding_box.* Change-Id: I15fa9af50c6fd8e86d225670ddd8eb39f6e65d35 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3053618 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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 1f8e35b5 2021-04-09T12:29:22 Remove EvqBaseVertex and EvqBaseInstance qualifiers They are only used to mark angle_BaseVertex and angle_BaseInstance uniforms, but they make it complicated for the rest of the code to identify them as uniforms. Bug: angleproject:4889 Change-Id: I0c632bb595dc9a7fcda19db11ecb27539b1c33e6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818144 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi bb3adfa4 2020-12-01T15:43:13 Rename ShaderVariable::structName to structOrBlockName Bug: angleproject:3580 Change-Id: Ic53a5267972f153dad2e20948e493e9767a45d16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568247 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Mohan Maiya cea86910 2021-01-14T08:13:00 Vulkan: Support EXT_clip_cull_distance extension EXT_clip_cull_distance extension is supported except for some features related to EXT_tessellation_shader and EXT_geometry_shader. Also added a few compiler tests to validate the transformation from ESSL to GLSL for Vulkan backend. Bug: angleproject:5458 Tests: angle_end2end_tests --gtest_filter=Clip*DistanceTest* angle_unittests --gtest_filter=*Clip*Distance* Change-Id: Ie74e6b2b55112ad92ad111191d629b63506032ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2585987 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 173f1c94 2020-12-03T13:53:16 Translator: Collect gl_in as a varying. This unifies the variable handling for IO blocks. Previously the gl_in block we treated as an "in block" similar to an interface block. Bug: angleproject:5423 Change-Id: Idf2db4c209055fa9ffca567dab39c89464eba156 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2571966 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@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>
Mohan Maiya 8a401051 2020-11-19T07:58:05 Vulkan: Support OES_sample_variables extension Enable OES_sample_variables extension on Vulkan backend. Add support for built-in variables, uniform state and constants - gl_SampleId, gl_SamplePosition, gl_SampleMask, gl_SampleMaskIn - gl_NumSamples - gl_MaxSamples Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables.* KHR-GLES31.core.sample_variables.* Change-Id: Idf37c7b4ccb0331dbda7acd6389ff4e1022ba959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477907 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 5b419533 2020-11-03T13:33:44 GL: Implement EXT_YUV_target Add test coverage of YUV format sampling as RGB or directly as YUV and rendering as YUV using layout(yuv). Initializing YUV AHardwareBuffers requires Android API 29 so ANGLE must be compiled with: android32_ndk_api_level = 29 android64_ndk_api_level = 29 The following tests can still run with Android API 26 because they don't need to initialize the buffer: ImageTestES3.ClearYUVAHB ImageTestES3.YUVValidation Bug: angleproject:4852 Bug: b/172649538 Change-Id: I4fe9afb2a68fb827dc5a5732b213b5eb60d585ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2517562 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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 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>
Shahbaz Youssefi e4eb75da 2019-12-06T11:10:47 Vulkan: EXT_gpu_shader5 support: dynamically uniform indexing Bug: angleproject:3569 Change-Id: I5abb7f2889fa5173457497d4156a3dadbcf77640 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1954613 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 795a3559 2019-12-03T11:31:18 Vulkan: EXT_gpu_shader5 support: precise The precise keyword is used in tessellation shaders but introduced in this extension. EXT_gpu_shader5 introduces a handful of features to shaders. This change only implements the `precise` keyword. Bug: angleproject:3569 Change-Id: I2252b79098eb8ba2d2faa040d7eaed7548b7051e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1939851 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter 33a00efd 2019-11-27T09:21:45 Add Compute Shared Memory Size Validation Add tracking of shared memory declarations in compute shaders. Test:   angle_deqp_gles31_tests --gtest_filter=dEQP.GLES31/functional_debug_negative_coverage_callbacks_compute_exceed_shared_memory_size_limit Bug: 4173 Change-Id: If2a86d467a82f73fa5b2ee0ced752701acfe1872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1934653 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 249cb200 2019-12-03T11:10:06 Translator: Rename TIntermInvariantDeclaration to ..GlobalQualifier.. This is to support the upcoming `precise` keyword. Bug: angleproject:3569 Change-Id: Idbcc8fd6f261757dbbf81b381e7a2dae938d8101 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1947451 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tim Van Patten c5c096aa 2019-11-15T15:36:16 Enable Compute Shader Program Input Queries Compute shader inputs were not being tracked in the Shader or Program states, causing program interface queries to fail. This change treats compute shader inputs (all built-ins) as Attributes and pipes them through from the Compiler to the Program to enable input queries. While compute shader inputs are not technically attributes (or varyings), the ANGLE code understands and handles attributes and a program can never have both a vertex and compute shader, so there can't be any conflicts. The naming of these variable lists should probabaly be revisited at some point to better handle these different use-cases. Bug: angleproject:3596 Test: dEQP-GLES31.functional.program_interface_query.program_input.resource_list.compute.empty Change-Id: Ie52cd59041868cfdb5d3d759bb4ec53c8d5b38d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919557 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
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>
Tim Van Patten 90a58622 2019-09-04T15:39:58 Refactor ShaderVariable to Remove Specializations The following structs are being refactored and moved into the parent struct ShaderVariable: VariableWithLocation Uniform Attribute OutputVariable InterfaceBlockField Varying Bug: angleproject:3899 Test: CQ Change-Id: I389eb3ab4ed44a360e09fca75ecc78d64a277f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785877 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 6aca71d7 2019-08-12T13:02:34 Vulkan: Full support for program interface queries When an interface block's field is determined to be active, it's possible that the field is a struct so each of that field's fields need to be marked active as well. Bug: angleproject:3596 Test: dEQP-GLES31.functional.program_interface_query.* Test: end2end ProgramInterfaceTestES31 Change-Id: I0bf550046a7a1d3c92cc08773138a40400e5e73b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1749332 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
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>
shrekshao cdab03aa 2019-06-18T17:24:54 Add flags to shader translator to emulate gl_BaseVertex and gl_BaseInstance Adds support for translating gl_BaseVertex and gl_BaseInstance for implementation of GL_ANGLE_base_vertex_base_instance. They will only be available in WebGL 2. Since there's no gl_VertexID and gl_InstanceID in WebGL 1. It won't be very useful to add them to WebGL 1. Mostly follow pattern of gl_DrawID of GL_multi_draw BUG=angleproject:3402,chromium:891861 Change-Id: Ifcd990c52d12f6814127b904e61a779b8d382e0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666361 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mingyu Hu ebab670c 2019-04-19T14:36:45 Adding new extension GL_OVR_multiview GL_OVR_multiview functions exactly the same as GL_OVR_multiview2. All GL_OVR_multiview2 tests now also repeat the same test using GL_OVR_multiview Bug: angleproject:3341 Change-Id: I7e5294fb6bbf7692535174a15da6a42e1b5fc4e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575904 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mingyu Hu 7d64c486 2019-03-12T14:27:40 GL_ANGLE_multiview has been renamed to GL_OVR_multiview2. changes include: 1) GL_OVR_multiview to GL_OVR_multiview2 extension directive change 2) Removal of all references to side by side. We no longer support multiple views in a single 2DTexture. Only 2DTextureArray's are supported 3) WebGL 2 (ES3) is required for multiview Bug: angleproject:3341 Change-Id: Ie0c1d21d7610f8feebdb2e4d01c6947f57e69328 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552023 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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>
Austin Eng 7cf9cd24 2018-10-09T15:27:32 Add flags to shader translator to emulate gl_DrawID Adds support for translating gl_DrawID for implementation of GL_ANGLE_multi_draw. Currently the change only supports and allows emulation of the draw id using a uniform variable named `gl_DrawID`. This uniform is mapped in the translated shader to a hashed name that does not use the gl_ namespace Bug: chromium:890539 Change-Id: I08a246ca911e88e733ccdf22f1ed69dcae948e05 Reviewed-on: https://chromium-review.googlesource.com/c/1271957 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Olli Etuaho a78092cb 2018-09-26T14:16:13 Support ESSL 3.00 EXT_blend_func_extended shaders This adds support for the index layout qualifier that's used in EXT_blend_func_extended to set whether a fragment output should be bound to the primary or secondary blend source color. Output locations are now validated correctly so that two outputs can have the same location as long as they have a different index. Some tests are fixed to allow this. BUG=angleproject:1085 TEST=angle_unittests Change-Id: I1de3ad1406398952287791eca367562bed59d380 Reviewed-on: https://chromium-review.googlesource.com/1245982 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 76b2c385 2018-03-19T15:51:29 Store invariant declarations in variable metadata This is simpler than storing the information in symbol table levels. Invariant declarations can only be present at the global scope, so storing the information per level is not required. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Idb07d734950c8a0a8bda5b2380e181902f9eb633 Reviewed-on: https://chromium-review.googlesource.com/1007060 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho bb52c523 2018-04-06T10:22:22 Invariant declaration doesn't make a variable active Invariant declarations didn't affect static use before, but now they are also skipped in CollectVariables so an invariant declaration is not enough in itself to mark a variable as active. This fixes an assert in CollectVariables. BUG=chromium:829553 TEST=angle_unittests Change-Id: I3e51d2916f091bcc283af136a4abc846ff71447d Reviewed-on: https://chromium-review.googlesource.com/999532 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 94bbed1e 2018-03-20T14:44:53 Collect static use information during parsing We now collect metadata for variables in the symbol table. The metadata is stored in a map using the variable unique id as a key, so we can store the variables themselves as constexpr while still having dynamic metadata. For now we collect whether a variable is statically read or written. This can be used to more accurately determine whether a variable is statically used, but can also enable more optimizations in the future, such as pruning variables that are never read or folding variables that are never written after initialization. The collection is done during parsing, so that nothing is pruned from the AST before the static use is recorded. Static writes are flagged in ParseContext::checkCanBeLValue, as that function is already called for all variables that are written. Static reads are flagged whenever there's an operation that requires a variable to be read. This includes: * Unary and binary math ops * Comma ops * Ternary ops * Assignments * Returning the variable * Passing the variable as an in or inout argument to a function * Using the variable as a constructor argument * Using the variable as an if statement condition * Using the variable as a loop condition or expression * Using the variable as an index * Using the variable as a switch statement init expression In case there are statements that simply refer to a variable without doing operations on it, the variable is being treated as statically read. Examples of such statements: my_var; my_arr[2]; These are a bit of a corner case, but it makes sense to treat them as static use for validation purposes. Collecting correct static use information costs us a bit of compiler performance, but the regression is on the order of just a few percent in the compiler perf tests. BUG=angleproject:2262 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib0d7add7e4a7d11bffeb2a4861eeea982c562234 Reviewed-on: https://chromium-review.googlesource.com/977964 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 822a84b1 2018-03-23T12:30:18 Get builtin symbol info from the node in CollectVariables Since we now have a TVariable pointer in TIntermSymbol, we don't need to look up variables from the symbol table. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Id09610ccec5898eb56dcc5e9112e173edcf7ac97 Reviewed-on: https://chromium-review.googlesource.com/977828 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 107c7247 2018-03-20T15:45:35 ShaderVariable: separate fields for staticUse and active Thus far the compiler has used the "staticUse" flag to mark variables that should have rather been marked "active", meaning that the code may actually execute in a way that accesses the variable. There's a clear definition for this use of the term "active" in the GLES 3.0.5 spec, section 2.12.6, and in GLES 3.1 section 7.3.1. Having separate fields for recording static use and "activeness" of a variable is the first step to fixing this. According to the spec, usually only active resources should be considered when checking use against max limits. Also, only active uniforms get assigned a location. libANGLE code now correctly checks the active flag rather than the static use flag in these cases. The static use field still mirrors the active field for now, since some code in Chromium also needs to be fixed to use the active field correctly before the two can diverge. After Chromium is fixed, we can fix ANGLE so that static use information is recorded earlier during compilation and will accurately reflect whether variables are statically used. Currently the compiler only records variables once some static use may already have been pruned from the AST. BUG=angleproject:2262 TEST=angle_unittests, angle_end2end_tests Change-Id: I025bb71361246ae00c911a1f8b66ec045f665f29 Reviewed-on: https://chromium-review.googlesource.com/970962 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c26214de 2018-03-16T10:43:11 Move AST utilities to a subdirectory Move AST related utilities to compiler/translator/tree_util. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I7567c2f6f2710292029263257c7ac26e2a144ac8 Reviewed-on: https://chromium-review.googlesource.com/966032 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho defe3937 2018-02-13T11:56:09 Store invariant varying names as ImmutableString This gets rid of a few extra ImmutableString to std::string conversions which makes the code clearer. There doesn't seem to be any significant effect on performance. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I36ebbc8a4130ab8f9d6194feca83ec5dcbc95f78 Reviewed-on: https://chromium-review.googlesource.com/916141 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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 dd21ecf8 2018-01-10T12:42:09 Add const qualification to symbol accesses All accesses to built-in symbols now happen through const-qualified pointers. This also encapsulates TSymbolTableLevel inside TSymbolTable. This prepares for statically allocating built-in symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I473014d978daa765b4a733d761d6c08b28288776 Reviewed-on: https://chromium-review.googlesource.com/859959 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@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>
Olli Etuaho bed35d76 2017-12-20T16:36:26 Don't query names of empty symbols This makes it possible to return a reference from TSymbol::name() instead of a pointer. This is safer since it completely avoids the possibility of a nullptr dereference. An assert is making sure that the function is not being called for empty symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I44279f65989dbb828322843fc0216ba84d91dedf Reviewed-on: https://chromium-review.googlesource.com/836894 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho b8cb939f 2017-12-20T14:23:19 Fix tracking variables in folded ternary operators The result of folding a ternary operator may be a TIntermSymbol node where the qualifier doesn't match the qualifier of the variable that the node is referring to. Get the qualifier from the variable instead of directly from TIntermSymbol when collecting variables in CollectVariables or when tracking referenced variables in OutputHLSL. BUG=angleproject:2288 TEST=angle_unittests, angle_end2end_tests Change-Id: If294a7fe9dca50f2ebcea3feff887e72a521d395 Reviewed-on: https://chromium-review.googlesource.com/836893 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Xinghua Cao 26143fdd 2017-11-01T18:19:05 ES31: Support bindImageTexture on Texture2D for compute shaders on D3D BUG=angleproject:1987 TEST=angle_end2end_tests Change-Id: I3b0afb441a41dbd7f204b1d1bba7884c8d203ce1 Reviewed-on: https://chromium-review.googlesource.com/749004 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ae4dbf32 2017-12-08T20:49:00 Don't allocate name strings for empty symbols This removes unnecessary memory allocations. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ide575ea19ab2f8e9fc93092490f1352efa6024a3 Reviewed-on: https://chromium-review.googlesource.com/817415 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@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>
Olli Etuaho 378c3a51 2017-12-04T11:32:13 Clean up storing interface blocks in the symbol table Merge TInterfaceBlock with TInterfaceBlockName, so that there are no duplicate data structures for interface blocks. This is similar to the refactoring that was already done to structs. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I67d2af6ccbe5344bddf9c99030d118fe532fbbd8 Reviewed-on: https://chromium-review.googlesource.com/805819 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 12a18ad3 2017-12-01T16:59:47 Simplify interface block instance recording Instead of storing instance names as part of TInterfaceBlock, store instance names only in interface block instance symbols. Wherever the instance name is needed it can be fetched from the instance symbol. BUG=angleproject:2267 TEST=angle_end2end_tests Change-Id: Ia265e4db7901eebec57c9c3769d84c17651a35ba Reviewed-on: https://chromium-review.googlesource.com/803221 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3de2703d 2017-11-30T12:16:47 Fix handling matrix qualifiers on block members Individual block member row_major/column_major layout qualifiers may override the qualifiers set on the block. During parsing, this was already being handled correctly, so that the qualifier is resolved for each block member and recorded for each TField / InterfaceBlockField. Now we always write the qualifiers on a per-member granularity to the output GLSL shaders, so that the native driver gets the correct per-member qualifiers. This replaces earlier behavior where the matrix qualifiers were only written per-block. Also only use qualifiers from individual members in block layout. Since the block-level qualifier information is no longer used after parsing, it is no longer kept in the AST. A dummy value is still set to the InterfaceBlock structs exposed through the ShaderVars interface, since that has existing usage in Chromium that needs to be removed before the field can be removed. Some AMD OpenGL drivers don't seem to handle matrix layout qualifiers correctly, so most of the added tests need to be skipped for AMD GL. On NVIDIA and Intel the tests pass. BUG=angleproject:2271 TEST=angle_unittests, angle_end2end_tests, dEQP-GLES31.functional.program_interface_query.uniform.matrix* Change-Id: I1baa7a633bc2da548743c2190cb72db491b5227a Reviewed-on: https://chromium-review.googlesource.com/800174 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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>
Olli Etuaho 465835d6 2017-09-26T13:34:10 Support arrays of arrays in the API The ShaderVariable class that is used as an interface between the compiler and the rest of the code gets arrays of arrays support. Array of array variables are passed from the compiler just like any other variables. However, when stored in Program state each innermost array constitutes a separate variable. This is done to make the implementation match the GLES specification for program interface query APIs. This will be tested more fully once support for parsing arrays of arrays lands in the compiler. TEST=angle_end2end_tests, angle_unittests BUG=angleproject:2125 Change-Id: I0f7159000f039be92a87a52b3b68cd9a215a21cb Reviewed-on: https://chromium-review.googlesource.com/684742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiajia Qin 3a9090fa 2017-09-27T14:37:04 ES31: Add BUFFER_VARIABLE and SHADER_STORAGE_BLOCK program interfaces This patch collects the shader storage block members information. It implements getShaderStorageBlockMemberInfo and getShaderStorageBlockSize for OpenGL backend. Meanwhile, it implements BUFFER_VARIABLE and SHADER_STORAGE_BLOCK interfaces for program query. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTest* dEQP-GLES31.functional.layout_binding.ssbo* dEQP-GLES31.functional.compute.basic.empty dEQP-GLES31.functional.compute.basic.ssbo_rw* dEQP-GLES31.functional.compute.basic.ssbo_local_barrier* dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_small dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_groups dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_invocations dEQP-GLES31.functional.compute.basic.copy_ssbo_single_invocation dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_small dEQP-GLES31.functional.compute.basic.shared_var* dEQP-GLES31.functional.compute.basic.ubo_to_ssbo* dEQP-GLES31.functional.compute.basic.write_multiple_arr* dEQP-GLES31.functional.compute.shared_var.basic_type.* dEQP-GLES31.functional.compute.shared_var.work_group_size.* dEQP-GLES31.functional.atomic_counter.* Change-Id: Ie8b81fde5a2e919aab77adb3d137c9ff2f193409 Reviewed-on: https://chromium-review.googlesource.com/712235 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qin Jiajia ca68d988 2017-09-18T16:41:56 ES31: Add std430 support for OpenGL backend BUG=angleproject:1920 TEST=angle_unittests Change-Id: Ie8e171abec053c2c5dca93d6e79db534f74520e7 Reviewed-on: https://chromium-review.googlesource.com/737532 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Olli Etuaho e7c2857d 2017-10-23T16:29:33 Clean up direct access of ShaderVariable::arraySize This change is pure refactoring. It's intended to help with adding support for arrays of arrays. BUG=angleproject:2125 TEST=angle_unittests Change-Id: I82881a98c3c476fd6666a551ce6be255ae0de4cf Reviewed-on: https://chromium-review.googlesource.com/733127 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao 4cc89e2b 2017-08-31T14:25:54 ES31: Enable 'location' layout qualifier on shader interfaces in compiler This patch enables 'location' layout qualifier for vertex outputs and fragment shader inputs when the shader version is 3.1 in ANGLE GLSL compiler and adds the check on location conflicts for these varyings. According to GLSL ES 3.1 SPEC (Chapter 4.4.1 and Chapter 4.4.2), 'location' layout qualifier is allowed on both inputs and outputs of vertex and fragment shaders. 'location' layout qualifier on shader interfaces is only valid on shaders whose version is 3.1 and above. According to GLSL ES 3.0 SPEC, vertex shader cannot have output layout qualifiers (Chapter 4.3.8.2) and fragment shader cannot have input layout qualifiers (Chapter 4.3.8.1). The 'location' qualifier on varyings is used in the shader interface matching defined in OpenGL ES 3.1. (OpenGL ES 3.1 SPEC Chapter 7.4.1). This new link rule will be added to Program.cpp in another patch. For the OpenGL ES 3.1 extension GL_OES_geometry_shader, according to GL_OES_shader_io_blocks SPEC (Chapter 4.4.1 and Chapter 4.4.2), 'location' layout qualifier is both valid on geometry shader inputs and outputs. This feature will be implemented together with other rules on geometry shader inputs and outputs. BUG=angleproject:2144 TEST=angle_unittests Change-Id: I62d85f7144c177448321c2db36ed7aaeaa1fb205 Reviewed-on: https://chromium-review.googlesource.com/645366 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 2a1e8f95 2017-07-14T11:49:36 Refer to GLSL extensions through TExtension enum Extensions are now referred to by enum values instead of strings most of the time. This gets rid of unnecessary copying of strings. The code is easier to work with than before as typoing the extension enum names will be caught by the compiler. BUG=angleproject:2147 TEST=angle_unittests Change-Id: Ifa61b9f86ef03211188fc23bc23a5ce4e4d8c390 Reviewed-on: https://chromium-review.googlesource.com/571002 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ec3a9cbb 2017-09-07T12:18:01 Only support GL_OVR_multiview extension variant The WebGL spec proposal was changed so that only GL_OVR_multiview extension name is supported, instead of having two variants OVR_multiview and OVR_multiview2. We're only supporting the WebGL version of the shader extension, so we drop compiler support for GL_OVR_multiview2. Shader restrictions were also removed from the WebGL spec, so no special validation for how ViewID_OVR gets used is needed. Tests that were testing for the shader restrictions are either removed or changed from negative tests to positive tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I83f92b879376d41b727b5aca419fd75fb6f53477 Reviewed-on: https://chromium-review.googlesource.com/654608 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill f00f7ffe 2017-08-31T14:39:15 Add a Uniform type info table. Currently most uniform type info is determined by switching on the uniform type. Some values are computed from other values, which can result in three or more switch statements plus some multiplies or other math. This patch attempts to improve the speed by pre computing necessary values into constant static tables. Improves performance by about 7% in a uniform stress test. BUG=angleproject:1390 Change-Id: I29bef259a17f6d6536171ade4950e2d712bfd39c Reviewed-on: https://chromium-review.googlesource.com/643791 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 855d964b 2017-05-17T14:05:06 Prefix user-defined names in GLSL output Now user-defined names are prefixed by _u in GLSL output in case name hashing is not on. Internal names such as names of temporary variables created in AST transformations are written out as such. This makes handling of internal function names and internal variable names consistent. It also removes the possibility of name conflicts between user-defined names and internal names in case name hashing is not on. In the same vein, it makes it safe to use GLSL reserved words that are not reserved in ESSL as variable names in case name hashing is not on. This also makes the GLSL output more consistent with how names are handled in HLSL output. Name hashing code is shared between VariableInfo and OutputGLSLBase to ensure names are handled consistently in both. The name that's used in the shader source for a given interface variable is written out to ShaderVariable::mappedName. An exception needs to be made for identifiers close to the length limit, since adding any prefix would take them over the limit. But they can be just written out as such, since we don't have any builtins or ANGLE internal variables that have as long names and could create a conflict. BUG=angleproject:2139 BUG=angleproject:2038 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: Id6ed052c4fab2d091227dc9a3668083053b67a38 Reviewed-on: https://chromium-review.googlesource.com/507647 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 97577623 2017-08-28T11:31:06 Fix assertion failure in CollectVariables.cpp The built-in gl_Layer can occur in the AST in cases in which either GL_OVR_multiview or GL_OVR_multiview2 is enabled. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I7409b2712c715c3898c33300b7e5689e347742f0 Reviewed-on: https://chromium-review.googlesource.com/636367 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao d27f5c8d 2017-08-23T09:38:08 ES31: Implement GL_OES_geometry_shader built-ins in GLSL compiler This patch intends to implement all built-in constants, variables and functions defined in OpenGL ES 3.1 extension GL_OES_geometry_shader in ANGLE GLSL compiler. 1. Add all built-in constants defined in GL_OES_geometry_shader. 2. Add built-in functions EmitVertex() and EndPrimitive() required in Geometry Shader. 3. Add built-in variables gl_PrimitiveIDIn and gl_InvocationID to Geometry Shader. 4. Add built-in variables gl_PrimitiveID and gl_Layer to both Geometry Shader and Fragment Shader when GL_OES_geometry_shader is enabled. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I92821553ed0efee2ccb77fead6e065e7799819d0 Reviewed-on: https://chromium-review.googlesource.com/627670 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Jiawei Shao d8105a03 2017-08-08T09:54:36 ES31: Implement gl_in in Geometry Shader This patch intends to implement geometry shader built-in interface block instance gl_in defined in GL_OES_geometry_shader. 1. Add the definition of gl_in and its interface block gl_PerVertex into the symbol table. 2. Support gl_Position as a member of gl_in. 3. Set the array size of gl_in when a valid input primitive type is known. 4. Add check that it should be a compile error to index gl_in or call length() on gl_in without a valid input primitive declaration. This patch also adds unit tests to cover all these new features. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1 Reviewed-on: https://chromium-review.googlesource.com/605059 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 78ed6cd9 2017-08-09T16:19:00 Rename VariableInfo files to CollectVariables Files that only have a single function should be named consistently with the function. Unnecessary include in CallDAG.h is removed. BUG=angleproject:2068 TEST=angle_unittests Change-Id: I27d55a766b9eb66fcfd1e0a2341a2843bb9dc5bb Reviewed-on: https://chromium-review.googlesource.com/608368 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>