include/GLSLANG/ShaderLang.h


Log

Author Commit Date CI Message
Alexey Knyazev 56e9bfff 2025-06-19T00:00:00 GL: Remove obsolete macOS workarounds Bug: angleproject:427600175 Change-Id: I8bfc062b71f1a34de09cbf76b504293ccd081fe0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6676022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev beae1b4a 2025-06-19T00:00:00 Metal: Remove obsolete workarounds Removed Intel-specific Metal workarounds that are not used on macOS 12 and later. Removed a redundant version check. Bug: angleproject:427600175 Change-Id: I34c7e53108f7e030512c9436ab2b9ae38ad17946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6672312 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 94ee620d 2025-05-22T10:07:05 Metal: Allow optimization of simple loops Reimplement the feature to avoid undefined behavior of infinite loops. Add EnsureLoopForwardProgress rewrite pass that inserts a volatile variable access to all loops that it cannot analyze as being finite. Detect loops of form `for (; i <op> x; ++i)` as being finite. The <op> can be any of <,<=,>,>=,==, != operator. The i can be int or uint. The ++i can be -- or ++, -=1, +=1. This assumes that backends using the feature emit signed int arithmetic with defined wraparound semantics. Uses volatile write instead of asm("") due to asm not forcing the behavior in some compiler versions. The volatile variable access is defined in C++ as forward progress, and by inheritance this works in MSL. Later commits may remove injectAsmStatementIntoLoopBodies if ensureLoopForwardProgress is appropriate for all use-cases. Bug: angleproject:418918522 Change-Id: Ic9c29f57044b792195386483208632354d24c854 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6575051 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Shahbaz Youssefi f355e2b3 2025-04-15T18:58:25 Vulkan: Remove preferDriverUniformOverSpecConst This was practically true for every vendor on Android (where rotation matters). For Qualcomm, it was also true due to a bug in version checking and didn't seem to be causing any concerns. Where pre-rotation is supported, it is better to enable this feature to avoid excessive pipeline creation. This change removes the feature and makes sure ANGLE always uses uniforms for rotation instead of spec consts. While technically this may have an adverse effect on platforms that never need pre-rotation, the ability is retained for all vendors since pre-rotation is finding its way into more platforms and would likely eventually be needed everywhere anyway. Bug: angleproject:42265878 Bug: angleproject:42262166 Change-Id: I4b64c04da46db08cfdd44b60789b66d93d8e8b17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6459025 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Yuly Novikov 5dd05578 2025-04-14T07:34:57 Revert "GL: Allow untranslated shaders to pass through on GLES" This reverts commit 4e77552b86a89b449ada6d6c18f84285f5812b1d. Reason for revert: breaks ChromeOS and fuzzers Bug: angleproject:398857482 Original change's description: > GL: Allow untranslated shaders to pass through on GLES > > Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which > uses the NULL translator and passes the original shader to the driver. > The parser is still used for shader reflection. > > Bug: angleproject:398857482 > Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: angleproject:398857482, angleproject:410423936 Bug: chromium:410114655, chromium:410100607, chromium:410121218 Bug: chromium:410052365, chromium:410290507, chromium:410178288 No-Presubmit: true Change-Id: I45b01960637a1cda05d21a7df6d07465f6a8f5e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6448984 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 4e77552b 2025-02-24T18:04:32 GL: Allow untranslated shaders to pass through on GLES Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which uses the NULL translator and passes the original shader to the driver. The parser is still used for shader reflection. Bug: angleproject:398857482 Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 02ae054c 2025-04-07T13:48:29 Translator: Fix init of inactive output variables Bug: chromium:398401939 Change-Id: I0df494b945b8d0e805a62cf7645d06bf233f36ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6438495 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Cody Northrop d27a1fd0 2025-04-03T19:59:20 Compiler: Allow denorm float values in the lexer This adds an option to preserve denorm values in the lexer, skipping the explicit zero conversions for below range floats. There are applications in the wild that expect to be able to use denorm float values. They are typically immediately converted to integer values, not used in floating point operations. The option is only enabled for Vulkan backends. Test: FloatLexTest, DenormFloatsToIntValues, app traces Bug: b/406827038 Change-Id: Iab5a1a69a540b78ccbce8ea90b532d2d4976e29e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6432237 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Chris Dalton 292bb458 2025-03-14T12:17:49 Cut MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE Since the number of real devices that support framebuffer fetch, but do not support draw_buffers_indexed, is effectively zero, MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE is an unnecessary complication. These hypothetical devices can fall back on shader images or just not support pixel local storage at all. This closes the door for WEBGL_shader_pixel_local_storage to ever be implemented on top of the ES2 extension that inspired it all, EXT_shader_pixel_local_storage, but WebGL can just use framebuffer fetch instead, or maybe even EXT_shader_pixel_local_storage2 some day. This dramatically simplifies the WEBGL_shader_pixel_local_storage extension. Bug: angleproject:40096838 Change-Id: I9c51f2ce000620f883cb7917d4e8618c8e9ee803 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6354657 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton a05a0e15 2024-09-25T22:33:36 Validate PLS shaders against context state Add shader introspection for PLS uniforms and validate that they match context state during draw calls. Bug: angleproject:40096838 Change-Id: I76cdf8add03de8f8b0b3e772c15c0087c1d97e98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5893962 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kimmo Kinnunen 4397ff2f 2024-10-25T16:55:30 Metal: SeparateCompoundStructDeclarations fails validation Consider GLSL: struct S { int i; } s; s=s; SeparateCompoundStructDeclarations would rewrite this to: struct S { int i; }; S s'; s=s; The interm rewrite would rewrite the specification and declaration of s, but not the use sites. The use sites would use the old type, and thus something that was not in the tree anymore. This would fail the validation. This kind of bug was previously fixed for SeparateDeclarations in commit 18fa02bebf901dd8501de3176f6052ae4ce984be. Fix by adding the logic to SeparateDeclarations, as it is already doing almost the exact task, separating `struct S { ..} a, b`. The separation is tested in GLSLTests.StructInShader and various other draw tests. These pass with MSL, but these would also fail validation if that was enabled. Bug: angleproject:375523825 Change-Id: I1697103d0ba47616dbd3159f36f9e71cb2831c4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5964899 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 12584049 2024-10-21T14:04:55 Make SimplifyLoopConditions testable Add ShCompileOptions::simplifyLoopConditions, so that tests can turn it on. Later edits to simplify loop condition logic are simpler to review when the testing related edits are landed separately. Test the feature by having ESSL as the input and ESSL as the natural output, to reflect how AST changes. To make the test expectations more deterministic across code changes, change SymbolTable::kLastBuiltInId to SymbolTable::kFirstUserDefinedSymbolId. This is simpler as no code needs to know exact last built in id, so we can just ensure that the user defined symbol ids do not clash with the builtin ids. Bug: angleproject:374585769 Change-Id: Iea0efb8ac2878691d0fd5ff5cfe9a49ac754515d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5946724 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Shahbaz Youssefi 47c66901 2024-10-21T12:47:22 Vulkan: Set gl_Layer to 0 if the framebuffer is not layered Bug: angleproject:372390039 Change-Id: I29067c9488e06f6dd2e90f207fecb843267fb77c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5949263 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 3b0d1e44 2024-10-16T00:00:00 Add NULL shader output type Also removed enum values as they are not needed. Bug: angleproject:373818287 Change-Id: I37eeac8fbdb3a4b4d26646b02f9f7925f59833a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938874 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev ab1cdd22 2024-10-03T00:00:00 Translator: Support EXT_texture_query_lod No backend support yet. Bug: angleproject:368275901 Change-Id: I10bbc03feca485908315633cbc0f955e82994657 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5920240 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a8138547 2024-10-09T23:33:24 Translator: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I46ce6d75a76bdf04a9e8feea1a480e8a0badba2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5924140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi ae5c3b96 2024-10-08T17:02:21 Boilerplate for GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I94c670db5546564a6f60bb513a6d7f3f5bd5778c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5916771 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Chris Dalton 966739ac 2024-09-19T23:49:06 Drop PLS support for EXT_shader_pixel_local_storage Supporting this backend drastically increased the complexity of the codebase, with little return. We don't support memoryless attachments on the web anyway, and since this extension requires us to literally draw the load/store operations, input attachments on Vulkan perform better. Once this implemention is completely removed, we will delete the PLS allow list, which isn't required for the other PLS implementations. Bug: angleproject:7279 Change-Id: Ibb036d36cbd33467e7a94398ce171cda7349e4f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5874412 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Alexey Knyazev b98e6bc0 2024-09-12T00:00:00 Translator: Add EXT_texture_shadow_lod functions Added translator support for functions defined in the GL_EXT_texture_shadow_lod extension. Trivially enabled on GL and Vulkan backends. Bug: angleproject:365066518 Bug: angleproject:365108862 Change-Id: Ie1fc8f50e321a559d4506c479d9cebbb48802091 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5867416 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya f2eb8781 2024-09-14T16:16:53 Vulkan: Selectively enable emulateR32fImageAtomicExchange Only emulate R32F imageAtomicExchange if shaderImageFloat32Atomics feature is not supported Bug: angleproject:42264071 Change-Id: I305ab88bf3ac918eff5d8c399f0ed02ec8c60c2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5860814 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Rafael Cintron d1a4b0ff 2019-05-04T17:15:42 Remove Feature Level 9_3 code Feature Level 9_3 was originally added for developers creating apps for devices which did not have the DirectX 9 API and are no longer supported. Hence, we can remove the corresponding code in the 11 backend. Bug: angleproject:355462523 Change-Id: I22db15640b435c61db4d82a815edbc65cecc4e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5824661 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Shahbaz Youssefi 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>
Shahbaz Youssefi 65f08d08 2024-07-26T22:14:49 Vulkan: Work around driver bug with nested switch Bug: chromium:350528343 Change-Id: Ie7bd58934ccb2b8f06f6ad6a8c3bf38e81b84969 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5744620 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 7691cea7 2024-07-22T13:46:14 Vulkan: Remove seamful cubemap emulation Practically, the Vulkan backend is never expected to run on ES2 hardware. It _may_ for WebGL, but seamful cubemap emulation was disabled for webgl anyway. Bug: angleproject:354729454 Change-Id: Iafa20fbdbe232c4df4c777b12e7698ef7a87cf24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5730143 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi ebb56cee 2024-05-31T15:10:37 Implement OES_tessellation_shader Based on the specs, there are no functional differences between OES and EXT. * Added validation for glPatchParameteriOES() and the core glPatchParameteri(). * Added the extension support for GLSL. * EXT_shader_io_blocks is implicitly enabled for the EXT geometry and tessellation shader extensions. * OES_shader_io_blocks is implicitly enabled for the OES versions of said extensions. * Added a test to make sure using this extension works instead of EXT. * Turned the repeated test code into a function: * testTessellationTextureBufferAccess * Skipped the tests that fail on various platforms. * It seems that these tests were being skipped before enabling this extension ("Not supported"). Bug: b/344030760 Bug: angleproject:345306326 Bug: angleproject:345304850 Bug: angleproject:345312771 Change-Id: I905da0132bf6525cb453dcaa613e4deb3155c4dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5595611 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Amirali Abdolrashidi 25374c90 2024-05-31T16:08:58 Implement OES_gpu_shader5 Based on the specs, there is no difference between the OES version and the EXT version. * Added support for use in shaders * Added test to make sure the OES extension works. * Turned the repeated test code into a function: * testArrayOfArrayOfSamplerDynamicIndex() Bug: b/344031022 Change-Id: Ifda4fa5495983d254f598940a95d0797e8a9ce67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5595609 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 9620d4d3 2024-05-23T16:12:52 Vulkan: Emit SPIR-V 1.4 where available In preparation for optimizations possible for SPIR-V 1.4. This change makes ANGLE output SPIR-V 1.4 if supported, and SPIR-V 1.3 otherwise. It handles the following differences between the two versions: - OpEntryPoint in SPIR-V 1.4 includes all global variables, as opposed to SPIR-V 1.3 where only the Input and Output variables are listed - Storage buffers use a dedicated storage class in SPIR-V 1.4 Bug: angleproject:342316794 Change-Id: I157ed46449ff2d0f14d284b883b4ddc1b4b46fd1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5565224 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Scott Marcy 2ecfc5a1 2024-05-03T18:29:12 Issue 8644: Deeply nested iterator declarations can crash Avoid stack overflow crash when parsing nested iterators (especially `while` statements). Limits the number of nested iterator statements to `mMaxStatementDepth` (defaults to 256). Bug: angleproject:8644 Change-Id: I9b0fd2ab456c3cdd731b41ab97f495ae4dc0b0bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5519169 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Scott M <mscott@apple.com>
Geoff Lang 67fc293a 2024-04-05T13:25:12 WebGPU: Add shader translation and program linking stubs. Add a TranslatorWGSL which outputs the same translated shaders every time. Implement the compile and link tasks. Bug: angleproject:8662 Change-Id: I62bbd6c528e1d671d0f4becc38f15f1eceb0336c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5428807 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Shahbaz Youssefi 3fdf576a 2024-01-26T14:37:42 Vulkan: Workaround Nvidia driver bug with OpSelect Bug: angleproject:8503 Change-Id: I4bd2580056df3d970a1316d0dbeaaad7590aa947 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5237873 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Geoff Lang 9318a143 2024-01-11T15:58:44 Add __asm__("") statements to loop bodies in MSL. This prevents erasure of infinite loops during optimization passes. Bug: chromium:1513738 Change-Id: I84a305b5e7fd824531d9e3ebae5496ddec030bac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5191166 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi c6fbf93d 2024-01-19T09:57:12 Vulkan: Fix input attachments leaking into uniform list To communicate the existence of input attachments added to the shader, the translator was adding `ShaderVariable`s for each to the list of uniforms exported from the shader. This was incorrect, as this list is visible to the application through `glGetActiveUniform`. Additionally, this was unnecessarily causing these uniforms to go through program link. Reserving SPIR-V ids for these uniforms, all that is needed from the translator is the mere existence of these input attachments. This change removes the addition of uniforms, and instead exports a bitset. Elsewhere, that bitset is consulted and reserved SPIR-V ids are used. Bug: b/320563594 Bug: angleproject:5792 Change-Id: Id93846cbc3996248f391fd2d5a65af1e48d6d46e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5215089 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 175514c6 2024-01-12T14:43:33 Translator: Bundle metadata flags coming out of the translator In preparation for a follow up change that adds more such metadata. Bundling them together makes it convenient to retrieve, save and load all those flags. Bug: b/320563594 Change-Id: I4f95b32acfb0842cc5d9e72c1788a827bee2c760 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5209450 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 6d9f0aee 2023-11-30T00:00:00 Metal: Ensure helper invocations when derivatives are used Set sample coverage mask to ensure that fragment shader helper invocations are performed when derivatives are used. Fixed the following tests on Apple silicon: dEQP-GLES2.functional.texture.mipmap .2d.projected.nearest_linear_repeat .2d.projected.linear_linear_repeat .cube.projected.linear_nearest .cube.projected.linear_linear dEQP-GLES3.functional.texture.mipmap .2d.projected.nearest_nearest_mirror .2d.projected.linear_nearest_clamp .2d.projected.linear_nearest_repeat .2d.projected.linear_nearest_mirror .2d.projected.nearest_linear_repeat .2d.projected.linear_linear_clamp .2d.projected.linear_linear_repeat .3d.projected.nearest_nearest_mirror .3d.projected.linear_nearest_clamp .3d.projected.linear_nearest_repeat .3d.projected.nearest_linear_clamp .3d.projected.nearest_linear_mirror .3d.projected.linear_linear_clamp .3d.projected.linear_linear_repeat Fixed: angleproject:8443 Fixed: angleproject:7023 Change-Id: I13fc52532b94de098dcf3e9f5f02d48a6c8913c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5089131 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev edcfab40 2023-11-23T00:00:00 Metal: Implement textureCubeGrad transformation for AGX Wrapped all affected built-in function calls with helpers that transform derivative values. Fixed all *.texturegrad.* dEQP failures on Apple silicon. Fixed: angleproject:7021 Fixed: angleproject:8433 Change-Id: I16b023840ad267ab72d31fde3cb0fa7048e5310c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5071254 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev e8923a62 2023-11-14T00:00:00 Clamp gl_PointSize to both bounds Ensure that point size values smaller than ALIASED_POINT_SIZE_RANGE[0] are clamped as the spec requires. Fixed: angleproject:8416 Change-Id: I3cfd2b1d3c1f34788d062ff4ca4b809ce3b5aaa9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5033198 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 3b555e8d 2023-10-26T00:00:00 GL: Add emulateClipOrigin workaround Older Adreno drivers apply GL_CLIP_ORIGIN_EXT to the framebuffer instead of the clip space, thus causing various side-effects. Used a uniform to emulate the correct behavior. Drive-by: * Fixed a typo in ClipControlTest.OriginFrontFacing Fixed: angleproject:8392 Change-Id: I2f7145977ab0e11dc88e8dbfec2cd32c4c31f830 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4987326 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev f5842350 2023-08-21T00:00:00 Vulkan: Flatten secondary fragment output arrays Added a SPIR-V transformation that makes them private and copies their values into regular fragment outputs. Fixed: angleproject:8336 Change-Id: Ide62dd183426e0de70fd4ac6d2b8c6a4b4b33994 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4875327 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Ho Cheung 0510fb49 2023-09-11T18:11:50 [code health] Use more standard enumerator names Use more standard enumerator names in ANGLE https://google.github.io/styleguide/cppguide.html#Enumerator_Names There are still some non-standard enumerator names in the //cc directory, which will be modified in subsequent patches. Bug: chromium:1480233 Change-Id: I96d534f0eb74a8583237c754f6ef867bd1b33d4a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4853030 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ho Cheung <uioptt24@gmail.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis 280e79e1 2023-08-10T14:08:00 Rescope globals only used in one function to function-local. We can demote global variables when they are only used in one function. This has performance implications on Metal. Bug: angleproject:8311 Change-Id: Id666e6b167be771c14768cd73efa61fdacd897d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4771215 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 59f158c1 2023-08-10T00:00:00 GL: Add explicitFragmentLocations workaround Some drivers produce incorrect results when a fragment output has an implicit location and gl_SampleMask[] is written to. Fixed: angleproject:8308 Change-Id: I615952ef61b1cb611984ec7defb189d89ab3281c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4777702 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi b37df0c7 2023-06-16T12:05:03 Vulkan: Don't output SPIR-V debug info in release Now that the SPIR-V transformer no longer relies on names, we can avoid generating them in the compiler in the first place. This both removes the need for stripping them out and makes the shaders (which are cached) a bit smaller. Bug: angleproject:7220 Change-Id: Ie636ac0ee62cf2730a409872041d22c066fc22ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4615238 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 24f4007b 2023-06-08T00:41:55 Vulkan: Use SPIR-V ids instead of names in the transformer This change removes the SPIR-V transformer's reliance on type and variable names. As a result: - String hashing is removed from the info map data structure and the SPIR-V transformer - The ID discovery class is entirely removed - Internal variable names have become a detail of the compiler alone (and are no longer exposed as part of the compiler interface) - Some front-end name tracking is removed ("parentStructMappedName", etc) This change also properly cleans up xfb emulation types that were previously left over. This change allows the SPIR-V compiler to emit user strings as-is instead of prefixing them with `u_` leading to more readable debug shaders. Additionally, it will make it possible not to emit debug info at all. Both of these changes will be done in follow ups. Bug: angleproject:7220 Change-Id: Iaa127496209a27aaae2e0d14c41b22fffb0b72a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600610 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 10380f4b 2023-06-06T11:52:08 Vulkan: Output SPIR-V ids from compiler In this change, the shader interface variables are given SPIR-V ids by the compiler before SPIR-V generation. Those ids are made available through the ShaderVariable interface. The transformer does not yet rely on this information. A follow up change will rework the backend's name->info map and the transformer to directly use ids instead of names. Bug: angleproject:7220 Change-Id: Ic0a62681d4bcf3ed171c39c3ecd83e438ea068c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600609 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 76b0e7f3 2023-06-01T11:25:54 Vulkan: Use reserved SPIR-V ids for internal variables With this change, the SPIR-V transformer does not need to discover these ids through name matching. Ultimately, user variables would also be identified by their SPIR-V ids (instead of name), removing the Vulkan backend's reliance on strings. Bug: angleproject:7220 Change-Id: I241c3247b89a28f9eed28f23c06b7c8b7fbbeaa0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4583133 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4ff41604 2023-05-31T11:12:33 Vulkan: Declare common SPIR-V ids in the compiler The SPIR-V transformer no longer needs to discover these ids. Bug: angleproject:7220 Change-Id: I7082e831308eaac97ace3c128f398ff5f5497739 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4573825 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5f833ff2 2023-05-31T00:06:24 Vulkan: Pass non-semantic info from translator to transformer The SPV_KHR_non_semantic_info extension is set up in this change to allow the translator to communicate an overview of the SPIR-V to the SPIR-V transformer as well as mark locations of interest. This would help the SPIR-V transformer avoid having to discover basic ids and such locations. In this change, a few basic types are predefined and the location where new types and variables need to be defined are marked. Bug: angleproject:7220 Change-Id: I237b9a79efa9c192b3b11f1d97bc9b6a5cc2f8fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4573823 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 37698dcf 2023-05-25T14:57:21 Translator: Remove the "variables" entry from list of options This flag is unused. It is removed in a separate change to facilitate rolling ANGLE into Chromium and vice versa. Bug: chromium:1447314 Change-Id: I651f766e1c127f81c17ec46554bbdebd240f8c1c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568525 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yuxin Hu dfb2bab0 2023-05-25T15:08:19 Apply Aliased Decorators To Image DataTypes Bug: b/274478912 Bug: b/266235549 Change-Id: I2cd272a1e7481a8803be63efe0be11c61560b23e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568287 Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Scott Violet b0f9c01e 2023-05-01T12:54:10 metal: adds feature that minimizes generated shader differences This adds a feature (enabled by default) that results in generating the same code regardless of whether emulateAlphaToCoverage is enabled or addExplicitBoolCasts. This is done to maximize cache sharing. Bug: chromium:1423136 Change-Id: Ia491f13469c750fc2c45aecf1f93fed53b782dc5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4496254 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Scott Violet <sky@chromium.org>
Alexey Knyazev d37c97d1 2023-04-17T00:00:00 Metal: Implement OES_shader_multisample_interpolation * Added support for sample qualifier and shader interpolation functions * Added MSL-specific AST transformations * Adjusted minimum fragment interpolation offset state query test so that accurate limits could be reported * Drive-by: Y-flip gl_SamplePosition adjustment * Renamed ANGLESampleMaskEnabled function constant to ANGLEMultisampledRendering to correctly reflect its usage Bug: angleproject:8097 Bug: angleproject:8131 Change-Id: I25c9f36487e29f05bb9fe874e146d06378fef975 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4440827 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Yuxin Hu 6deca89e 2023-03-22T22:33:40 Add Spirv Instruction to explicitly cast mediump float to 16 bit If the GLSL shader code expects the comparison between two mediump float values returning true, but the SpirV compiler treats one of them as 32-bit, and treats the other one as 16-bit, the comparison would return false instead. The SpirV compiler may not automatically cast the mediump float values to 16 bits, because it may utilize the RelaxedPrecision decoration to keep a mediump float as 32-bit, so that the compiler can avoid the type cast from 32-bit highp to 16-bit mediump. This change adds an additional OpQuantizeToF16 SpirV instruction to explicitly cast mediump float scalar or mediump float vector to 16 bit, if they are assigned with a highp float value. This ensures that if the GLSL shader code ever compares two meiump float values, the SpirV shader compiler is not accidentally comparing a 16 bit with a 32 bit float value. This fixe the deqp test failure on Pixel 6 and Pixel 7: dEQP-GLES2.functional.shaders.algorithm.rgb_to_hsl_vertex. Bug: b/274859104 Bug: b/274408172 Change-Id: Ifd996cea14c0f77f45ae90f38c8e53cf5035139f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4400404 Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Alexey Knyazev 7bc4b7e3 2023-03-27T00:00:00 Metal: Implement OES_sample_variables New ESSL built-ins are mapped to their Metal counterparts and tweaked to follow OpenGL ES semantics when needed. Fixed A2C interaction with sample coverage by emulating the former on non-Apple GPUs. Bug: angleproject:8097 Fixed: angleproject:5087 Change-Id: I5d28a941af5cbc14743a3930731529f11f55febd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4404896 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi c26011b8 2023-04-11T15:16:29 Vulkan: Make advanced blend alpha div workaround permanent This workaround turned out to affect pretty much every driver, and numerous GL implementations were found to work around it similarly to ANGLE. It seems like this workaround may only be necessary for colorburn and colordodge, but for now ANGLE applies it to all modes. Bug: b/274528004 Bug: b/277777623 Change-Id: Id555c981a9775f949a3022b7e92c755accea7cea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4416158 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8b79410b 2023-04-02T22:25:12 Vulkan: Treat readonly SSBOs as readonly! Instead of assuming SSBOs are always written to, this change adds plumbing for the backend to know when an SSBO is declared readonly and marks the buffer readonly accordingly. With this change, BufferVk can optimize uploads and copies to and from the buffer with the knowledge that it can be safely mapped on the CPU for read while it's being used by the GPU. Bug: b/276002151 Change-Id: I75342148c07949a83436054a738395bbd88caec5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4392720 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 29abd5a2 2023-03-06T11:35:45 Explicitly Add Aliased Memory Decoration in SpirV In GLSL, aliased memory qualifier is implicitly available, unless we explicitly specify the memory is restrict: https://www.khronos.org/opengl/wiki/Type_Qualifier_(GLSL)#Memory_qualifiers. However, in SpirV, aliased memory qualifier has to be explicitly specified: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#AliasingSection This change adds the aliased memory decorations to SSBO if the GLSL does not specify the restrict memory qualifier. This is a temporary workaround to fix the deqp test failures on some android devices. Eventually we would like to waive this test for ANGLE due to alised memory in Vulkan does not suppose to affect SSBOs that have different set/binding, please refer to this Khronos ticket for more details: https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4321 Bug: b/266235549 Change-Id: Ic7afc417a5d421664b60e0413a011314787e14e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4312130 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 1ee27fcd 2023-03-24T00:00:00 Fix translation of noperspective interpolation qualifier Auxiliary storage qualifiers used with 'noperspective' interpolation must be retained during ESSL translation * Added new qualifiers: * EvqNoPerspectiveCentroid * EvqNoPerspectiveCentroidIn * EvqNoPerspectiveCentroidOut * EvqNoPerspectiveSample * EvqNoPerspectiveSampleIn * EvqNoPerspectiveSampleOut * Adjusted GLSL and SPIR-V output * Adjusted 'sample' rank to be the same as 'centroid' Fixed: angleproject:4388 Change-Id: Iffc80a7a3b057beffd3bcbbc9446eeed77183c99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4368471 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev ad52f12e 2023-03-21T00:00:00 Implement EXT_conservative_depth Added translator frontend and GLSL backend support for gl_FragDepth redeclaration and layout qualifiers. Added mappings to DepthGreater, DepthLess, and DepthUnchanged SPIR-V execution modes. Bug: angleproject:8046 Change-Id: I23f19ff54380741107970a44055ea269eef179f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4355028 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
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>
Shahbaz Youssefi 5d1ac2e0 2023-01-17T10:21:01 Add missing include to ShaderVars.h Patch by mcatanza@redhat.com Bug: angleproject:7963 Change-Id: I1466ab227ae4e8b5703bd68bafbf12c31d441c2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4174172 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 067ace47 2022-12-21T00:00:00 Add ANGLE_clip_cull_distance extension Added an extension spec. Trivially exposed it on GL, Vulkan, and D3D11. Adjusted tests and validation to allow no cull distance support for this extension string. Removed extra built-in variable definitions. Bug: angleproject:7904 Change-Id: Ic60772dfe28132c316eaa29aadc1afd66e3b0fa7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4114290 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.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>
Chris Dalton 9bd9c1c2 2022-11-03T11:49:33 Workaround for AMD [[raster_order_group()]] bug Metal [[raster_order_group()]] does not work for read_write textures on AMD when the render pass doesn't have a color attachment on slot 0. To work around this we attach one of the PLS textures to GL_COLOR_ATTACHMENT0, if there isn't one already. Bug: angleproject:7792 Bug: angleproject:7803 Bug: angleproject:7818 Change-Id: I7567ed28ed30c7e3ca23dc52778ed90f2fdff965 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4004529 Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 8ee1b89f 2022-11-04T13:10:37 Refactor pixel local storage options The various different PLS options were getting scattered and unruly. We are also in need of more backend-specific PLS options that would be difficult to add as-is. This CL refactors them into a single "ShPixelLocalStorageOptions" struct that gets initialized all in one place, and shared between the compiler and the backends. Bug: angleproject:7279 Change-Id: Ic58dccb8d1ba350a0b6cc5848ce15bd687e30fad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4006715 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi fa37af38 2022-07-12T22:47:22 Translator: Support SSO's built-in redeclaration EXT_separate_shader_objects requires that gl_Position and gl_PointSize be redeclared in the vertex shader. This is not adopted by GLES3.2, but is nevertheless required to be supported if the shader enables this extension explicitly. Bug: angleproject:6590 Change-Id: I3428851ff9f00fb63573e4322bb62fe04bf0a095 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3757918 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 78e28cb8 2022-11-03T11:05:48 Vulkan: Remove glslang fallback ANGLE's SPIR-V generator is battle tested by now. Bug: angleproject:6210 Change-Id: I2ed88642e3ede435e3f906fbd701133be6873fb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4002868 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 5b218196 2022-11-06T11:39:23 Metal: Remove compilation through SPIR-V Direct metal generation is stable. Bug: angleproject:6081 Change-Id: If9e76f61ad38f2fc9963f0181dfd03c99ffa3e2b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4003675 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 5e95a4d9 2022-10-07T00:52:38 Add an EXT_shader_pixel_local_storage impl of PLS Translates ANGLE_shader_pixel_local_storage shaders directly to EXT_shader_pixel_local_storage. Polyfills load/store operations using internal fullscreen draws. Since the ANGLE extension needs the ability to preserve all active PLS planes to textures, we can only support this extension when the backend context also has access to ES 3.1 shader images. Bug: angleproject:7279 Bug: angleproject:7771 Change-Id: Id348bde412efcc081ff29ee05ec59ad652f77569 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3966075 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Chris Dalton 2d31fe98 2022-09-22T21:04:22 Implement PLS on Apple Silicon Implements a subset of EXT_shader_framebuffer_fetch in the Metal translator that is sufficient to support pixel local storage. Metal's "programmable blending" feature is available on all Apple family GPUs beginning with version 2. Support for non-Apple GPUs will come later via readWrite textures, which can also be coherent by annotating them with [[raster_order_goup(0)]]. Bug: angleproject:7279 Change-Id: Ic74f6c0d21e87eb919e1f487163388d08d126857 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3916794 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Gregg Tavares <gman@chromium.org>
Chris Dalton a7dc51f2 2022-10-01T08:49:11 Add a framebuffer fetch implementation of PLS The framebuffer fetch implementation works by attaching PLS backing textures to the framebuffer, and then rewriting PLS uniforms as "inout" fragment variables. The compiler's existing machinery takes it from there and makes it work on GL and Vulkan, and soon Metal. EXT_shader_framebuffer_fetch is now the preferred backend for pixel local storage, but we also use EXT_shader_framebuffer_fetch_non_coherent if shader images can't be coherent. This is especially interesting for Vulkan, since noncoherent framebuffer fetch is possible without any extensions. Bug: angleproject:7279 Bug: angleproject:7683 Bug: angleproject:7684 Bug: angleproject:7724 Change-Id: I33f3b2c6df9a5709969d9165c448ea71b096c9e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3900142 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 493bab09 2022-09-15T14:20:41 Add an ShPixelLocalStorageType enum Adds ShPixelLocalStorageType to ShCompileOptionsPLS and adds a getNativePixelLocalStorageType() call to ContextImpl. For now this enum only tells the translater whether PLS formats needs to be packed into r32 images, but it will soon also be able to select framebuffer fetch, native pixel local storage, and other PLS implementations. Bug: angleproject:7279 Change-Id: Ifbd419b20550b8711ae3044782177806796216f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3900498 Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Chris Dalton 9d41585e 2022-08-12T14:20:34 Make PLS coherent on D3D 11.3 Adds a new internal memory qualifier to the compiler called "rasterOrdered", which we set in RewritePixelLocalStorage.cpp when D3D 11.3 Rasterizer Order Views are supported. The HLSL translator then generates RasterizerOrderedTexture2D<> instead of RWTexture2D<> when this qualifier is set. Bug: angleproject:7279 Change-Id: I39b8c3279b7bff93b7e57272e8fb84d9c0312616 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3830288 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 4a636cdd 2022-07-20T22:44:30 Require all PLS formats to consume exactly 4 bytes of storage D3D 11.0 UAVs only support R32_FLOAT, R32_UINT, R32_SINT formats. EXT_shader_pixel_local_storage explicitly states that all PLS variables consume exactly 4 bytes. ESSL images can only have both read and write access if their format is r32f, r32i, r32ui. (We were able to circumvent this via aliasing, but it was a huge source of bugs.) There is a large precedent for only supporting 4 bytes of storage in the capabilities we use for PLS, so this CL removes support for all PLS storage formats that are not 4 bytes. It also implements an "R32" mode for PLS, that does manual packing and unpacking of r32* image formats. If the application wants larger formats, it can always define multiple PLS planes and piece them together. Next up we ought to be able to support rg16* types with more packing/unpacking. With aliasing gone, and with a bit of tweaking, the PLS tests now pass on the Pixel 4 GLES bot. Bug: angleproject:7279 Bug: angleproject:7388 Bug: angleproject:7524 Bug: angleproject:7527 Change-Id: I6b8f62c2428ade6cb5413e33360d734e55dda0eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3782579 Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 7c6a5459 2022-08-10T10:09:18 Rename ShFragmentSynchronizationType::None -> NoSynchronization Use a less generic name. X11.h contains: #define None 0L /* universal null resource or null atom */ Bug: angleproject:7279 Change-Id: I7d245b9f771211dea151bfc12363a03374264ac4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3824717 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> 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>
Chris Dalton 861149c7 2022-08-03T15:43:29 Make PLS coherent on desktop OpenGL Implements ANGLE_shader_pixel_local_storage_coherent using fragment shader synchronization extensions: NV_fragment_shader_interlock INTEL_fragment_shader_ordering ARB_fragment_shader_interlock With these extensions combined, we get coherency all 3 big desktop vendors: NVIDIA, Intel, and AMD. Bug: angleproject:7279 Change-Id: Ie20b251fb772898e89994b799640f1f2806581eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3773990 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Lingfeng Yang 3ccaddf9 2022-07-26T10:02:01 Vulkan: EXT_YUV_target: layout(yuv) support This CL adds support for layout(yuv) in the shader, via a new decoration. The SPIRV decoration enum number is WIP and depends on final spec. The decoration is only active if enabled via a flag in ShaderLang, which will be connected with the feature supports_yuv_target in a future CL. Bug: b/223456677 Change-Id: I29a724e689d1336a3e42c83d7afa944a11e07353 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3765890 Auto-Submit: Lingfeng Yang <lfy@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com>
Chris Dalton 15cc0013 2022-07-14T23:32:05 Add a GL_ANGLE_shader_pixel_local_storage extension Plumbs through "GL_ANGLE_shader_pixel_local_storage" and "GL_ANGLE_shader_pixel_local_storage_coherent" extension strings advertised by ANGLE and stubs out an initial spec document. This change doesn't add any new procedures or shader constructs, but it does allow the PLS tests to start checking for the real extension strings and requiring the GL_ANGLE_shader_pixel_local_storage extension. Bug: angleproject:7279 Change-Id: I36877fe4117185a2121f803288123cd69a447cf3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739590 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Mohan Maiya 9070e279 2022-06-30T09:35:59 Vulkan: Handle platforms that have imprecise float division issues Even when the dividend and divisor have the same value some platforms do not return 1.0f. We need to emit sepcial division code on such platforms. Bug: angleproject:3586 Tests: KHR-GLES31.core.blend_equation_advanced.blend*HSL* Change-Id: Ibb81f57c959ae2c8edb6d361bf6241c019dfb988 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3738439 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 3b988fef 2022-06-01T10:54:03 Vulkan: Remove enableLineRasterEmulation * Removed the Bresenham line raster emulation specialization constant, along with related variables and functions. Bug: angleproject:7366 Change-Id: If17c8ce9b459ad801bae8e887e5674bd9a3ff2bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3680860 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi ce3c0fe9 2022-06-06T12:09:45 Vulkan: Make depth-correction uniform controlled This change makes sure SPIR-V transformations are not required for depth correction, having the number of potential pipelines. Bug: angleproject:5881 Change-Id: If3f66b34bdd1127ae588cbc822ea7cf01fa8621f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691801 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 23f213d1 2022-05-26T23:43:44 Vulkan: Make drawable size uniform As a specialization constant, it's impossible to predict the value the drawable size may take, which in turn makes it impossible to warm up the Vulkan pipeline cache at link time. Bug: angleproject:7366 Change-Id: Ia3d1860a4fcb8e3078fdcb8d02a2e0cd173ea028 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671976 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2df17a12 2022-05-25T16:18:37 Vulkan: Pack driver uniforms Previously 5 vec4s were used for driver uniforms + 2 vec4s if specialization constants couldn't be supported. The driver uniforms are rearranged and packed such that only 2 vec4s are normally used, which include fallback for specialization constants as well. In the future, most of the specialization constants may turn into uniforms, and this change prepares for that. Additional uniforms are used (3 vec4s) only if common extensions are missing; transform feedback and bresenham lines. This change makes it more practical for driver uniforms to be turned into push constants. Additionally, these uniforms could potentially be loaded and cached at the beginning of the shader for more efficient memory access. On Pixel6, with this change, the traces show no difference in wall time. On most traces, CPU time shows up to ~7% improvement. Bug: angleproject:7366 Change-Id: I0f47f863955af06a19c69d1f1d7c45b97d95476e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3668151 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 98c2e169 2022-05-20T16:17:49 Vulkan: Reduce pre-rotation spec const to bool The specialization constant now only dictates whether x and y should be swapped. The complete 8 possible states of rotation and y-flip are achieved by using this swap in combination with a driver uniform for x and y flip. Swapping is still a specialization constant to avoid degrading performance of dFdx/dFdy which otherwise would need both to be evaluated instead of one. On platforms which don't support pre-rotation, the specialization constant will never change and driver uniforms entirely govern y-flip. On platforms that do support pre-rotation, only two variations of the pipeline are needed. Bug: angleproject:7366 Change-Id: I73f84e89fa9349d2098fa5b21573aee57d93a30c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3663151 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
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 3b65b803 2022-04-27T11:04:22 Vulkan: Work around Qualcomm imprecision with dithering On qualcomm, sometimes the output is ceil()ed instead of round()ed. With ditering emulation affecting values, some dEQP tests fail due to the excessive change in value when dithering bumps the value slightly over to the next quantum. In this change, a workaround is added to round() the value before outputting it. Bug: angleproject:6953 Change-Id: Iae7df5ca20055b4db3185c6153f3c0bf4ba07f68 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3611064 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c5271e8e 2022-04-04T23:28:35 Vulkan: Emulate GL_KHR_blend_equation_advanced Based on a change by Brandon Schade <b.schade@samsung.com> In the translator, when advanced blend is enabled, an input attachment is added. Based on the listed advanced blend equations, emulation code is added that performs those equations' functions. The blend equation itself is passed through a driver uniform. Note that the advanced blend extension only allows a single output to use advanced blend, and that should be at location 0. In the Vulkan backend, when advanced blend is used, the driver uniform to select the equation is updated and normal blending is disabled. Bug: angleproject:3586 Change-Id: Icc42e8be238d34fca149087eb9cfe616a7643a6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3575738 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1e773db9 2022-02-22T10:51:15 Vulkan: Shader support for KHR_blend_equation_advanced Translator can accept the layout qualifiers for the advanced blend equation. No emulation code is currently generated, and ANGLE will initially rely on the corresponding Vulkan extension. Based on change by Brandon Schade <b.schade@samsung.com> Bug: angleproject:3586 Test: angle_unittests --gtest_filter=*KHRBlendEquationAdvanced* Change-Id: I3b728c5f144386d7030bbbb301ddb07daa1492b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3481309 Reviewed-by: Brandon Schade <b.schade@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 38fada35 2022-01-27T18:16:18 Vulkan: Add support for OES_primitive_bounding_box Add OES version of the primitive bound box extension Bug: angleproject:3576 Test: dEQP-GLES31.functional.primitive_bounding_box.* Change-Id: Ie44d952992a68dfffd5c124dda8dd11069f0c1e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3425086 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
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>
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>