src/libANGLE/Shader.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 67d8d8c8 2024-07-29T13:44:37 WebGL: Reject shaders with infinite loops Bug: chromium:350528343 Change-Id: I1b2fc152cf285b0e69c4c294351c1cf2389cc234 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746714 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang fcf3a1c0 2024-07-02T16:33:28 GL: Allow shader compilation with cached translated source Write the translated shader source when serializing shaders. This does not increase the size of the shader cache because Vulkan only uses the compiledBinary field. Spawn a ShaderTranslateTask for loading shaders so the GL backend can compile the shader on the native driver. Bug: angleproject:350779978 Change-Id: I14413a7ca2a0d99653a1082f2c8b4a94cf58626a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5672740 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang a4f3f6bf 2024-07-02T16:25:05 GL: Simplify members of ShaderGL. It does not need to store anything except the shader ID. Everything else can be queried from the context. Bug: angleproject:350779978 Change-Id: I202ae8e59e8c5b10ffb24f5454151b17818d400c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5672739 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 8346addb 2024-02-06T15:40:31 Contain X11 includes and free usage of common terms This change undoes workarounds where some terms were avoided so there is no clash with X11 (such as Success, Bool and None). In particular, this helps us make sure we never include the X11 headers in such an unconstrained manner as to clash with our code. Bug: angleproject:8520 Change-Id: I53d9657c5a33164064d2c80a206b96fd52f607f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5273491 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Shahbaz Youssefi 91c981c5 2024-01-11T22:37:48 Robust shader compile after shader binary is rejected If ANGLE finds a shader binary in the cache, it populates the compiled shader state. If the deserialization rejects the blob, the compiled shader state was not reset. After the rejection, ANGLE proceeds to redo the shader compilation, in which case it risks bugs as it tries to accumulate info on top of the previous half-complete shader state. Note that currently there are no errors if the shader state is not reset before compilation, so this change is merely a precaution. Bug: angleproject:8471 Change-Id: I2e08ecc2e5d940c88a32b5a05dca8afe8d8d897c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189154 Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Geoff Lang 820e0d7a 2023-11-29T13:39:27 Compute the shader hash without copying objects. The shader hash was calculated by generating a large string and then sha1 hashing the string. sha1 can be generated with a fixed memory cost using the angle::base::SecureHashAlgorithm class. Bug: angleproject:8434 Change-Id: I816e2c3bbc7283cd5424621b4cc8f6dab0407aa4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5073293 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 2a6336ed 2023-11-29T13:35:57 Don't construct a compiler instance on shader cache hits. We can avoid constructing a shader compiler instance and then destroying it when we get shader cache hits. The resources and output type are available from the root gl::Compiler object. Bug: angleproject:8434 Change-Id: I2de43db34dc1b86265aa648b1275e32814487ff4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5073292 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dd8432b5 2023-11-14T14:39:45 Remove angle::Result::Incomplete from shader/program paths angle::Result is not an error code, and having Incomplete made it very unclear what the purpose of this class is. A follow up will remove it entirely. Bug: angleproject:8414 Change-Id: Ica8271b9f7d8868671c7658161e50a53ef23c681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5028091 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ade3dacd 2023-11-06T21:56:41 Do compile/link unlocked if not threaded (but thread-safe) If GL_KHR_parallel_shader_compile is not supported, or it is not used to do threaded compilation and link, this change lets the compile and link jobs be done after releasing the share group lock. With multithreaded/multi-context applications, this allows the other context (typically the main context) to make progress in the meantime. A typical scenario where this optimization matters is games seamlessly loading a new area of the game and performing compilation and link in a separate context. Before this change, the game would stutter as the compile/link jobs prevent the main thread from drawing anything. With this change, the hitching is removed. Bug: angleproject:8297 Change-Id: I702d84324a7442561b49677bf42c16d650304313 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5006640 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 93b97a59 2023-11-03T22:07:23 Make link job directly wait on compile job Previously, program link waited on the compile job on the calling thread before launching the link job. As a result, sequences of intermixed compile and link would get largely serialized as such: Main Thread Thread 1 Thread 2 Thread 3 Thread 4 Compile -------> Compile Compile -----------|----------> Compile Link | | Wait | | | | | |<--------------/--------------/ \------------------------------------------> Link Compile -------> Compile | Compile -----------|----------> Compile | Link | | | Wait | | | | | | | |<--------------/--------------/ | \---------------------------------------------|-----------> Link Compile -------> Compile | | Compile -----------|----------> Compile | | Link | | | | Wait | | | | | | | | | ... With this change, the main thread no longer waits for compilation to finish. It's the link job itself that does the waiting. This allows the main thread to go through Compile and Link commands without blocking, generating as many jobs as needed. The above scenario therefore becomes: Main T1 T2 T3 T4 T5 T6 T7 T8 T9 C ----> C C ------|----> C L ------|------|----> L C ------|------|-------W---> C C ------|------|-------|-----|----> C L ------|------|-------|-----|------|----> L C ------|------|-------|-----|------|-------W---> C C ------|------|-------|-----|------|-------|-----|----> C L ------|------|-------|-----|------|-------|-----|------|----> L . \-----\------>/ | | | | | W . | \-----\------>/ | | | . | | \-----\------>/ . | | | . | | | This greatly improves the amount of parallelism compile and link jobs get. The careful observer may note that the link job being blocked on the compile job is now wasting a thread from the thread pool. While this change is strictly an improvement, parallelism can be further improved if the link job is just not assigned to a thread until the corresponding compile jobs are finished. This is currently not possible, but may be if: - Instead of a thread pool, the operating system's FIFO scheduler is used. Then the operating system would automatically put blocking tasks to sleep and pick up another task. This has the downside of requiring threads to be created for each task. - The thread pool work scheduler is enhanced to be made aware of relationship between tasks and avoid scheduling jobs whose dependencies are not yet met. Alternatively, the number of threads in the pool can be increased by 30% and hope for the best. Bug: angleproject:8297 Change-Id: If4e6540ade47558a10cfab55e2286f073b904928 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5006874 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi a494c1d6 2023-11-07T16:29:07 GL: Fix compilation on drivers sensitive to initial comment Prior to https://chromium-review.googlesource.com/c/angle/angle/+/4994655, debug info was **prepended** to the translated source in the form of a comment after the compilation was done. In that change, this was done after translation and before the translated source was handed to the backend compiler. Some GL drivers however failed to compile the shader after this change because the #version line was no longer the first one in the shader. This is fixed by **appending** the debug info instead. Bug: angleproject:8297 Change-Id: I88b31fa128de304dc8bf32289bf20a29169883a8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5007223 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi c114fc26 2023-08-28T15:40:26 Reland: Verify shader link correctness after looking up in program cache Since the program cache takes shader sources into account, if the cache is hit the shaders should have been correct for link. Bug: angleproject:8297 Change-Id: Iccadc63a976689d7fa06d0a5ccfe81a594c424e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5003236 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5a71be90 2023-11-03T15:07:06 D3D: Make non-constant loop indexing limitation a feature flag ... instead of exposing it as a front-end limitation only to set a shader flag in the front-end. Bug: angleproject:1130 Change-Id: Idbd9a1b7b79d231bd9fc1c0061c768df4aaab92d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5004847 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi e7ce481f 2023-11-01T22:44:22 Consolidate parallel compilation in front-end This cleans up the multiple compilation task implementations in the backends and consolidates them in the front-end. The front-end is then able to do the compilation in an unlocked tail call instead if desired (in a future change). This change is in preparation for having the program link tasks directly wait on the shader compilation tasks. As a result, the "shader resolve" should not be needed to access the shader compilation results; it should be enough to wait for the compilation job. This change therefore moves post-processing of results to the compilation job itself as they did not need to actually be done after compilation is done (merely after translation is done). As a side effect, shader substition and other debug features should now work for the GL backend as they are now done before back-end compilation. Bug: angleproject:8297 Change-Id: Ib9274b1149fadca7545956a864d6635b6cba5c3a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4994655 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 34c8778b 2023-09-26T13:45:06 Use atomic counters early in perf warning macros Before this CL, snprintf was called repeatedly to format the warning message which was then discarded after 4 logs. snprintf showed up in profiling at ~2% and this CL appears to yield an ~8% power improvement in one of the traces (egypt_1500). A mutex was previously used to avoid the race condition on the static sRepeatCount variable. This CL avoids the need for that by using static atomics instead. Also updated the Debug macro to use the VK macro vararg approach so that formatting only happens when the message is actually logged. Bug: b/302112423 Change-Id: Ia8a18361cfb5a9f2aa19ff939499754ba861efb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4886388 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi 68bfa1ed 2023-08-22T22:02:15 Support for link to be entirely parallelized The link job is split as such: - Front-end link - Back-end link - Independent back-end link subtasks (typically native driver compile jobs) - Post-link finalization Each step depends on the previous. These steps are executed as such: 1. Program::link calls into ProgramImpl::link - ProgramImpl::link runs whatever needs the Context, such as releasing resources - ProgramImpl::link returns a LinkTask 2. Program::link implements a closure that calls the front-end link and passes the results to the backend's LinkTask. 3. The LinkTask potentially returns a set of LinkSubTasks to be scheduled by the worker pool 4. Once the link is resolved, the post-link finalization is run In the above, steps 1 and 4 are done under the share group lock. Steps 2 and 3 can be done in threads or without holding the share group lock if the backend supports it. Step 2 is not yet made independent of the Context on some backends, and a frontend feature is used to make that step either run on the main thread or as a worker thread. Bug: angleproject:8297 Change-Id: I12f1e6bbaf365543dfcac969e166e0b5aa622104 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4808191 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f3c1de36 2023-08-17T15:29:24 Make shader recompile while parallel linking safe Prior to this change, Program* objects held references to Shader* objects. This poses a problem where a shader recompile can race with a program link, if the program link is done in parallel. As a result, a good chunk of the link job is done serially and under the share group lock. After this change, that is no longer a problem, and most of the link can be made lockless/parallelized. This change separates out the "compiled state" from the rest of the shader state. This was already done for the front-end state (for the sake of caching), but is also now done for the backends that need it. The compiled state in turn is placed in a shared_ptr, and is shared with the program. When a shader is compiled, its own shared_ptr is replaced with a new object, leaving all programs currently compiling unaffected and using the previous compilation results. Once a program is linked, its references to compiled shader states is updated. Bug: angleproject:8297 Change-Id: Iff7094a37088fbad99c6241f1c48b0bd4c820eb2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4791065 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 4ba4af61 2023-08-17T11:28:18 Revert recompile blocking on link Causing timeouts on some platforms. An alternative implementation will follow. This change also reverts two changes that depend on it: Vulkan: Move SPIR-V set up to link job 10f54902e816fa7e4cf314384e00590e2b9bfa1d. Vulkan: Move default uniform init to link job d8cd4dcdc9c55c88f030f7fca41357e99e600ed2. Bug: angleproject:8297 Change-Id: I9a258460e7bcaeac214be5e63c16c20681e0bcde Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4789843 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 78de02ab 2023-08-16T15:23:23 Warn only once for shader recompile during link Bug: angleproject:8297 Change-Id: Ia6ac89e4c474ff51c36fcc3506d9178f6a4aedaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4785947 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 424f43e4 2023-08-11T17:07:16 Prevent shaders from recompiling while a link job is in progress This will prevent a guarantee that link jobs can take further advantage of. In particular, a good chunk of the link job is done serially and under the share group lock due to this recompile-while-link issue. After this change, that is no longer a problem, and most of the link can be made lockless/parallelized. Bug: angleproject:8297 Change-Id: Ic41ac62fb8c40131a69cd90fa9430584964677fa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4776338 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell d2236b58 2023-07-29T23:50:05 Support substituting translated shaders. Add dumpTranslatedShaders and enableTranslatedShaderSubstitution frontend ANGLE features, which allow ANGLE developers to prototype optimizations and other transforms without fully implementing them in the shader translator. Tested on macOS with ANGLE's Metal backend, but should work with the other source-level translator backends. Add documentation for pre-existing substitution of shader sources, and of translated shaders added in this CL. Fixed: angleproject:8280 Change-Id: I24d5ef88a479b23e81cc8169fe813c263acfc71f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4731553 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi f5ad056b 2023-07-10T22:13:34 GL: Fix ScalarizeVecAndMatConstructorArgs and move to gl/ This transformation was buggy and was disabled. Originally, it was intended to be used everywhere. It is now needed for a GL driver workaround. This change reimplements this transformation and uses it as a GL workaround. Bug: chromium:1420130 Change-Id: I42d63fa5844bcf683ac41e61925aa637e033ca2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4676634 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Steven Noonan 041e2731 2023-06-19T19:27:09 optimize glShaderSource string concatenation This optimizes for both memory usage and time. Before this change, we had a redundant copy of the shader source fragments in memory: - The user application - The ostringstream buffer - The final concatenated string The second one can be avoided by not using ostringstream. The second issue is that ostringstream will reallocate as we fill it, and depending on the number of input strings (and their size), it may reallocate several times. Since we aren't doing anything particularly fancy with the ostringstream, we can just preallocate the appropriately sized string and fill it with the input strings all at once. If we don't mind taking an additional dependency on abseil-cpp, this could also be implemented with absl::StrJoin, but it seems like a heavy dependency for something relatively simple. Tests run: GLSLTest.*ShaderLength* Bug: angleproject:8219 Change-Id: Idba277e7860116f858e7a86f4b03420dd383a52f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4627282 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Roman Lavrov 21f16cb1 2023-06-09T17:30:38 Disable clang-format on ANGLE features autogen outputs Updates the script to produce reasonably formatted code without clang-format. Autogen files moved to autogen/ sub-directories because clang-format does not support per-file settings ;( This allows to run this codegen very quickly (~50ms on my machine) Bug: angleproject:8193 Change-Id: Ie84282090d574ebb4debe3edcfd82f983f27a5ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4604578 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 02e7f967 2023-05-25T14:54:49 Translator: Remove the "variables" option Variable collection is invariably enabled by the front-end as well as other major users of ANGLE such as Firefox. All translator backends except GLSL force-enable variable collection either way. This change removes this compile option and enables variable collection unconditionally. The flag itself remains in ShCompileOptions until references to it are removed from Chromium. Bug: chromium:1447314 Change-Id: I4d3b30c1bfbd345c5ad269abc62c0a6a59de2f56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568524 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang be5e767e 2023-02-01T11:03:26 dump_shader_source: Also dump program links. When the dump_shader_source is enabled, dump a small file for each program link containing which shaders were attached to the program. This allows us to build perf tests knowing which shaders can link together. Bug: angleproject:7760, chromium:1385510 Change-Id: I0713e9f04cc157c3a3eeeec6d597db27b08575d1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4214011 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Mohan Maiya 1d9b8d80 2023-01-24T16:50:32 Reland "Add support for glShaderBinary" This is a reland of commit 228973e73135924ddf6116e0b63eff5a1ccbf232 with the following fixes - 1. Apply patch from Yuly to fix chromium build errors 2. Fix ShaderBinaryTest instantiation call 3. Add ShaderBinaryTest to expectations file for IOS Original change's description: > Add support for glShaderBinary > > This patch adds the following - > 1. ANGLE_shader_binary extension and GL_SHADER_BINARY_ANGLE token. > 2. Compiler support to generate shader binaries. > 3. Update compiler to use SH_SPIRV_VULKAN_OUTPUT as output type for > Vulkan translator. > 4. Support to load GL_SHADER_BINARY_ANGLE binaries. > 5. end2end tests for glShaderBinary. > > Tests: ShaderBinaryTest* > Bug: angleproject:7833 > Change-Id: I191d5ba7c4d5304696f5e743c851dc945fa57858 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4137306 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: mohan maiya <m.maiya@samsung.com> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:7833 Change-Id: I21135c52e2bae955342a99aff5631ba0e687eff1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4195852 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 18657894 2023-01-25T13:05:56 Add features to dump and replace shader source. dump_shader_source writes shader source strings to files named with the hash of the source and shader type. enable_shader_substitution allows subsituting the shader source with the strings contained in a file. The same file naming scheme as dump_shader_source is used so shaders can be dumped in one run, modified and subsititued in the next run. Use the ANGLE_SHADER_DUMP_PATH and debug.angle.shader_dump_path environment variables to control where files are written. If they are unspecified, write to the temp directory. Based upon Cody's CLs: https://chromium-review.googlesource.com/c/angle/angle/+/2755841 https://chromium-review.googlesource.com/c/angle/angle/+/3961670 Bug: angleproject:7760, chromium:1385510 Change-Id: I43b9827b977079b88daa794e867637f7a126b080 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4192347 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Yuly Novikov 0c9cbf39 2023-01-26T12:07:51 Revert "Add support for glShaderBinary" This reverts commit 228973e73135924ddf6116e0b63eff5a1ccbf232. Reason for revert: breaks compile on ANGLE into Chromium roll https://cr-buildbucket.appspot.com/build/8790942326644064097 https://cr-buildbucket.appspot.com/build/8790942759045412865 https://cr-buildbucket.appspot.com/build/8790942417069789217 Leaks detected on ASAN https://cr-buildbucket.appspot.com/build/8790946657703508337 Original change's description: > Add support for glShaderBinary > > This patch adds the following - > 1. ANGLE_shader_binary extension and GL_SHADER_BINARY_ANGLE token. > 2. Compiler support to generate shader binaries. > 3. Update compiler to use SH_SPIRV_VULKAN_OUTPUT as output type for > Vulkan translator. > 4. Support to load GL_SHADER_BINARY_ANGLE binaries. > 5. end2end tests for glShaderBinary. > > Tests: ShaderBinaryTest* > Bug: angleproject:7833 > Change-Id: I191d5ba7c4d5304696f5e743c851dc945fa57858 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4137306 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: mohan maiya <m.maiya@samsung.com> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:7833 Change-Id: Ice19576acbc1351810ff0cd769ac17ad6c0abdf3 No-Try: true No-Presubmit: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4197375 Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Mohan Maiya 228973e7 2023-01-24T16:50:32 Add support for glShaderBinary This patch adds the following - 1. ANGLE_shader_binary extension and GL_SHADER_BINARY_ANGLE token. 2. Compiler support to generate shader binaries. 3. Update compiler to use SH_SPIRV_VULKAN_OUTPUT as output type for Vulkan translator. 4. Support to load GL_SHADER_BINARY_ANGLE binaries. 5. end2end tests for glShaderBinary. Tests: ShaderBinaryTest* Bug: angleproject:7833 Change-Id: I191d5ba7c4d5304696f5e743c851dc945fa57858 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4137306 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya ab334105 2023-01-23T10:09:56 BuiltInResourcesString is no longer a part of shader cache key The stringified version of `ShBuiltInResources` is poorly maintained and has a large overhead while computing hashes. Instead use the `ShBuiltInResources` blob directly. The shader object now computes and caches its key, refactor MemoryProgramCache to query the shader object for its key instead of recomputing it. Tests: EGLProgramCacheControlTest* Bug: angleproject:7833 Change-Id: I67a22f9460cee10ab0f7571df7d6525b476a5a78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4185759 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya cc34aa73 2022-12-19T14:03:27 Move BinaryStream to common and expose ShaderState to compiler This is a refactor change in preparation for adding support for glShaderBinary. Move BinaryStream to common so that it is accessible by both libANGLE and the Compiler. Extract members that hold the result of compilation from ShaderState and move into new CompiledShaderState struct. Move helper functions & classes relevant to ShaderVar serialization to the CompiledShaderState header. Tests: EGLBlobCacheTest* Bug: angleproject:7833 Change-Id: I7ec575247eccb3afbc6ab6bfa24d36e69d4576f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4080998 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Alexey Knyazev 91a5635a 2022-12-16T00:00:00 Support arbitrary clip and cull distance array sizes Removed limitSimultaneousClipAndCullDistanceUsage cap. Enhanced HLSL translator to support all valid combinations of clip and cull distances. Validate that these arrays are sized explicitly or by using only constant indices; adjusted link program error message. Enhanced tests to cover all possible combinations of implicit and explicit array sizes for both built-ins. Bug: angleproject:4452 Change-Id: I704db6dc3c8951e5ba482a3e4dad09e5b0182f9c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4111645 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 28e7adca 2022-12-09T00:00:00 GL: Implement clip distance state emulation Pass the current set of enabled clip distances to vertex shaders via an internal uniform and dynamically set disabled elements to zero. Bug: angleproject:7880 Change-Id: I709d31dc7ca0606decf49adf674460a941837683 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4094314 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop 3f9223b2 2022-11-15T20:31:55 Shader: Initialize mMaxComputeSharedMemory Uninitalized values are causing retrace failures. mMaxComputeSharedMemory is otherwise only set when the shader is compiled. Test: retrace_restricted_traces.py Bug: angleproject:7815 Change-Id: I9884ac3c8550775d435d6fa7b11d7aebc63c14d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4026669 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Alexey Knyazev 805e00b8 2022-10-27T00:00:00 D3D11: Add clip and cull distance support Added gl_ClipDistance and gl_CullDistance support to HLSL translator. Added enabled clip distance GL state emulation. Added limitSimultaneousClipAndCullDistanceUsage limitation. Expanded and optimized related end2end tests. Bug: angleproject:4452 Change-Id: Id66312505254ceff43d5258d486ddcdb0462db47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3990944 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Eddie Hatfield ba4b6913 2022-08-23T09:34:27 Fix data race in BlobCache * Re-enable shader cache feature * Improve BlobCache thread-safety test * Improve EGLProgramCacheControlTest to not check the size of the BlobCache, since the shader cache interferes with this. * Include the arguments to ConstructCompiler() and Compile() in the key hash for the shader cache. Bug: angleproject:7036 Change-Id: Ied4e11f9160552f2f9358d99b5656315239ba856 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3851161 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Eddie Hatfield <eddiehatfield@google.com>
Eddie Hatfield 955adb77 2022-08-12T10:14:48 Cache compiled shader By storing the compiled shader in the blob cache, the time to recompile the same shader is reduced. Based on work by <hckim.kim@samsung.com> Bug: angleproject:7036 Change-Id: I884ae40e715c49a9ccd12903012e8327811e3557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3808235 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Eddie Hatfield 2ebd5100 2022-08-11T10:43:32 Add gl::Context as a parameter to Shader::resolveCompile This prepares us to access the Context's shader cache in resolveCompile in the next commit. Bug: angleproject:7036 Change-Id: I7995c54b290a5a48f0c8985cb56ea0048598ab2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3827642 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 493b5aff 2022-08-09T14:57:24 Vulkan: Workaround ARM bug with stencil write mask Bug: angleproject:7556 Change-Id: I0aa17c178071cc15d8ee15f700b0c4932819c72a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3821367 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
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>
Mark Lobodzinski fb3e2def 2022-05-24T15:47:01 Extend labelObject functionality Modify interface to fully support labelObject return codes. Fix issues with texture implementation, including handling deferred Vulkan object creation. Bug: b/229105865 Change-Id: I0c64b72dd0b54642fb643ee7f5ccbb2a134c6787 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3703184 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi fea19567 2022-05-17T17:44:06 Vulkan: Remove removeEarlyFragmentTestsOpt flag * Removed removeEarlyFragmentTestsOptimization and the related SPIRV transformation and variables. * Removed mUsesEarlyFragmentTestsOptimization. * Removed SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION. * Merged updateUsesEarlyFragmentTestsOptimization() into updateFragmentInoutRange(). Bug: angleproject:7347 Change-Id: I7299bd4e8ab5363e5cf06eb48419d4f469106e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3648217 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 5113ae8e 2022-04-29T22:42:59 Vulkan: Explicitly enable per-sample shading if `sample` used The Vulkan spec is not explicit about the `Sample` decoration implicitly enabling per-sample shading. While this is being corrected in the spec, the ARM Vulkan driver does not have this implicit behavior. A workaround is added such that the usage of the `sample` qualifier is reported, and used to explicitly enable per-sample shading through the API. Bug: angleproject:6876 Change-Id: Idb8345aacdcfa45cb37fefcd30aa5405168d21e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3615738 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 400d9fe4 2022-04-23T01:08:19 Rename feature files to *_autogen.h To clarify further that they are not to be edited by hand. Bug: angleproject:6435 Change-Id: Iaf79706d2b688a43b3ebb65700cfbdd71a49a742 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3603842 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7a85d114 2022-03-25T15:01:17 Use [[nodiscard]] on RAII classes Scoped* classes provide an RAII way of adding cleanup/restore state/etc in a robust way. Unfortunatley, it's very easy to mistakenly leave the variable name, leading to the destructor being called immediately instead of at the end of the scope: { ScopedX(parameters); // instead of ScopedX x(parameters); // Code here is run after destructor } The [[nodiscard]] attribute, if specified on the ScopedX class would lead to a warning (turned to error with -Werror). This change does that for classes named *Scoped* in ANGLE. Bug: chromium:1103817 Change-Id: I65c9922c9b4eba1f9c033e093fe8fe534648ab62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3552092 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3ddb21fd 2022-02-23T14:15:48 Front-end support for KHR_blend_equation_advanced Bug: angleproject:3586 Change-Id: I27086295e7455ce8848db1c6004917fea40202e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484785 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov f64f9546 2021-12-07T20:17:32 Reland "Decouple gl_BaseVertex/gl_BaseInstance uniforms" This reverts commit 10e5f34d1439f0bcd5b30bea5bfbf6bdaafd4935. Reason for revert: exonerated from flaky crash suspect Original change's description: > Revert "Decouple gl_BaseVertex/gl_BaseInstance uniforms" > > This reverts commit 36bf1ebe5e9500704dd235254bd22a1f2bbd7059. > > Reason for revert: suspect causing flaky crashes > > Bug: angleproject:6763 > > Original change's description: > > Decouple gl_BaseVertex/gl_BaseInstance uniforms > > > > These are builtin uniforms removed in > > https://github.com/KhronosGroup/WebGL/pull/3278 > > > > Decouple them from the original ANGLE_base_vertex_base_instance > > extension. > > > > Make a new ANGLE_base_vertex_base_instance_shader_builtin > > extension for these builtin uniforms. > > > > Bug: angleproject:3402 > > Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 > > Commit-Queue: Shrek Shao <shrekshao@google.com> > > Reviewed-by: Geoff Lang <geofflang@chromium.org> > > Reviewed-by: Kenneth Russell <kbr@chromium.org> > > Bug: angleproject:3402 > Change-Id: I75830baa14cf4e7c53750fd14ff76501145b4823 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315610 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Reviewed-by: Yuly Novikov <ynovikov@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> > Commit-Queue: Shrek Shao <shrekshao@google.com> Bug: angleproject:6763 Bug: angleproject:3402 Change-Id: Ie436dc5d55364e464897d407a53b793941cd5d0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3321703 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shrek Shao 10e5f34d 2021-12-04T00:10:21 Revert "Decouple gl_BaseVertex/gl_BaseInstance uniforms" This reverts commit 36bf1ebe5e9500704dd235254bd22a1f2bbd7059. Reason for revert: suspect causing flaky crashes Bug: angleproject:6763 Original change's description: > Decouple gl_BaseVertex/gl_BaseInstance uniforms > > These are builtin uniforms removed in > https://github.com/KhronosGroup/WebGL/pull/3278 > > Decouple them from the original ANGLE_base_vertex_base_instance > extension. > > Make a new ANGLE_base_vertex_base_instance_shader_builtin > extension for these builtin uniforms. > > Bug: angleproject:3402 > Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 > Commit-Queue: Shrek Shao <shrekshao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> Bug: angleproject:3402 Change-Id: I75830baa14cf4e7c53750fd14ff76501145b4823 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315610 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
Shrek Shao 36bf1ebe 2021-11-17T13:31:17 Decouple gl_BaseVertex/gl_BaseInstance uniforms These are builtin uniforms removed in https://github.com/KhronosGroup/WebGL/pull/3278 Decouple them from the original ANGLE_base_vertex_base_instance extension. Make a new ANGLE_base_vertex_base_instance_shader_builtin extension for these builtin uniforms. Bug: angleproject:3402 Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Jamie Madill 1ca1589f 2021-09-13T10:56:58 Give GLES extension bools a vendor suffix. This is in preparation for auto-generation which will give all of these bools suffixes. Bug: angleproject:6379 Change-Id: I7e3f6c9b644c41a2165e6bf7b62d661fd352a250 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3158503 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b6e99bb3 2021-09-02T13:47:34 Rename and expand shader variable init feature. This feature now forces both output and unitialized locals to be initialized by the shader translator. This feature is needed by the trace validator to ensure we get deterministic behaviour in traces that exhibit some undefined results. Bug: angleproject:5133 Change-Id: Id1242cd077a57e891eed217f7671976ce1631a58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140216 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2f45d93d 2021-08-18T16:58:44 Capture/Replay: Init shader outputs during self-tests. This forces all uninitialized variables to have default values. For instance if the application doesn't initialize the output color, or a varying that's use in the output, this will ensure we don't use any undefined values in the computation. Found when working on a re-trace of T-Rex, which doesn't write to the alpha channel in the final rendering pass. Also fixes undefined values in GLSLTest.InactiveVaryingInVertexActiveInFragment. Bug: angleproject:5133 Change-Id: Ia291338e5adf23dab5263cb2ebe737dc05852d3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3110225 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 776c6015 2021-02-26T00:00:57 Vulkan: Call glslang at compile time With this change, the ANGLE translator immediately compiles the generated GLSL into SPIR-V with glslang and discards the source. This is in preparation for generating SPIR-V directly, by making the frontend and backend already able to digest it. This change also allows the expensive glslang calls to be parallelized, improving the following perf test by about 20%: LinkProgramBenchmark.Run/vulkan_compile_and_link_multi_thread Previously, the test was run as such in the Vulkan backend: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator <--- <--------------------- Link glslang for shader1 glslang for shader2 Done With this change, it is run as such: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator glslang glslang <--- <--------------------- Link Done glslang_wrapper_utils no longer interacts with glslang! A rename will follow. Bug: angleproject:4889 Change-Id: If4303e8ba0ba43b1a2f47f8c0a9133d0bee1a19a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2721195 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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 b912eec5 2020-11-27T11:08:41 Vulkan: Support GL_EXT_tessellation_shader. Shader translator changes done in http://crrev.com/c/2633936 Adds a new DIRTY_BIT_PATCH_VERTICES state to Context. Supportes state query and transform feedback. 4 test suppressions remain as follow-up fixes. Adds a new varying packing mode for a simple Vulkan rule set. Based on work by Mohan Maiya (m.maiya@samsung.com). Test: dEQP-GLES31.functional.tessellation.* Bug: angleproject:3572 Change-Id: I4cad2cca30adb754fd12c83027673906541f566a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568234 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8065aa82 2020-12-22T23:38:42 Front-end support for xfb capture of I/O block members Validation and generation of transform feedback varyings that specify an I/O block member are implemented in this change. The GL backend is able to pass the added tests. Bug: angleproject:3606 Change-Id: I66d02bed8ca9161555d0d1e7a32ae9ef4d9e813f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2599952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 24f64249 2020-11-16T17:55:02 Vulkan: Track specialization constant usage bit and feedback to ctx Right now context does not know which specialization constant is used by the shader. Whenever a specialization constant changes, we assume shader program is using it, we always reach into vulkan driver to ask for a new program. Instead we can track shader's usage of specialization constant so that context can utilize this information to avoid recompile pipeline program if an unused specialization constant has changed. This CL implements the plumbing the usage bits form compiler to program object, it does not actually utilize the usage bits to avoid unnecessary compilation yet. Bug: b/173461931 Change-Id: Iebc9d0638c17b1a282c8b6093ce6bae154246e57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2542866 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill a8d4457c 2020-10-02T23:51:57 Change shader compile failures into an info message. This reduces spam in our unit tests. Speeds up test execution. Bug: angleproject:3162 Change-Id: I286a18b3ce862c4e4155076b2ee3f93c9db2eb33 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2447041 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 7a0faa82 2020-09-24T20:15:26 Revert "Pass #pragma optimize setting down to compilation." This reverts commit 499173de1c91932ba272269cab6918bf7e8d7c11. Reason for revert: Causes unexpected HLSL compiler errors in some cases. See bug. Bug: angleproject:5094 Original change's description: > Pass #pragma optimize setting down to compilation. > > This will allow us to disable optimizations in the back-end. This can > be useful both for developers and for ANGLE to disable very slow > shader compilation on D3D11. > > Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers. > Reduces compilation time by half in local testing. > > Bug: angleproject:5076 > Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> TBR=geofflang@chromium.org,jonahr@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:5076 Change-Id: I733e788fe8e9421ae0af662c0eb51af1ed79dde3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2429517 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 499173de 2020-09-20T10:42:56 Pass #pragma optimize setting down to compilation. This will allow us to disable optimizations in the back-end. This can be useful both for developers and for ANGLE to disable very slow shader compilation on D3D11. Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers. Reduces compilation time by half in local testing. Bug: angleproject:5076 Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Philip Lamoureux 9515707b 2020-05-29T11:23:44 Move ShaderVariable utility function from utilities.cpp ShaderVars.cpp. Fixes an implied dependency cycle between translator and angle_common. This will also allow us to be more strict about declaring dependencies on GLSLANG headers. Tested by building and running angle_unit_tests on Linux. Bug: angleproject:4672 Change-Id: I331230d2cf179ccea140ee7a0d5a3c8768c58cb1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2222682 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao dee4d7a5 2020-04-10T10:22:56 Vulkan: Early fragment tests optimization Checks if early fragment tests as an optimization is feasible and enable it if we can. In the link time, if context state diagrees with optimization (in rare case), then remove the ExecutionModeEarlyFragmentTests sprv op code. Bug: angleproject:4508 Change-Id: Ifbb06c0ffb050a9f3ddb16ab50362e908b4b9cf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136490 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
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>
Xinyi He 4c7db77e 2019-10-31T15:42:31 Vulkan: Set limitation on maxComputeWorkGroupCount According to Table 20.45 and Chapter 17 in the ES 3.1 spec, MAX_COMPUTE_WORK_GROUP_COUNT is get as a GLint by using GetIntegeri_v. However, it is an unsigned integer in the Vulkan. It needs to set limitation on maxComputeWorkGroupCount[] during translating. 1. Change the data type to GLint stored in Caps. 2. Ensure that the limitation is set during initialization. 3. Add workaround for angleproject:4120 Bug: angleproject:4066 Change-Id: I1659ba1d560e30b9599cace0feeab8a18890c3ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1890586 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> 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>
Jaedon Lee a0159c03 2019-09-02T14:49:07 Vulkan: Implement basic geometry shader feature Enable the default behavior of the geometry shader Bug: angleproject:3571 Test: dEQP-GLES31.functional.geometry_shading.input.basic_primitive.points dEQP-GLES31.functional.geometry_shading.input.basic_primitive.lines dEQP-GLES31.functional.geometry_shading.input.basic_primitive.line_loop dEQP-GLES31.functional.geometry_shading.input.basic_primitive.line_strip dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangles dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangle_strip dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangle_fan Change-Id: I65708d19bbfe6a0ad8ca392a1d6b3609b1410ef4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1793753 Commit-Queue: Jamie Madill <jmadill@chromium.org> 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>
Jiacheng Lu 120b61d3 2019-08-21T12:51:58 Use ShaderProgramID in place of GLuint handles Bug: angleproject:3804 Change-Id: I5dc640004c2cc054c53261e8e939b6a9f5fc23bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1762363 Commit-Queue: Jiacheng Lu <lujc@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Tim Van Patten 5d27a696 2019-08-13T11:29:07 Support separable shader programs The spec states: Shader stages including vertex shaders, fragment shaders, and compute shaders...A single program object can contain all of these shaders, or any subset thereof. This change allows shader programs without a fragment shader. The biggest driver of this change is dEQP since a large number of tests create shader programs without a fragment shader. Bug: angleproject:3803 Test: dEQP-GLES31.functional.program_interface_query Change-Id: Id6cb098c62a1489a14b9ec1b31bd4cd59f655e49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1752010 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
shrekshao cd31f286 2019-06-25T14:22:41 Implement Draw base vertex and base instance functions This patch implements functionality of glDrawArraysInstancedBaseInstanceANGLE, glDrawElementsInstancedBaseVertexBaseInstanceANGLE, glMultiDrawArraysInstancedBaseInstanceANGLE, and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE Workaround for OpenGL driver on Mac: gl_VertexID on Mac with AMD GPU doesn't include baseVertex value. So replace gl_VertexID with (gl_VertexID + angle_BaseVertex) if any. Workaround for Vulkan GLSL: gl_InstanceIndex on Vulkan includes baseInstance. So replace gl_InstanceIndex with (gl_InstanceIndex - angle_BaseInstance) when angle_BaseInstance is declared. Bug: chromium:891861, angleproject:3402 Change-Id: Ia1d94b5d4d7da7e635468c05c962c4f7eb1b1919 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750126 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
James Dong 1d5aaa6c 2019-08-06T11:20:13 Vulkan: support dynamic indices in array of arrays Expands existing struct-sampler rewrite to flatten arrays of arrays. This allows us to support dynamically-uniform array indexing, which is core in ES 3.2. Samplers inside (possibly nested) structs are broken apart as before, and then if the type resulting from merging the array sizes of the field and its containing structs is an array of array, the array is flattened. Also adds an offset parameter to functions taking in arrays to account for this translation. As a result of outer array sizes leaking into function signatures, functions taking arrays of different sizes are duplicated according to how the function is invoked. Bug: angleproject:3604 Change-Id: Ic9373fd12a38f19bd811eac92e281055a63c1901 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744177 Commit-Queue: James Dong <dongja@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
Geoff Lang bce4b9f8 2019-06-19T16:20:09 Always scalarize mat and vec constructor arguments. This workaround is always enabled in Chrome, do the same in ANGLE. BUG=882580 Change-Id: I2c01f34a589b07bd0035d7408be884f7a51b1706 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666699 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 051b0896 2019-04-15T15:39:39 Vulkan: Fix layout substitution for struct varyings If the shader contains code such as the following: struct S { vec4 field; }; out S varStruct; The layout qualifier macro is defined as @@ LAYOUT-varStruct @@. However, the Vulkan backend was replacing @@ LAYOUT-field @@. Bug: angleproject:3220 Change-Id: Iae15003867e0bed2cc939159a6653429c7a431e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1571389 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
jchen10 7d53c60b 2019-02-15T21:06:42 ParallelCompile: use the native extensions This enhances to use the native parallel compile extensions if available. Bug: 873724 Change-Id: I0aaed314accd75e1bfa596b322225b56d729d3a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1475234 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 aead8edf 2019-02-13T13:55:09 Mute worker context creation warnings This moves the warnings to InfoLog. Bug: chromium:931294 Change-Id: I1627aa63bdda6f92fc89b8921eb260302ba9063f Reviewed-on: https://chromium-review.googlesource.com/c/1469721 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
jchen10 a100d8f4 2018-12-29T16:39:55 ParallelCompile: add GL backend support For GL backend, at first each worker thread must have a naitve context for its own to work in. These worker contexts have to be shared from the main context, so that all shader and program objects are seen in any context. This extends backend displays to create and destroy the worker contexts. RendererGL manages and allocates them to the worker threads. ShaderImpl has a new compile method added to do the actual glCompile work in worker thread. The ProgramGL's link method is broken down by introducing the LinkEventGL class. Bug: chromium:849576 Change-Id: Idc2c51b4b6c978781ae77810e62c480acc67ebb5 Reviewed-on: https://chromium-review.googlesource.com/c/1373015 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e90d4ee9 2018-11-28T14:04:00 Pass Context to setLabel. This is useful for triggering a dirty state notification for Textures. It will lead to improvements for program and texture dirty bits. Bug: angleproject:2966 Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a Reviewed-on: https://chromium-review.googlesource.com/c/1347669 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
jchen10 cd47a379 2018-11-11T11:08:16 Add SH_INIT_SHARED_VARIABLES flag This option is used to initialize shared variables to zero at the beginning of shader execution to avoid compute shaders being able to read undefined values that could be coming from another webpage or application. It's implemented by declaring variables with initial value for HLSL. For GLSL, it's not allowed to use declaraction initializer for shared variables, so we need to explicitly assign them to zero at the beginning of main(). This implementation is only for HLSL. Bug: chromium:898030 Change-Id: Ic5906500bf4a35cd9a071923f82f32c5e2991be3 Reviewed-on: https://chromium-review.googlesource.com/c/1330310 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Austin Eng 1bf18ce9 2018-10-19T15:34:02 Implement GL_ANGLE_multi_draw This patch adds entrypoints glMultiDrawArraysANGLE, glMultiDrawElementsANGLE, glMultiDrawArraysInstancedANGLE, annd glMultiDrawElementsInstancedANGLE Bug: chromium:890539 Change-Id: Ic9c374c53892460f44ca6e73a253b78473ac2dff Reviewed-on: https://chromium-review.googlesource.com/c/1282268 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
jchen10 a155bacf 2018-08-16T15:26:39 ParallelCompile: Parallelize shader translation This changes to construct a new ShHandle of compiler for each Shader, and use it to translate the shader source in a background thread. Bug: chromium:849576 Change-Id: Ib49952c7292321ee6aa1c5996f8f7927f40d8f04 Reviewed-on: https://chromium-review.googlesource.com/1177195 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 3fd614d0 2018-08-13T12:21:58 Refactor Context dependency for resolveCompile The context parameter of Shader::resolveCompile method causes a bad impact that many methods in Shader, Program etc. have to have a same context parameter. By removing it, these methods can be decoupled from Context. BUG=chromium:849576 Change-Id: Ia5545ee9dce45794550f6086bc0e6c4707e1276e Reviewed-on: https://chromium-review.googlesource.com/1172202 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Xinghua Cao 77a2b4c3 2018-05-21T17:28:29 Validate the total invocations within a work group If the total number of invocations within a work group is greater than MAX_COMPUTE_WORK_GROUP_INVOCATIONS, a compile-time error will occur. BUG=angleproject:2572 TEST=dEQP.GLES31/functional_debug_negative_coverage_callbacks_compute_invalid_maximum_work_group_sizes dEQP.GLES31/functional_debug_negative_coverage_log_compute_invalid_maximum_work_group_sizes dEQP.GLES31/functional_debug_negative_coverage_get_error_compute_invalid_maximum_work_group_sizes Change-Id: I8218b618d1b347df2c85cfc67ba82ae91d756e05 Reviewed-on: https://chromium-review.googlesource.com/1066076 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 493f9571 2018-05-24T19:52:15 Add PrimitiveMode packed GLenum. Bug: angleproject:2574 Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c Reviewed-on: https://chromium-review.googlesource.com/1067114 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 58662082 2018-05-10T13:41:51 Pass a gl::Context to ShaderImpl methods. Also add a destroy method. BUG=angleproject:2464 Change-Id: I7346b799af4e7d64ed5cc3d5eca8e108ce2cf699 Reviewed-on: https://chromium-review.googlesource.com/1054213 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Olli Etuaho ebd6e2df 2018-03-23T17:07:55 Take all attributes into account when checking for aliasing This makes ANGLE to follow GLSL ES 3.00.6 spec section 12.46. The spec requires that all attributes are taken into account when checking for aliasing, regardless of if they are active or not. WebGL 2.0 spec was also recently changed to reflect GLSL ES 3.00.6 correctly. Aliasing checks for GLSL ES 1.00 shaders are left as-is. BUG=chromium:829541 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: I71c36ac123f18dadf075e81f93af29321c15136b Reviewed-on: https://chromium-review.googlesource.com/1005077 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao 385b3e03 2018-03-21T09:43:28 Use packed enums on shader types in ANGLE renderer This patch uses a packed internal enum ShaderType everywhere we need a shader type instead of the GLenum value of the shader type. This patch also uses program::getAttachedShader(type) everywhere we need to get gl::Shader from a program in ANGLE. BUG=angleproject:2169 Change-Id: I28a7fa1cfe35622c57a486932911110688eaadec Reviewed-on: https://chromium-review.googlesource.com/972844 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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>
Jiawei Shao 4ed05da2 2018-02-02T14:26:15 ES31: Add link validation on geometry shader itself This patch intends to support program link validation on geometry shader itself. A link error should occur when linking a program with a geometry shader that lacks input primitive or output primitive or the declaration of 'max_vertices'. This patch also adds the support of linking a program with geometry shader in angle_end2end_tests. BUG=angleproject:1941 TEST=angle_end2end_tests dEQP-GLES31.functional.shaders.linkage.es31.geometry.varying.rules.unspecified_* Change-Id: I25fb08514753102f5dd3ab86211c05d2ca4fd185 Reviewed-on: https://chromium-review.googlesource.com/898842 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 881b7bfa 2017-12-25T11:18:37 ES31: Refactor link mismatch error log This patch intends to refactor the structure of logging link mismatch errors to meet the new GLES 3.1 program link requirements and support linking program with geometry shader. This patch is mainly focusing on the following 4 issues: 1. There are totally 14 places that log the link mismatch errors in almost same format. 2. A temporary string is created (STRUCT_NAME.FIELD_NAME) before checking a field of a block, which is of no use if link succeeds. 3. LinkValidateVariablesBase needs to know "shaderTypes" if we support geometry shader based on current structure. Since uniforms are checked in the range of the whole program, it is unnecessary to know in which shader a uniform is defined if link succeeds. 4. GLES 3.1 regards varyings with same location but different names as matched, so it isn't enough to log errors only by one name. This patch can solve all these issues by the following 3 changes: 1. Replace "infoLog" and "variableNames" by "mismatchedFieldName" (the complete field name if the mismatch occurs on a field of a struct or block). 2. Use enum LinkMismatchError as the return value of all linkValidate* functions to reflect the detail of the link mismatch error. 3. Log all the link mismatch errors by InfoLog::logLinkMismatch where we can get shader types instead of passing them into linkValidate* functions. BUG=angleproject:1941, angleproject:2144 TEST=angle_end2end_tests Change-Id: I3ed876d61f812cc7a45a6a3c5fec0b4a88b9cc2c Reviewed-on: https://chromium-review.googlesource.com/844215 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
jchen10 8225e73b 2017-11-14T16:29:03 Support struct varying for transform feedback Capturing struct members is vague In ES 3.00. But the ES 3.10 explicitly says that base-level members of struct are feasible for transform feedback capture. This implementation fills the gap. TEST=angle_end2end_tests:TrasnformFeedbackTest* BUG=angleproject:2241 Change-Id: Ibdf3ae6c2b8b28952e2f7fef1363545cbccad389 Reviewed-on: https://chromium-review.googlesource.com/768613 Commit-Queue: Jamie Madill <jmadill@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>
Jiawei Shao 89be29a5 2017-11-06T14:36:45 ES31: Implement creation and attaching geometry shader on OpenGL This patch intends to implement the creation of a geometry shader and attaching a geometry shader to a program on OpenGL back-ends. This patch also adds all geometry shader related dEQP-GLES31 test failures to deqp_gles31_test_expectations.txt. BUG=angleproject:1941 TEST=angle_end2end_tests Change-Id: Ib0b497030255b15dacd967e48bc59eef0009af46 Reviewed-on: https://chromium-review.googlesource.com/757979 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao 3d40488b 2017-10-16T13:30:48 Split varyings into input and output varyings in renderer This patch intends to split all vector<Varying> into two vectors to store input and output varyings separately in the renderer. This patch is a base of supporting program linking with geometry shader. Unlike the vertex shaders (their outputs are varyings) and fragment shaders (their inputs are varyings), the inputs and outputs of geometry shaders are all varyings, so we need two vector<Varying> to store them correctly. BUG=angleproject:1941 TEST=angle_end2end_tests Change-Id: Ic4b8343f2fc3df87b764c45f2ea7810e565f7bee Reviewed-on: https://chromium-review.googlesource.com/720617 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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>