src/compiler.gni


Log

Author Commit Date CI Message
Shahbaz Youssefi 665ddccd 2021-12-09T23:06:39 Vulkan: Emulate dithering Dithering in OpenGL is vaguely defined, to the extent that no dithering is also a valid dithering algorithm. Dithering is enabled by default, but emulating it has a non-negligible cost. Similarly to some other GLES drivers, ANGLE enables dithering only on low-bit formats where visual banding is particularly common; namely RGBA4444, RGBA5551 and RGB565. Dithering is emulated in the fragment shader and is controlled by a spec constant. Every 2 bits of the spec constant correspond to one attachment, with the value indicating: - 00: No dithering - 01: Dither for RGBA4444 - 10: Dither for RGBA5551 - 11: Dither for RGB565 The translator appends code to the shader that, based on the format specified by the specialization constant, adds dithering to each color attachment output. A 2x2 Bayer matrix is used for dithering, indexed by gl_FragCoord.xy % 2. Bug: angleproject:6755 Change-Id: Ib45da5938e299b6626bff921119d63e7357dd353 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3374261 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington c4a9d416 2022-01-05T15:28:11 Metal: Refactor to build without SPIR-V Refactor ShaderInterfaceInfoMap and constant names to thier own files, allowing Webkit to build without needing to compile SPIRV code via mtl_glslang_utils.cpp. Bug: angleproject:6782 Change-Id: I7a9c7e387145c95807f780e24bd2764e0efb5709 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3364970 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
John Cunningham 45237a04 2022-01-11T00:14:01 Metal: Fix undefined behavior of depth write Writing to an unbound depth attachment is undefined behavior in Metal. Fix this by emitting a function constant to guard depth buffer use in fragment shaders. Bug: angleproject:6865 Change-Id: Id7c10d0aeb349aacfe09c397bc292a71199ab50a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3380304 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Kyle Piddington 50fc2909 2021-10-27T21:37:02 Merge Webkit up to Oct 27 2021 Merge the following commits from Webkit. This change merges webkit from the following git commits Previous: commit 703b234524e75109ca3e94febbf63098314022f5 Author: Alex Christensen <achristensen@webkit.org> Date: Tue Sep 28 16:22:30 2021 +0000 Mostly fix Mac CMake build https://bugs.webkit.org/show_bug.cgi?id=230868 Current: commit 43d2e637f84b1e6b75c139ac64c26ca108b4f12f Author: Kimmo Kinnunen <kkinnunen@apple.com> Date: Wed Oct 27 17:43:38 2021 +0000 REGRESSION (Safari 15): Poor WebGL performance on https://downloads.scirra.com/labs/particles Commits: commit 8238f462c96e515dabd3db0e26c143b18f47340c Author: Kyle Piddington <kpiddington@apple.com> Date: Wed Oct 6 21:45:18 2021 +0000 Shadertoy "truchet district" fails to compile with error: Internal error compiling shader with Metal backend" commit 2fcb9af290e4b6c804f11ad4359555507c1492f9 Author: Kyle Piddington <kpiddington@apple.com> Date: Thu Oct 14 21:14:26 2021 +0000 https://tankionline.com/play/ html5 engine not working: crashes. (Metal shader not working) https://bugs.webkit.org/show_bug.cgi?id=231490 commit e11955a258380a875115ded16ab8963142c4023b Author: Kyle Piddington <kpiddington@apple.com> Date: Fri Oct 15 23:57:12 2021 +0000 REGRESSION (r283667): webgl/2.0.0/deqp/functional/gles3/lifetime.html fails https://bugs.webkit.org/show_bug.cgi?id=231682 commit 43d2e637f84b1e6b75c139ac64c26ca108b4f12f Author: Kimmo Kinnunen <kkinnunen@apple.com> Date: Wed Oct 27 17:43:38 2021 +0000 REGRESSION (Safari 15): Poor WebGL performance on https://downloads.scirra.com/labs/particles https://bugs.webkit.org/show_bug.cgi?id=230749 Bug: angleproject:6630 Change-Id: Icca411dc429538f839f05834f1851fbc54ef8a1d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3248573 Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi f3d5dac3 2021-08-23T17:25:15 Vulkan: SPIR-V Gen: Drop dependency to glslang The SPIR-V gen path is now made default. Compilation through glslang is still supported for debugging, and is enabled on the GLSL* end2end tests for smoke testing. On release builds, glslang is not supported. To test with glslang, add the following gn arg (only necessary if dcheck is disabled): angle_enable_spirv_gen_through_glslang = true Then enable the generateSPIRVThroughGlslang feature. This can be done by setting an environment variable: ANGLE_FEATURE_OVERRIDES_ENABLED=generateSPIRVThroughGlslang ./angle_deqp_gles2_tests Binary size saving: - 1.3MB on Linux (SPIR-V gen itself: 240KB) - 730KB on Android (SPIR-V gen itself: 140KB) Perf tests: - LinkProgramBenchmark.Run/vulkan_compile_single_thread * Through glslang: truncated mean: 1287033.36 * Direct SPIR-V Gen: truncated mean: 244495.91 (~80% reduction) - LinkProgramBenchmark.Run/vulkan_compile_multi_thread * Through glslang: truncated mean: 4565894.83 * Direct SPIR-V Gen: truncated mean: 1158164.10 (~75% reduction) Bug: angleproject:4889 Bug: angleproject:6210 Change-Id: I486342702977c8114e90073b97183aba115a8b2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3115140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Kyle Piddington 54d4bfe5 2021-09-28T17:27:57 Update ANGLE Metal to Webkit at Sept 29 2021 This commit merges changes from Webkit into ANGLE upstream. The following commits were used: Current: https://git.webkit.org/?p=WebKit.git;a=commit;h=e01d0bda8f4b7dc2fd834b92802d15d8c15735f Previous: https://git.webkit.org/?p=WebKit.git;a=commit;h=492f078198748e8ff248eea0bb979cf79e5f5adfj The following commits were merged in from the Webkit Repository: (Hashes from git://git.webkit.org/WebKit-https.git) 03ea44c78ce5665d4ec9add271260121cbc7bc6c Problems with drawElements in some conditions https://bugs.webkit.org/show_bug.cgi?id=230107 c8dc8e0c4d1109d39a62eb197b45e95132380290 ANGLE Metal: single-component swizzles do not compile https://bugs.webkit.org/show_bug.cgi?id=230472 7285dbaaf5af15877d6c332b30ef7a4d67225460 webgl-compressed-texture-s3tc-srgb.html fails on Intel+AMD Metal https://bugs.webkit.org/show_bug.cgi?id=229941 4c72f92967ecd2a095666fef431384c4f5f60fb4 fragcolor-fragdata-invariant.html fails https://bugs.webkit.org/show_bug.cgi?id=223317 cd943145467f54e5928793c0dd3dfa2313c007dd ANGLE Metal index buffer restart range cache could be maintained.. https://bugs.webkit.org/show_bug.cgi?id=227451 f075ff77e592eabd54dd659a8e13617cc5faedc8 ANGLE Metal infinities and NaNs generated with incorrect syntax https://bugs.webkit.org/show_bug.cgi?id=229439 5862073269122f4b2d43d96d3922757557755e86 [Metal ANGLE] Fix over-autorelease of rx::DisplayMtl::getMetalDeviceMatchingAttribute()... <https://webkit.org/b/229128> 85f797ad31db048cb82cbafd428ef77f0b839312 ANGLE Cocoa compiles.... https://bugs.webkit.org/show_bug.cgi?id=228987 a67918ba279ad4842b6ae84a79c3f1c0cdc35ace Avoid infinite recursion... https://bugs.webkit.org/show_bug.cgi?id=228978 d341f67de0033adcf1ec6373ace6a54b06c4a031 Cherry-pick ANGLE: Revise WebGL's shaderSource validation https://bugs.webkit.org/show_bug.cgi?id=228951 1e2714d981e97de8234ba055570dfdf56e8b6944 3.5 MB system-wide footprint impact due to thread-locals... https://bugs.webkit.org/show_bug.cgi?id=228240 d32e5cca34081997d32504b0b56c18b9703ff3be Build Default Metal library offline https://bugs.webkit.org/show_bug.cgi?id=227333 33702279faccfd4c8d1c8a6d549925f9ca9a4e8f WebGL2 demo doesn't work due to failing compilation.... https://bugs.webkit.org/show_bug.cgi?id=226865 0a075885d242db38c4e435a6597173dc3b082173 rAF driven WebGL submits excessive amount of GPU work... https://bugs.webkit.org/show_bug.cgi?id=227059 f38a92b3e7c17efda269caa7066e7ffe2f828e72 WebGL shader link error in iOS 15 beta: "Internal error..." https://bugs.webkit.org/show_bug.cgi?id=227723 98d48f011d561531470d97f26a022767b5452fb7 REGRESSION (r279466): [Big Sur] webgl/1.0.3/conformance &... https://bugs.webkit.org/show_bug.cgi?id=227596 Bug: angleproject:6471 Change-Id: I07166d0dc4b5c3579d98353485b3245b81c7b882 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3194322 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Kenneth Russell da3db87e 2021-07-06T14:00:58 Upstream latest changes to Metal backend from Apple to 7/1/2021 This CL merges in the ANGLE changes between these two WebKit commits: https://git.webkit.org/?p=WebKit.git;a=commit;h=8648b353ab1d7730438c2e08319e1a4d64982c31 https://git.webkit.org/?p=WebKit.git;a=commit;h=166e4924a52971d6a32ad48247a439b16c00e062 Include provoking vertex buffer out of bounds fix from https://bugs.webkit.org/show_bug.cgi?id=230107 Fix bad merge of resetting of dirty bits, breaking DepthStencilFormatsTest.DepthTextureRender test and perhaps others. Disable GL_APPLE_clip_distance when the direct-to-Metal compiler is active. It can not yet handle the gl_ClipDistance array. Disable use of rectangular textures for IOSurfaces. Metal can bind IOSurfaces to 2D textures, and this was passing all tests in the SPIR-V Metal backend. Introducing rectangular textures breaks the SPIR-V Metal backend, and the tests currently fail on the direct-to-Metal backend. Fix several bugs with ProvokingVertex, which was causing both the SpirV and Direct backends to incorrectly draw indices. (https://bugs.webkit.org/show_bug.cgi?id=230107) Skip the following tests on the Metal backend which is still failing RobustResourceInitTestES3.BlitDepthStencilAfterClearBuffer GLSLTest_ES3.GLVertexIDIntegerTextureDrawArrays/ES3_Metal With these changes, angle_end2end_tests again runs to completion. Bug: angleproject:6395 Change-Id: I3cc58f531426a95fc8f177a4ad87f56c1855a546 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167010 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Gregg Tavares 958dce52 2021-09-09T14:36:37 Move IntermRebuild.h/cpp to tree_util Bug: angleproject:5505 Change-Id: I7b68057fff0a0eb0d86c1aed01599fa9dbb7db3b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3152167 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares e02753fc 2021-08-31T21:09:45 Convert constructors to function calls where needed. MSL does not do as many conversions between types and has more strict constructors than GLSL so convert to function calls where necessary. Fixes: GLSLTest_ES3.AmbiguousConstructorCall2x2/ES3_Metal GLSLTest_ES3.AmbiguousConstructorCall2x3/ES3_Metal GLSLTest_ES3.ConstructMatrixFromNonFloat/ES3_Metal GLSLTest_ES3.ConstructNonFloatVectorFromMatrix/ES3_Metal GLSLTest_ES3.ScalarConstructor/ES3_Metal UniformBufferTest.Std140UniformBlockWithRowMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithPerMemberRowMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithPerMemberColumnMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithRowMajorQualifierOnStruct/ES3_Metal SimpleUniformTest.FloatMatrix2UniformStateQuery/ES2_Metal SimpleUniformTest.FloatMatrix2UniformStateQuery/ES3_Metal SimpleUniformTest.FloatMatrix3UniformStateQuery/ES2_Metal SimpleUniformTest.FloatMatrix3UniformStateQuery/ES3_Metal SimpleUniformTest.ArrayOfMat3UniformStateQuery/ES2_Metal SimpleUniformTest.ArrayOfMat3UniformStateQuery/ES3_Metal UniformTestES3.MatrixArrayUniformStateQuery/ES3_Metal Bug: angleproject:6306 Change-Id: Iea8a9a261f94f121f482c2ea9678192ca056570c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3134963 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 58930a73 2021-08-07T22:05:27 Translator: Facilitate integration in FireFox; Part 2 Support for desktop GLSL builtins is now controlled by a gn arg, instead of being tied to is_android. Bug: angleproject:6188 Change-Id: Ia152d31bd49ca6de2b29873ee4998c1598904382 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076285 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 5441c519 2021-08-26T11:17:19 GN: Fix duplicate include of VersionGLSL.h The duplicate include was confusing the MSVC project loader. Bug: None Change-Id: I3637d9f0f26272e77cf4ab723532f53e12c13f51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3123227 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d20afde4 2021-08-05T23:06:44 Vulkan: Retain precision of uniform variables When gathering in a uniform block, the precision of default uniforms was dropped. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ie6a8e2e7cef7cd3808cee08d20f886fc4e762cd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076124 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 061188a7 2021-08-04T10:07:47 Translator: General clean up General clean up done as part of other changes, split to simplify review. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Iade9954d187a759be9edd0e3754be007f4133c56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3071598 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1ce78397 2021-07-30T16:51:45 Remove support for WEBGL_debug_shader_precision This extension was rejected, and the implementation was hacky. This clean up is part of an ongoing work to improve precision handling. Bug: angleproject:6059 Change-Id: If08581ec6f19cf1698ffa3dd6d248dc5e68a1d31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3064303 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 09d5047b 2021-08-03T01:31:03 GL: Remove the rewriteVectorScalarArithmetic workaround This workaround was implemented for a bug in Nvidia driver 387 which is end-of-life. More recent driver branches (390 and 4XX) are fixed, and so this workaround is no longer required. The implementation of the workaround itself could introduce bugs. Bug: chromium:772651 Bug: chromium:1201084 Change-Id: I3db179eb90d9124235bdad2daacc712302906d8e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kenneth Russell aec5e65c 2021-07-28T00:36:12 Get direct-to-Metal backend to run angle_end2end_tests. Cherry-pick nameless struct fix from Apple in https://bugs.webkit.org/show_bug.cgi?id=227482 . Fix SeparateCompoundStructDeclarations pass to stop generating multiple declarations; thanks syoussefi@ for advice. Incorporate additional passes from TranslatorVulkan (MonomorphizeUnsupportedFunctionsInVulkanGLSL, RewriteArrayOfArrayOfOpaqueUniforms, SeparateStructFromUniformDeclarations) needed by RewriteStructSamplers pass in TranslatorMetalDirect. Fixes many assertion failures in GLSL tests. Moved these passes out of tree_ops/vulkan. Thanks again to syoussefi@ for advice and help. Disable a validation check related to the RewritePipelines pass. Skip two tests that were failing for other reasons. With these changes, angle_end2end_tests runs to completion when the direct-to-Metal backend is turned on. There are still ~1300 failures of the ~4000 tests which will be investigated next. Bug: angleproject:5505 Change-Id: Ibca77822543e8e8e8d2a8c862e92cdf74bfa3545 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3058524 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 3036e090 2021-07-29T15:55:39 Vulkan: Direct SPIR-V Gen: Support the precise keyword The precise keyword is different in GLSL in that it defines what arithmetic operations _that have led to the value being assigned to a variable_ should be done precisely (i.e. not "contracted"). A tree traverser is implemented that detects precise access chains and applies precise-ness to the right hand side of assignment expressions to said access chains. This is only done if the shader uses the precise keyword in the first place. The algorithm for this is inspired by the implementation in glslang. This change additionally: - Fixes parser to allow precise on function parameters - Fixes GLSL code generation to output precise on struct members and function parameters. Bug: angleproject:4889 Change-Id: Ie3808c3c8c08da308e88af20f5f90379d9d14d47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3056369 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b8d6f8aa 2021-07-22T22:31:29 Translator: Facilitate integration in FireFox Instead of relying on is_apple to build workarounds applied on apple hardware, a new build argument is added for this purpose. This allows FireFox to more easily include these files in their build system (which builds every workaround on every platform). The workarounds are reorganized too and moved from tree_ops/gl/mac to tree_ops/apple. RewriteRowMajorMatrices is moved there too as it's now used by both gl and metal. This workaround is large, and removing it from non-apple builds improves binary size (~40KB on Linux). Bug: angleproject:6188 Change-Id: I8e1dab44d0235bb6b8341d53721bdd0d157d46c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3047385 Reviewed-by: Jeff Gilbert <jgilbert@mozilla.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Gilbert 4b74189b 2021-07-19T16:19:12 Add missing header to build config. Bug: angleproject:6185 Change-Id: Ia3292935489e808bc53a6df3723d81355789b460 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3036588 Commit-Queue: Jeff Gilbert <jgilbert@mozilla.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kenneth Russell 2534ee4c 2021-07-02T12:18:07 Limit the size of declared variables in WebGL shaders. Add an implementation-specific limit for the sizes of variables (specifically arrays, structs, and arrays of structs) in WebGL 1.0 and 2.0 shaders, and interface blocks in WebGL 2.0 shaders, no matter whether they're input, output, or local variables. It is legal in the OpenGL ES and OpenGL ES Shading Language specifications to fail to compile shaders for implementation-specific reasons. Add WebGLCompatibilityTests covering the new limit. Bug: chromium:1220237 Change-Id: I6c1d24a5d9a382ba4454c2dfbb856ab9468f5409 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3023033 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington d33a2222 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile libANGLE. This change is meant to merge the metal backend changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the metal backend code in a state that compiles, but not to switch the Metal backend over to using the direct-to-metal backend yet. Bug: angleproject:5505 Bug: angleproject:6127 Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi 8b869a95 2021-06-13T01:09:27 Translator: Generate Ops for all built-in functions EOpCallBuiltInFunction is removed in this change, as well as the "op": "auto" property in builtin_function_declarations.txt. Instead, gen_builtin_symbols.py automatically generates Ops for every built-in function and generates the TOperator enum accordingly. This simplifies SPIR-V code generation by allowing switches to be used on operators instead of string comparisons. Bug: angleproject:4589 Bug: angleproject:4889 Change-Id: Ia351524400b0e12a10a5572e27e9b88c6ec2e61c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2958869 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi af1eed2e 2021-06-10T01:55:59 Vulkan: Generate gl_FragColor/Data declarations in AST gl_FragColor and gl_FragData are not available in Vulkan. Prior to this change, their declaration as webgl_FragColor and webgl_FragData was done in text. This change implements an AST transformation that declares a normal fragment output variable and replaces all references to these built-ins with those variables. Bug: angleproject:4889 Change-Id: If224e089dec25e4aa580beb135e1be2890de7887 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953042 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1b680b77 2021-06-02T22:04:45 Reland "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This is a reland of a474fd7de769ae817db83490d410510cdbed75b2 The integer clamp used in this transformation is not available in es100 shaders, and float clamp is used instead. Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I9397ec7e6bdfb706c2a891b33fd3b2b79e883ccc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2940902 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Yuly Novikov 10f15011 2021-06-03T19:22:53 Revert "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This reverts commit a474fd7de769ae817db83490d410510cdbed75b2. Reason for revert: breaks GLES2ConformTest, see roll into Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/2935093 Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I911cfe0199b04dbc3d6d4265775b6c2de00a9777 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2937024 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi a474fd7d 2021-06-02T22:04:45 Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation This translator flag adds a clamp to non-literal indices to arrays. Two strategies were provisioned, using the clamp intrinsic or a hand-written function. The latter is ununsed in angle, chromium, firefox and webkit, so this change removes this option and uses the clamp intrinsic unconditionally. The clamp itself was added at output generation time with special flags set on the index node. This is changed such that a proper AST transformation is done and no-special handling would be necessary. Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington d7aa0130 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile translator. This change is meant to merge the translator changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the translator code in a state that compiles, but not to switch the Metal backend over to use this translator backend yet. Bug: angleproject:5505 Change-Id: I68a6354604498cd5fd1eb96c13fc56f3b38f2bd0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897536 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi c229ccfe 2021-05-18T15:51:12 Vulkan: SPIR-V Gen: Handle gl_PerVertex If not declared by the shader, default gl_PerVertex is now explicitly declared in AST prior to SPIR-V generation. The SPIR-V generation code then doesn't need to declare them magically. Bug: angleproject:4889 Change-Id: Icc593bc1ccc3162487bdbae7f66bc775d098778d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2905952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9bc837f6 2021-04-07T15:24:12 Vulkan: Generate SPIR-V directly from the translator; Part 1 This is the first change in a series to generate SPIR-V directly from the translator's AST, instead of the generating text GLSL and feeding it to glslang. This change implements the majority of the work needed to map AST types to SPIR-V types, and declare types and interface variables in SPIR-V. Additionally, it lays the infrastructure to conditionally enabling this path in end2end tests. No tests are currently enabled as the change doesn't actually generate code for function bodies yet. Bug: angleproject:4889 Change-Id: Iacb28b6907fd48c50e4cc5a0e7ad72f6eed241d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2889603 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi cc56e1aa 2021-04-09T23:35:07 Vulkan: Remove special output of structs and keep them in AST The code that separated out declaration of nameless structs from uniform variable declarations is generalized to separate out declaration of all structs from uniform variable declarations. As a result, a pass that outputs the struct types at the top of the shader is no longer necessary. The struct declarations are kept in the AST to be output to GLSL as they normally would when not used in conjunction with uniform variables. After this change, the Vulkan and Metal translators no longer intermix transformations and code generation; transformations are done first entirely in AST, and code generation is done at the end. Bug: angleproject:2461 Bug: angleproject:4889 Change-Id: Ieb4d3f7091845e50c3dc399603ab01182692521d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818153 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 795d7543 2021-04-07T11:38:37 Remove unused translator option bits Usage of SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT is removed from ANGLE by [1], and from the validating command decoder by [2]. The flag is only ever disabled in Firefox. SH_REMOVE_POW_WITH_CONSTANT_EXPONENT is removed from the validating command decoder by [3]. Not used in Firefox. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/1558678 [2]: https://chromium-review.googlesource.com/c/chromium/src/+/2810880 [3]: https://chromium-review.googlesource.com/c/chromium/src/+/2810879 Bug: angleproject:4889 Change-Id: If7d9c31c48510b1486a2285a88475b3c01a77527 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2810806 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0973dd68 2021-03-31T11:11:26 Add a gl-d3d-only target for the translator Chrome's validating command decoder links statically with the ANGLE translator. This change adds a target that builds the translator with only gl and d3d support for this purpose. This will prevent chrome from linking against glslang because of the Vulkan backend. As a bonus, it will reduce the binary size of Chrome by stipping the Vulkan and Metal translation and transformation codes. Bug: angleproject:5810 Change-Id: I5673bad53817ff2aa8486622ff2c64b44c77240f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2797511 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
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 ea71c6b6 2021-01-12T14:13:35 Vulkan: Emulate R32F images with R32UI GL requires that imageAtomicExchange be supported for r32f formats. However VK_FORMAT_FEATURE_STORAGE_*_ATOMIC_BIT is nearly unsupported everywhere without some Vulkan extension that brings in unnecessary support. This GL feature is emulated by transforming the shader to use r32ui for all images that originally specified r32f. floatToUintBits and uintBitsToFloat is used to maintain correct usage of the image* builtin functions. Bug: angleproject:5535 Change-Id: Ie607089935d3283b3ffa054f4b4385b81fb8f53d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2635453 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill e670fc72 2021-01-18T15:51:42 Implement shader compiler changes for Tessellation. Numerous rule changes to support validating Tessellation Control and Evaluation shaders. New per-patch inputs and output variable support. Includes a new traverser step that validates barrier function calls. Functionality changes upcoming in http://crrev.com/c/2568234 Bug: angleproject:3572 Change-Id: If8da1c21d30efa12c60ed0d6c3f8cf0b27e4c86f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633936 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 60015ff6 2021-01-14T02:03:07 Vulkan: Redo RewriteStructSamplers This transformation is split into two. The first transformation solely takes out the samplers out of structs, and potentially generates array of array of samplers. A second transformation is added that takes any array of array of opaque uniforms and flattens it. A follow up change will simplify RewriteAtomicCounters which also handles array of arrays (which is no longer possible), and removes dependency on shaderStorageBufferArrayDynamicIndexing. Bug: angleproject:2703 Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:4211 Change-Id: I352bb2bbe65ac49f4d7d753c0ba3160fa3cc925a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628138 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 9f09435b 2021-01-14T08:13:47 Vulkan: Rename ReplaceClipDistanceVariable files With the addition of EXT_clip_cull_distance extension the files are renamed like so - ReplaceClipDistanceVariable.h -> ReplaceClipCullDistanceVariable.h ReplaceClipDistanceVariable.cpp -> ReplaceClipCullDistanceVariable.cpp Bug: angleproject:5458 Change-Id: I277b2d4b6eea6f2014e10acb251284a159292dbc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617572 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi dc99fc40 2021-01-13T00:21:41 Vulkan: Translator pass to monomorphize problematic functions With array of array of samplers and images, we currently require the shader*ArrayDynamicIndexing Vulkan features. With atomic counters, we require the shaderStorageBufferArrayDynamicIndexing feature. The above features are required to enable passing opaque uniforms to functions. This change introduces a translator pass that monomorphizes functions that receive atomic counters, or partially subscripted array of array of samplers or images, etc by removing those arguments and using the opaque uniform directly. Follow up changes will include: - Great simplification to RewriteStructSamplers, and removal of RewriteStructSamplersOld. This will drop dependency to shaderSampledImageArrayDynamicIndexing and shaderStorageImageArrayDynamicIndexing. - Great simplification to RewriteAtomicCounters. This will drop dependency to shaderStorageBufferArrayDynamicIndexing. - Emulation of imageAtomicExchange for r32f formats, but changing the qualifier to r32ui. Note that parts of RewriteStructSampler are obsolete with this change, but will be refactored as a follow up. Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:5535 Change-Id: Ifd1435b2a31ebf364815046886aeded60297da79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628127 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 5e280545 2021-01-06T14:13:29 Move RegenerateStructNames AST transformation to gl/ This AST transformation is used by the chromium validating command decoder on Linux/AMD/GL as well as MacOS. Bug: chromium:1161513 Change-Id: I67e40215ae5576819ba5a58987ceb1776c86c731 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2613195 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 382bf288 2020-12-24T23:56:39 Organize AST transforms per backend Most of the AST transforms are written as a workaround to an issue that affects a single backend. This change identifies such transforms and organizes them by backend. They are then only built if the respective backend is. Additionally, about half of the GL transforms are due to mac workarounds, including the large RewriteRowMajorMatrices transform. Mac-specific workarounds are additionally only built on said platform. This change reduces the ANGLE binary size: - 106KB in a Vulkan-only build on Linux - 27KB in a GL-only build on Android (60KB on Linux) Bug: chromium:1084580 Bug: chromium:1161513 Change-Id: I64b334332c0d4f848756c6538af0d8d96864c7e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601346 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao c75473c2 2020-11-23T14:26:32 Vulkan: Generalize FlipRotationSpecConst to SpecializationConstant Specialization constant are used not just for flip/rotation. It also used for other things. This CL merges all specialization constant usage (lineRasterEmulation, flip, rotation, halfRenderArea) into one class and rename FlipRotationSpecConst to SpecConst. Bug: b/173800146 Change-Id: I8dc3354b6caedbb183cec29855fc1c301ec8872a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2555812 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Xinghua Cao 378653f8 2020-11-20T12:24:41 D3D: throw a perf warning for uniform block We had translated an uniform block only containing a large array member into StructuredBuffer instead of cbuffer on D3D backend for slow fxc compile performance issue with dynamic uniform indexing. This patch throw a warning if a uniform block containing a large array member fails to hit the optimization. Bug: angleproject:3682 Change-Id: I33459b559923f16a8dfb70c6f46ec52f68d96e06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2552365 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com>
Mohan Maiya cc5f7989 2020-11-19T07:59:01 Vulkan: Support gl_SampleMask with non-const index Add support for access to gl_SampleMask or gl_SampleMaskIn with non-constant index. Replace gl_SampleMask with ANGLESampleMask and reassign ANGLESampleMask to gl_SampleMask in the end. Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables.sample_mask. discard_half_per_pixel.* discard_half_per_sample.* Change-Id: Ie668c3ccf4d40352574db57f5e43b2f17ef6d8b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477908 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 2eb85a5b 2020-11-12T18:37:26 Vulkan: Experimental: forcing highp to mediump in fragment shader. Handy code for debug/experiment that forces highp in fragment shader to mediump. Bug: b/173140243 Change-Id: I1841b67862343df8a12bf302066d7eefd7709604 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2537072 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 15ead5d5 2020-11-02T12:25:32 Reland "Vulkan: Let shader use rotation specialized constant" This is a reland of 47b3db22be33213eea4ad58f2453ee1088324ceb Original change's description: > Vulkan: Let shader use rotation specialized constant > > If use rotation specialized constant is enabled via compiler options, > this CL will use rotation specialized constant to generate flipXY, > rotation matrix and negFlipXY. This allows the driver to optimize for > the minimum instructions for rotation. > > Bug: b/171750979 > Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: b/171750979 Change-Id: I9efde40eb138bacb161cce483a30ec01fee0983b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2533933 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 3f18ad09 2020-11-11T14:12:18 Vulkan: Factor out DriverUniform code to tree_utils/DriverUniform.cpp The driver uniform code is used by various tree_ops functions. But all driver uniform code are defined and implemented in the TranslatorVulkan.cpp file. There is dependency rule that tree_ops code can not call into vulkan specific function. Right now we are working around this problem by always having TranslatorVulkan creates uniform and pass it down to tree_ops. This creates inefficiency for cases that dFdy/dFdx where we don't know if we will need the driver uniform or not, until we walk the tree and see the dFdx node. This CL refactors driver uniform code into its own file and class under tree_utils so that everybody can use. Mean time we can also make it much easier for metal to expand it to have its own uniform structure. Bug: b/173047182 Change-Id: I06bd9a005ccd6dc0a21321a3010dda1eab9d6fdb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2533443 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten c3607098 2020-11-11T16:06:51 Revert "Vulkan: Let shader use rotation specialized constant" This reverts commit 47b3db22be33213eea4ad58f2453ee1088324ceb. Reason for revert: Broke the ANGLE roll into Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/2531069 [1875/27343] SOLINK ./libGLESv2.so FAILED: libGLESv2.so libGLESv2.so.TOC /b/s/w/ir/cipd_bin_packages/cpython/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libGLESv2.so" --tocfile="./libGLESv2.so.TOC" --output="./libGLESv2.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libGLESv2.so" -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -Werror -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath=\$ORIGIN -Wl,--export-dynamic -Wl,-rpath=\$ORIGIN -o "./libGLESv2.so" @"./libGLESv2.so.rsp" ld.lld: error: undefined symbol: sh::TranslatorVulkan::GetDriverUniformFlipXYRef(sh::TVariable const*) >>> referenced by RewriteDfdy.cpp:134 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:134) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a >>> referenced by RewriteDfdy.cpp:200 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:200) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithoutRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a ld.lld: error: undefined symbol: sh::TranslatorVulkan::GetDriverUniformFragRotationMatrixRef(sh::TVariable const*) >>> referenced by RewriteDfdy.cpp:136 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:136) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a clang: error: linker command failed with exit code 1 (use -v to see invocation) Original change's description: > Vulkan: Let shader use rotation specialized constant > > If use rotation specialized constant is enabled via compiler options, > this CL will use rotation specialized constant to generate flipXY, > rotation matrix and negFlipXY. This allows the driver to optimize for > the minimum instructions for rotation. > > Bug: b/171750979 > Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> TBR=ianelliott@google.com,timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Id3976259d1f4049aa62b679ad5b25c2ac337c92b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/171750979 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532702 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao 47b3db22 2020-11-02T12:25:32 Vulkan: Let shader use rotation specialized constant If use rotation specialized constant is enabled via compiler options, this CL will use rotation specialized constant to generate flipXY, rotation matrix and negFlipXY. This allows the driver to optimize for the minimum instructions for rotation. Bug: b/171750979 Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 34130c2e 2020-11-07T15:11:14 Vulkan: Rewrite interpolateAtOffset to account for Y-flip In order to fully suppot OES_shader_multisample_interpolation rewrite interpolateAtOffset's offset parameter to account for Y-coordinate flip. Bug: angleproject:3589 Tests: dEQP-GLES31.functional.shaders.multisample_interpolation. interpolate_at_offset.*.default_framebuffer Change-Id: I6bf72ceb1c0466ff5d4a92b72d1ec9e2552d6f2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2524711 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Xinghua Cao dc1c1cb5 2020-08-12T13:30:26 Restrict to translate uniform block to StructuredBuffer We had translated an uniform block only containing a large array member into StructuredBuffer instead of cbuffer on D3D backend for slow fxc compile performance issue with dynamic uniform indexing. Now we add more conditions to restrict the translation. Only indexing operator is allowed to operate on this uniform block variable. And we also restrict the types of uniform block's member. Bug: angleproject:3682 Change-Id: I992b7890d84fcaa6169722af6d7e14785526d48a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2351728 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com>
Mohan Maiya 7bbe497a 2020-10-16T14:46:45 Vulkan: Implement EXT_texture_sRGB_decode Implement EXT_texture_sRGB_decode. This builds on the existing functionality from EXT_texture_sRGB_override, with 2 major edge cases: 1. sRGB_decode allows the texture state to be overridden by sampler state, which is implemented by forcing a a texture state sync during updateActiveTextures if a texture is bound to the same unit as a sampler with that state 2. texelFetch calls require us to reenable decoding, regardless of decode state. We add a new compiler pass (FlagSamplersWithTexelFetch) to mark samplers that are used with texelFetch in order to support this. This change also re-enables EXT_texture_sRGB_R8, which was disabled due to a dEQP bug that this change will bypass. Bug: angleproject:3609 Bug: angleproject:4503 Test: dEQP.GLES31/functional_srgb_texture_decode_skip_decode_* Test: GLES31/functional_state_query_texture_*_srgb_decode_* Test: GLES31/functional_state_query_sampler_*_srgb_decode_* Test: GLES31/functional_debug_negative_coverage_*_srgb_decode_* Test: GLES31/functional_android_extension_pack_extensions_ext_texture_srgb_decode Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan* Change-Id: I4a67e487dc82e2f57c8c87d4bcd8ef442b6fe220 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359481 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Le Hoang Quyen 9ff58ddd 2020-08-26T01:08:00 Metal: Support array of matrices varying. MSL doesn't support array of matrices as varying variable. This CL converts array of matrices varying to array of vectors. This fixes WebGL test: conformance/glsl/misc/shader-varying-packing-restrictions.html Bug: angleproject:4846 Bug: angleproject:2634 Change-Id: I3cfc638dc01092ddf1add7df02c131d1a5c8ba1d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2392172 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@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>
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>
Cody Northrop a2f9ad39 2020-03-09T14:28:39 Vulkan: Remove unused atomic counter builtins Atomic counters are not supported by Vulkan. Most are already converted by the RewriteAtomicCounters traversal, but that is only invoked when atomic counters are active. This CL introduces another pass that removes any atomic counter builtin that was not handled by the previous pass. It also will assert if it sees any atomic counters active, thus ensuring it is only used when needed. Test: KHR-GLES31.core.compute_shader.shared-struct Test: angle_end2end_tests.exe --gtest_filter="*AtomicCounter*" Bug: angleproject:4189 Bug: b:150310216 Change-Id: I61d10e954886dc94fede8b344f5a0ede3b689adb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2095688 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell e196bc85 2020-01-17T13:11:20 Add driver bug workaround for rewriting row major matrices. Joint work with syoussefi@, who wrote the RewriteRowMajorMatrices pass, and revised it for this CL to not rely on the NameNamelessUniformBuffers pass - which was breaking it on the GL backend. Hook up previously written RewriteRowMajorMatrices transformation, and enable on all GPU types on macOS. It is needed at least for AMD and Intel GPUs. Add a new test which verifies the behavior of dynamically-indexed arrays of row-major matrices. Bug: angleproject:2273 Bug: angleproject:3843 Change-Id: Id582f9cf6b9b1a59091aab1786539174f360b705 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2008717 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi a5dd3888 2019-12-04T14:31:57 Vulkan: fix handling of inactive atomic counters The translator emulates atomic counters with a storage buffer array during translation to Vulkan GLSL. Glslang wrapper then should assign set/binding to this buffer. However, if the atomic counters are actually unused in the shader, this assignment is never done. This change adds a small tree transformation for Vulkan that removes any uniform or interface block declaration that's not active. In particular, this makes atomic counter emulation a no-op if no atomic counters are used. It also has the benefit of not requiring glslang wrapper to remove such inactive resources. Bug: angleproject:4190 Change-Id: I286c199854ec2379558ad1ec48b4d2c4bf5544d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1951523 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi 5efb36b9 2019-11-25T16:14:55 Automatically call flex/bison if necessary ANGLE translator's parser code generation is changed to use the binaries of flex/bison stored in the cloud. scripts/run_code_generation.py now automatically runs these files if the input files change. Bug: angleproject:3419 Change-Id: Icce4247f93b27baf8ee12dbb16112fa2cc98c111 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1940572 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
jchen10 b3070102 2019-10-18T16:01:34 Add SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR This is a workaround for the webgl2 conformance test case WebglConformance_conformance2_glsl3_vector_dynamic_indexing_swizzled_lvalue. Dynamic indexing of swizzled lvalue like "v.zyx[i] = 0.0" is problematic on various platforms. This removes the indexing by translating it this way: void dyn_index_write_vec3(inout vec3 base, in int index, in float value){ switch (index) { case (0): (base[0] = value); return ; case (1): (base[1] = value); return ; case (2): (base[2] = value); return ; default: break; } if ((index < 0)) { (base[0] = value); return ; } { (base[2] = value); } } ... dyn_index_write_vec3(v.zyx, i, 0.0); ... Bug: chromium:709351 Change-Id: I971b38eb404209b56e6764af1063878c078a7e88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1869109 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Le Quyen d200a77a 2019-10-10T00:44:01 Metal backend skeleton implementation. Bug: angleproject:2634 Change-Id: I34be82f4a80a6851fecb53a51e069b134d82613a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1849079 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1f08ab28 2019-10-03T16:22:52 Re-land "GN: Componentize vulkan back-end build." Re-land fixes angle_end2end_tests disabling Vulkan. This moves the build configuration into the Vulkan back-end dir. This should be a little easier to maintain as all Vulkan-related config is in one place. Note that this should not interfere with Skia's build as they do not import the Vulkan back-end sources. One additional possiblity that this enables is testing other compile-time permutations of the Vulkan back-end more easily. For example we could make a simple change to enable compile testing of the Vulkan back-end with custom command buffers disabled. Also fixes a few errors affecting less tested configs. Bug: angleproject:3943 Change-Id: I0161668abcc58fcf529dde120998d4b99445fdd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1838454 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2328d65a 2019-10-03T02:27:07 Revert "GN: Componentize vulkan back-end build." This reverts commit d46e2fb1e341a7ba7da56072658d3b4b1a540077. Reason for revert: Broke Vulkan angle_end2end_tests. Bug: angleproject:3954 Original change's description: > GN: Componentize vulkan back-end build. > > This moves the build configuration into the Vulkan back-end dir. > This should be a little easier to maintain as all Vulkan-related > config is in one place. > > Note that this should not interfere with Skia's build as they do > not import the Vulkan back-end sources. > > One additional possiblity that this enables is testing other > compile-time permutations of the Vulkan back-end more easily. For > example we could make a simple change to enable compile testing > of the Vulkan back-end with custom command buffers disabled. > > Also fixes a few errors affecting less tested configs. > > Bug: angleproject:3943 > Change-Id: Iaf819936896e4f5d3e6415ed16ab0c940e46cdb6 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1829662 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tobin Ehlis <tobine@google.com> TBR=tobine@google.com,jonahr@google.com,jmadill@chromium.org Change-Id: I7cf3db4f6b7d8b779625ea2491172bb429b498a9 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3943 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1837233 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d46e2fb1 2019-09-27T16:22:35 GN: Componentize vulkan back-end build. This moves the build configuration into the Vulkan back-end dir. This should be a little easier to maintain as all Vulkan-related config is in one place. Note that this should not interfere with Skia's build as they do not import the Vulkan back-end sources. One additional possiblity that this enables is testing other compile-time permutations of the Vulkan back-end more easily. For example we could make a simple change to enable compile testing of the Vulkan back-end with custom command buffers disabled. Also fixes a few errors affecting less tested configs. Bug: angleproject:3943 Change-Id: Iaf819936896e4f5d3e6415ed16ab0c940e46cdb6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1829662 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@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>
Clemen Deng d7d42540 2019-08-21T15:22:49 Don't build symbol table for GLSL built-ins if on Android The GLSL + ESSL autogenerated symbol table is too large for android, and android also doesn't need desktop GL functionality If on android, compile the ESSL only symbol table Bug: chromium:996286 Change-Id: I14dfc7748dae389e78c35f82a390c67962665356 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1757372 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Shahbaz Youssefi d6c7fec1 2019-08-12T16:46:57 Vulkan: Support mixed column/row-major buffer fields Adds comprehensive tests for mixed column/row-major interface blocks, which flush out various bugs in different OpenGL drivers too. Bug: angleproject:3443 Change-Id: Ie88cca743373891bbb49d9f564f30407475e07fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1749334 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: 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>
Shahbaz Youssefi 93560ef5 2019-07-25T16:13:02 Vulkan: Seamful cube map emulation In GLSL, a cube texture is sampled with one of textureCube* functions. This function takes a 3D coordinate which is a vector from the center of the cube and identifies a direction to sample from. GLES2.0 has the following table that translates this 3D coordinate (Rx, Ry, Rz) to a face and ST coordinates within that face. This table can be found in Section 3.7.5 (Cube Map Texture Selection). A compiler pass is implemented in ANGLE that replaces samplerCube declarations with a sampler2DArray. The textureCube* functions are replaced with the corresponding texture* functions with the translated coordinates according to that table. Gradients provided to textureCubeGrad are translated using the same formulae, which is not precise but the spec specifies this projection to be implementation dependent. Helper invocations enabled through WQM (whole quad mode) cause a nuisance in that the extrapolated varyings used as coordinates in a textureCube call could have a different major axis (and therefore face) from the non-helper invocations that lie within the geometry. subgroupQuadSwap* operations are used in conjunction with gl_HelperInvocation to make sure the helper threads calculate texture UVs in the same face as the non-helper invocations. Bug: angleproject:3300 Bug: angleproject:3240 Bug: angleproject:3243 Bug: angleproject:3732 Change-Id: I0cb6a9b1f2e1e6a392b5baca1c7118ed1c502ccf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1715977 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Clemen Deng 9031bdd9 2019-07-26T14:51:23 Use perfect-hash module in gen_builtin_symbols.py The script currently takes ~4 minutes to run Using this module instead of manually hashing will improve runtime significantly Bug: angleproject:3747 Change-Id: I7e2d2ef5bbfd136b0299d571e0acc11f334c80b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1724667 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b82d8633 2019-07-15T11:23:08 Vulkan: Atomic counter buffer support Vulkan doesn't treat atomic counters especially, and they are emulated with atomic access to storage buffers. A single atomic counter buffer binding per pipeline is supported. All the atomic counters identify an offset within this buffer. The shader is modified to include a storage buffer definition with `uint counters[];` as the only field. A compiler pass replaces atomic counter definitions with variables that hold the corresponding offset parameter, as well as changing atomic_uint types to just uint (as the offset). Where an atomic counter variable is used, it is replaced with the offset variable (plus the array index, if array). At the same time, built-in `atomicCounter*` functions are replaced with a corresponding `atomic*` function and `memoryBarrierAtomicCounter` is replaced with `memoryBarrierBuffer`. Bug: angleproject:3566 Change-Id: Iefb3d47de6a5cb3072bfa0cb94a46ac6a886d369 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704635 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Tim Van Patten 6d37651a 2019-06-26T13:13:09 Vulkan: dFdy is incorrect when the framebuffer is flipped To account for framebuffer flipping, `dFdy()` expressions must be changed to: dFdy() * ANGLEUniforms.viewportYScale Bug: angleproject:3487 Test: dEQP-GLES3.functional.shaders.derivate.dfdy.* Change-Id: I38f25ba37fb8c5ae61cee5ac911df88ec4a93fef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1678404 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tom Anderson 08146a27 2019-05-17T10:40:44 Remove non-source sources from binary targets No behavior changes. BUG=chromium:964411 Change-Id: I843757e65f110882c01514fe6bf4aed28e07dd21 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1617011 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 38ff3c70 2019-05-15T10:07:09 Vulkan:Allow same-named var in nested scope ESSL 1.00 spec allows for variable with same name to override outer variable inside of a nested scope. This change adds new scope to symbol table inside of a function defintion, but after function parameters for ESSL 1.00 shaders (but not webGL). This prevents an error while parsing. This also includes some new code in translator to rename any vars that are redefined between the function body and the function parameters. This prevents an error later on when the translated shader is then parsed as a desktop GLSL version. Bug: angleproject:3287 Change-Id: I3f025805cf8d65bf912283bb15e6dad6e5e9b967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1601553 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d519ab1 2019-05-09T23:09:46 Vulkan: Rework layout block storage conversion Previously, a pass over the shader was made, converting shared and packed interface blocks with block storage to std140. This resulted in link success between interface blocks with different storage as they were all translated to std140. With this change, this pass is removed. The link step proceeds with the block storage specifiers as seen by GLES, and only upon Vulkan GLSL shader generation "shared" and "packed" are converted to std140. Bug: angleproject:3199 Change-Id: I069415ab9c9b4e1034bc00f64cd2d9e2d73f5956 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1605262 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 216f73d0 2019-04-12T13:32:30 Vulkan: add uniform buffer object support Support for layout qualifiers in interface blocks are added. All interface blocks are adjusted to either be in std140 or std430. In the Vulkan backend, a new descriptor set is added for UBOs. A dirty bit is added for UBO updating and pipeline layouts and descriptor bindings are updated. Bug: angleproject:3199, angleproject:3220 Change-Id: I271fc34ac2e1e8b76dee75e54a7cff0fe15fe4ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565061 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 91d469aa 2018-08-27T10:47:25 Initial support for compiler AST validation This is to be able to catch issues introduced through AST manipulation earlier than shader compilation time, improving debuggability. Bug: angleproject:2733 Change-Id: Ic57bc72f2ab438e60f32553d602074f3d72cc4f5 Reviewed-on: https://chromium-review.googlesource.com/c/1199922 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Qin Jiajia 81a880aa 2018-11-12T15:53:34 ES31: support ssbo as binary operand This patch will process ssbo as compound assignment binary operand or readonly binary operand. BUG: angleproject:1951 Change-Id: I4a0da77649d719fa08e6bf4c3d9ace58dbfb7aab Reviewed-on: https://chromium-review.googlesource.com/c/1349449 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Brandon Jones 4a22f4b0 2018-10-23T14:36:47 ES31: Add atomic_uint support to HLSL translator This is the first commit in a series to enable atomic counter buffers. Adds support for atomic counters to the GLSL->HLSL translator using RWByteAddressBuffer. Bug: angleproject:1729 Test: angle_end2end_tests Change-Id: I3b7e08f9256dc9bdbcc02ad8910040f2bc14aeac Reviewed-on: https://chromium-review.googlesource.com/c/1291329 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
Qin Jiajia a735ee2f 2018-05-18T13:29:09 ES31: Support shader storage block in D3D11 compiler - Part1 This patch is the first step to implement a basic skeleton to translate shader storage block to HLSL RWByteAddressBuffer. In GLSL each shader storage block is just one structured block and in API side it corresponds to a buffer range where stores the whole structure. RWStructuredBuffer is an array-like object and can have many structured elements. The structured element doesn't support unsized array and also have a small limitation on the element size. So we choose RWByteAddressBuffer as the counterpart of shader storage block in HLSL. Due to RWByteAddressBuffer does not support using an index to reference a specific location, we must use Load and Store to process the read/write operation of a buffer variable. Moreover, in the compiler tree, since we can't use variable name to get the resource value in RWByteAddressBuffer, we have to calculate the offset of buffer variable in a shader storage block, then call the corresponding wrapper function to get the right value. In this patch, we only process below situations: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; The translation is like below: // GLSL #version 310 es layout(local_size_x=8) in; layout(std140, binding = 0) buffer blockA { float f[8]; } instanceA; layout(std140, binding = 1) buffer blockB { float f[8]; }; void main() { float data = instanceA.f[gl_LocalInvocationIndex]; f[gl_LocalInvocationIndex] = data; } // HLSL RWByteAddressBuffer _instanceA: register(u0); RWByteAddressBuffer _blockB: register(u1); float float_Load(RWByteAddressBuffer buffer, uint loc) { float result = asfloat(buffer.Load(loc)); return result; } void float_Store(RWByteAddressBuffer buffer, uint loc, float value) { buffer.Store(loc, asuint(value)); } void gl_main() { float _data = float_Load(_instanceA, 0 + 16 * gl_LocalInvocationIndex); float_Store(_blockB, 0 + 16 * gl_LocalInvocationIndex, _data); } We will do below things in the following patches: 1. Modify the intermediate tree to flatten all ssbo usages to: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; e.g. intanceA.a +=1; ->tmp = intanceA.a; intanceA.a = tmp + 1; while(++instanceA.a < 16) { } -> int PreIncrement(out int a) { a += 1; return a; } tmp = instanceA.a; while(PreIncrement(tmp) < 16) { instanceA.a = tmp } 2. Add offset calculation for structure and array of arrays. TODOs have been marked in the corresponding places in this patch. 3. Improve helper functions so that they can process all possible types. TODOs have been marked in the corresponding places in this patch. 4. Process the swizzle situation. TODOs have been marked in the corresponding places in this patch. A possible method is to extend current helper functions like below: *_Load(RWByteAddressBuffer buffer, uint loc, bool isSwizzle, uint4 swizzleOffset) Bug: angleproject:1951 Test: angle_end2end_tests Change-Id: I68ae68d5bb77d0d5627c8272627a7f689b8dc38b Reviewed-on: https://chromium-review.googlesource.com/848215 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Frank Henigman 44b2c0b1 2018-08-29T17:31:27 Avoid rebase_path() in BUILD.gn. Adjust source paths so we don't need to use rebase_path() on all of them. BUG=angleproject:1569 Change-Id: I687dbb9378b1f054eb5664320c662fe4c882a82f Reviewed-on: https://chromium-review.googlesource.com/1194619 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Frank Henigman ddc41208 2018-08-23T22:11:55 Rename .gypi -> .gni. Rename and reformat all gyp files. They were previously converted to gn but not renamed to preserve continuity in git. This rename completes the removal of all traces of gyp. BUG=angleproject:1569 Change-Id: I50123105d8881583184ffc564bed65d9fbe4d41c Reviewed-on: https://chromium-review.googlesource.com/1187885 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>