Commit Graph

1100 Commits

Author SHA1 Message Date
Ho Cheung
0510fb4993 [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>
2023-09-11 14:12:17 +00:00
Shahbaz Youssefi
e234c1825f Add features for VK_EXT_host_image_copy
Bug: angleproject:8341
Change-Id: Id076e6c9e040f3c19a1eb221f6099ac11d4d091a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4852280
Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-09-09 02:09:59 +00:00
Mohan Maiya
af30f36b84 EGL: Update EGL headers
In order to support EGL_EXT_gl_colorspace_bt2020_hlg
we need the EGL_GL_COLORSPACE_BT2020_HLG_EXT enum which
got added to the eglext.h header recently.

There were non-upstreamed changes to eglplatform.h
in commits 88d3b8cb73 and
2bdcbb9a37, retain them.

Bug: angleproject:8330
Change-Id: Ia56513ff7ed36a9d0c436220bf25eab25f9df169
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4824044
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: mohan maiya <m.maiya@samsung.com>
2023-08-29 21:28:42 +00:00
Alexey Knyazev
0688a940c8 GL: Disable EXT_texture_mirror_clamp_to_edge on Mesa
Although the extension string is exposed,
the new enum is currently rejected when
using an OpenGL ES context.

Bug: angleproject:8319
Change-Id: I17c4105344fe7ca3038a79e0e09528db1d96376b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4807744
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
2023-08-23 20:53:06 +00:00
Alexey Knyazev
9f258f8a03 GL: Add disableRenderSnorm workaround
Disable the extension on Mesa versions that
clamp negative snorm values to zero on read.

Fixed: angleproject:8315
Change-Id: I5459db40cb08c546fba15f5e6d70578029a8218a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4804324
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
2023-08-23 14:17:38 +00:00
Shahbaz Youssefi
d8f088e034 GL: Remove parallel compile/link without driver support
This feature was practically disabled everywhere due to various bugs,
and is complicating the code.  In effect, the code was always spawning a
thread for the compilation and link jobs, immediately fail it (due to a
workaround), then do the job when compile/link is resolved (much closer
to draw time).  This leads to bad user experience, but also is racy
because the shaders may get recompiled in the meantime and there is
little the GL backend could do to stop that (efficiently).

After this change, parallel compile/link
is either done by the driver (if supported), or it isn't done.

This is a partial revert of a100d8f471.

Bug: angleproject:3031
Bug: chromium:922936
Bug: chromium:1184692
Bug: chromium:1202928
Change-Id: I6348bee3249ccb3828bb98ac2a69dc7d305f821c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4774785
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2023-08-23 13:40:50 +00:00
Jonah Ryan-Davis
280e79e1fa 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>
2023-08-22 15:22:50 +00:00
Alexey Knyazev
59f158c169 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>
2023-08-15 20:00:35 +00:00
Shahbaz Youssefi
16cfa28e11 Vulkan: Basic infra for parallel link
This change moves pipeline warm up to a parallelizable task, mostly as
an exercise to put in the infrastructure for parallel link in the Vulkan
backend.  Follow up changes will move more of the link step to this
task.

The end goal is to be able to make the link task independent of
ContextVk, which would allow it to be run as an UnlockedTailCall, even
if not using a worker thread.

Bug: angleproject:8297
Change-Id: I17047162b2a41f0d681d9e3ee33f2e0239b4280d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4764231
Reviewed-by: Charlie Lao <cclao@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-12 02:04:06 +00:00
Steven Noonan
ffe81dd3cd Vulkan: allow opt-in to MSRTT emulation via overrides
The existing enableMultisampledRenderToTexture feature combines
conditions for device feature support and the policy decision of whether
to allow MSRTT emulation.

This change splits it into two features, allowing application developers
to control the policy condition for the emulation path without impacting
the device capability checks.

Bug: angleproject:8291
Change-Id: Ic1525c878906b10df777c582e44b931028aae928
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749525
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-10 20:02:35 +00:00
Steven Noonan
f395f34bc0 features: frontload feature overrides
This allows us to have features that depend on the state of other
features more reliably.

For example, let's say you have two features:

    ANGLE_FEATURE_CONDITION(&mFeatures, allowX, (benefitsFromX || isSpecificHardware) && !isBadHardware);
    ANGLE_FEATURE_CONDITION(&mFeatures, supportsX, hardware.featureXSupported && mFeatures.allowX.enabled);

Before this change, if you overrode allowX, the override would be
applied too late for the supportsX test.

This also helps with disabling dependent features via overrides. For
example, if you disable "supportsRenderpass2", it will also disable
features depending on it, such as "supportsDepthStencilResolve" and
"supportsFragmentShadingRate".

By frontloading the feature overrides, we can have cross-dependencies
between "feature supported on this platform" and "allow this feature by
policy".

Bug: angleproject:8291
Change-Id: Id6da2c89428fa896d677fe8d5a41369277a21b31
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749524
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-10 18:26:50 +00:00
Alexey Knyazev
2a950c63fb Adjust ANGLE_stencil_texturing specification
STENCIL_INDEX enum is not defined in GLES/gl3.h,
so the extension has to provide its value.

Bug: angleproject:8051
Change-Id: Ia383162afee8cdcffc1d68ddf833fbd91a87b1f0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4748399
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Alexey Knyazev <lexa.knyazev@gmail.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-03 21:34:11 +00:00
Shahbaz Youssefi
6c1bab0702 Add surface to eglAcquireExternalContextANGLE
Bug: angleproject:5509
Change-Id: I51284ae4dc865dc31d1c5540c24e1e0abb95fe0f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4743719
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-02 18:41:04 +00:00
Shahbaz Youssefi
01ee134bb2 Revert "GL: Remove EGL_EXTERNAL_CONTEXT_SAVE_STATE_ANGLE"
This reverts commit 4e0250f192.

Reason for revert: Chromium change was reverted. crbug.com/1468956

Original change's description:
> GL: Remove EGL_EXTERNAL_CONTEXT_SAVE_STATE_ANGLE
>
> Now that Chromium no longer uses it.
>
> Bug: angleproject:5509
> Change-Id: Ibb8d9cdc4d67dad77ca50437423b18d81e838203
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4724768
> Reviewed-by: Peng Huang <penghuang@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>
> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>

Bug: angleproject:5509
Change-Id: Id8143b1715ec8162be9351437fbd34a2aa4c2e00
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4742521
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-08-02 14:58:42 +00:00
Shahbaz Youssefi
4e0250f192 GL: Remove EGL_EXTERNAL_CONTEXT_SAVE_STATE_ANGLE
Now that Chromium no longer uses it.

Bug: angleproject:5509
Change-Id: Ibb8d9cdc4d67dad77ca50437423b18d81e838203
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4724768
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-07-31 22:47:38 +00:00
Kenneth Russell
d2236b5837 Support substituting translated shaders.
Add dumpTranslatedShaders and enableTranslatedShaderSubstitution
frontend ANGLE features, which allow ANGLE developers to prototype
optimizations and other transforms without fully implementing them in
the shader translator.

Tested on macOS with ANGLE's Metal backend, but should work with the
other source-level translator backends.

Add documentation for pre-existing substitution of shader sources, and
of translated shaders added in this CL.

Fixed: angleproject:8280
Change-Id: I24d5ef88a479b23e81cc8169fe813c263acfc71f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4731553
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
2023-07-31 21:25:14 +00:00
Shahbaz Youssefi
2d5fb09d7f Stubs for EGL_ANGLE_external_context_and_surface
Bug: angleproject:5509
Change-Id: I8e2395784abcd2b4e3e1f888e70a879ef49287bc
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4706026
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2023-07-25 16:16:54 +00:00
Geoff Lang
9aadc7aacd Metal: Require MSL 2.1.
We had previously shipped both MSL 2.0 and 2.1 shaders to support
MacOS 10.13 (MSL 2.0 only) while also supporting the stencil blit
fast path that MSL 2.1 provides with the has_shader_stencil_output
feature.

Each configuration of precompiled shaders is ~300kb so we will drop
support for MacOS 10.13 and only ship the MSL 2.1 shaders.

Rework of the disablement for NVIDIA and GPU family 1 to be more
readable. The features themselves are always true because "disable on
NVIDIA" is always true and the check for "is NVIDIA" is moved to the
code which fails the initialization.

Bug: angleproject:8258
Change-Id: Icc8c69540e43fd2b0b237fffbfe170bb3422903f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4681130
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-07-17 22:00:36 +00:00
Phan Quang Minh
4cab5e94fc Vulkan: Enable timeline semaphores if supported by device
This is needed for a similar change in Chromium to function with
`--enable-features=VulkanFromANGLE`.

Bug: angleproject:8253
Change-Id: I422964ea010c650439dd4797ee8ba7b533f26a87
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4675807
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-07-12 11:11:51 +00:00
Geoff Lang
4e6124dae8 GL: Ensure all instanced attributes have a buffer with data
Apple OpenGL drivers sometimes crash when given an instanced draw with
a buffer that has never been given data.

It's not efficient to check if the attribute is both zero-sized and
instanced so just ensure that every time a zero-sized buffer is bound
to an attribute, it gets initialized with some data.

Bug: chromium:1456243
Change-Id: I66b7c7017843153db2df3bc50010cba765d03c5f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4642048
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-07-11 17:25:50 +00:00
Shahbaz Youssefi
f5ad056b0d GL: Fix ScalarizeVecAndMatConstructorArgs and move to gl/
This transformation was buggy and was disabled.  Originally, it was
intended to be used everywhere.  It is now needed for a GL driver
workaround.

This change reimplements this transformation and uses it as a GL
workaround.

Bug: chromium:1420130
Change-Id: I42d63fa5844bcf683ac41e61925aa637e033ca2e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4676634
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2023-07-11 15:08:28 +00:00
Steven Noonan
42c3a9fe3e Vulkan: support creating context with MoltenVK on macOS
The Vulkan loader somewhat recently introduced a requirement that
clients must opt-in to using portability implementations of Vulkan (such
as MoltenVK). Since there is no native Vulkan driver for macOS (and
therefore no alternative), unconditionally enable the portability
enumeration extension there.

Bug: angleproject:8229
Change-Id: I24f0f24e25abd277855ed9ac4de370cfb47d3266
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4639495
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Steven Noonan <steven@uplinklabs.net>
Reviewed-by: Charlie Lao <cclao@google.com>
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
2023-06-27 02:25:34 +00:00
Mohan Maiya
0fe6f28262 Reset and then populate frontend features during display initialize
Overwritten features were never reset even if a display was
terminated. On platforms that reuse displays for all tests
in the end2end suite, overridden feature would leak into
subsequent tests causing unexpected failure.

Bug: angleproject:8235
Change-Id: I1b359bc762a2bca8db4e4dbc7a587604e5bd6a5b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4643453
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: mohan maiya <m.maiya@samsung.com>
2023-06-26 17:15:59 +00:00
Steven Noonan
ac263582dd Vulkan: add workaround for VK_EXT_full_screen_exclusive on AMD
On outdated (but recent) AMD drivers, the Windows-only Vulkan extension
VK_EXT_full_screen_exclusive appeared to be implicitly enabled and set
to VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT mode. Even though
ANGLE did not enable or interact with this extension at all, the driver
was incorrectly returning VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT
error codes on various swapchain operations when the full screen window
focus was lost (i.e. alt-tab out and back in). Naturally, ANGLE was not
expecting these error codes and did not know how to handle them.
Depending on where the errors occurred, ANGLE might crash or retry
creating the swapchain repeatedly.

Treating the unexpected VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT
error code as VK_ERROR_OUT_OF_DATE_KHR/VK_SUBOPTIMAL_KHR was not
sufficient, because the driver would repeat the error on every swapchain
operation, apparently expecting the error to be handled by
a vkAcquireFullScreenExclusiveModeEXT call (even though that would make
no sense, since the extension was not enabled).

The incorrect driver behavior was reported to AMD and was fixed in
recent driver releases. The earliest driver I've tested and know to be
working is AMD's Adrenaline driver version 23.5.2
(VkPhysicalDeviceProperties calls this driverVersion 2.0.262/0x800106).
The last known bad version was 0x8000e9.

The simplest workaround on these older AMD graphics drivers is to
explicitly enable the extension, but set it to
VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT mode. On newer drivers we do not
need to do anything with the extension and can ignore it.

Bug: angleproject:8215
Change-Id: I7c58d47a0350f4b0bc1a77f200c1e2f72fcde8d8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4627279
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
2023-06-21 20:37:29 +00:00
Shahbaz Youssefi
b37df0c729 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>
2023-06-19 15:59:26 +00:00
Shahbaz Youssefi
24f4007b93 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>
2023-06-17 02:00:24 +00:00
Kramer Ge
88c6dfcc7d Mali: Make the placeholder FBO complete for timer queries
Change the bindFramebufferForTimerQueries workaround to ensure
the framebuffer is complete.

Bug: chromium:1356053,b/269068358
Change-Id: Ief3198fdc4800468670a3f4323a1ffd3ca083c6f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4582606
Auto-Submit: Kramer Ge <fangzhoug@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2023-06-15 15:26:04 +00:00
Roman Lavrov
1572f609c1 Disable hashes for ANGLE features generator
Features autogen files are small, fast to regenerate.
Run the generator in --verify-only mode and check content every time,
instead of using hashes.

Bug: angleproject:8193
Change-Id: I3988ab50a6c33171b7b7252c03f34a74f09fcf18
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4604579
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-06-12 22:14:32 +00:00
Roman Lavrov
21f16cb163 Disable clang-format on ANGLE features autogen outputs
Updates the script to produce reasonably formatted code without
clang-format.

Autogen files moved to autogen/ sub-directories because clang-format
does not support per-file settings ;(

This allows to run this codegen very quickly
(~50ms on my machine)

Bug: angleproject:8193
Change-Id: Ie84282090d574ebb4debe3edcfd82f983f27a5ff
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4604578
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-06-12 17:52:18 +00:00
Shahbaz Youssefi
10380f4ba4 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>
2023-06-10 04:49:13 +00:00
Shahbaz Youssefi
76b0e7f38b 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>
2023-06-08 20:37:26 +00:00
Shahbaz Youssefi
4ff41604e7 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>
2023-06-04 00:15:30 +00:00
Shahbaz Youssefi
5f833ff2ae 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>
2023-06-04 00:09:27 +00:00
Shahbaz Youssefi
b0e9bbd79f Vulkan: Split features for dynamic state
When a driver bug with dynamic state is encountered, it is hard to debug
which dynamic state exactly is causing an issue, due to the current
granularity of disabling all entire state from an extension.  With this
change, every dynamic state gets its own ANGLE feature, and can be
toggled as necessary.

Disabling the supportsExtendedDynamicState* features implicitly
disables all dependent features.

Bug: b/285124778
Bug: b/275210062
Bug: fuchsia:107106
Bug: angleproject:5906
Change-Id: Ic291279872df2d0eb58618ff364ab118bdcc4a9f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4577553
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuxin Hu <yuxinhu@google.com>
2023-06-01 00:37:50 +00:00
Shahbaz Youssefi
37698dcf13 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>
2023-05-31 21:06:07 +00:00
Yuxin Hu
dfb2bab0bb 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>
2023-05-31 16:25:55 +00:00
Roman Lavrov
16b9a16ae4 Add supports_legacy_dithering feature
VK_EXT_legacy_dithering =>
VkPhysicalDeviceLegacyDitheringFeaturesEXT.legacyDithering =>
supportsLegacyDithering

Now getting enabled=true on Android master.

Bug: b/284462263
Change-Id: Ibf43184c78d9847044b10413d2050b653e452c9b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4567572
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-05-26 21:08:32 +00:00
Kenneth Russell
aea8856277 Reland "Metal: Optimized BufferSubData per device"
This reverts commit ee64836f70 ,
relanding the patch stack described there.

Between patchsets 1 and 5:

- The shadow buffer allocation has been replaced with a multimap of
  precisely-sized buffers, rather than rounding up buffer sizes.

- Garbage collection of shadow buffers is triggered in three situations:

  - A certain number of context switches have occurred; this number
    was hand-tuned to avoid GC every frame.

  - A certain number of command buffer submissions has occurred; this
    number was hand-tuned to GC no more often than every few seconds
    on representative workloads.

  - The total size of the allocated shadow buffers is more than 1 MB,
    and either more than twice the size at the last garbage
    collection, or 64 MB more than at the last garbage collection. In
    this case, aggressive GC is performed in order to reclaim shadow
    buffers more quickly.

Performance before and after these changes appears identical on
microbenchmarks. On one Figma test case, comparing GPU memory
allocated inside the BufferManager, peak consumption is decreased by
over 75%, and steady-state consumption decreases by over 88%.

Patchset 6 adds a needed workaround for a bug in the
AMDMTLBronzeDriver affecting uploads of client-side data, and
therefore some dEQP tests. It also streamlines the aggressive GC.

Bug: angleproject:7544
Change-Id: I81b061f0b33c27fa403527fa12d626f4e9c88ebe
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4497413
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-05-25 18:43:45 +00:00
Alexey Knyazev
33e3886213 Vulkan: Limit clampFragDepth workaround to affected drivers
Bug: angleproject:3970
Change-Id: I708591d86b8f2cb10d0cbdc7c14518fda45ac626
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4562134
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
2023-05-24 14:36:44 +00:00
Geoff Lang
6d3e587004 Metal: Disable Metal support on NVIDIA GPUs
NVIDIA GPUs are in a very small number of Macs and we don't have have
adequate test coverage to properly support them.

Add the disable_metal_on_nvidia feature to control support for NVIDIA
at runtime. Also factor the support of GPU family 1 into a feature.

Bug: angleproject:8170
Change-Id: I160036d710cc9e278eb77e351a483b9f5b69e8ce
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544659
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
2023-05-23 21:19:55 +00:00
Alexey Knyazev
7abc5248d8 Vulkan: Enable VK_EXT_depth_clamp_zero_one
Replaced the 'depth_clamping' workaround
with the dedicated extension or explicit
fragment depth clamping.

Fixed: angleproject:3970
Bug: angleproject:8077
Change-Id: Ia7666fcb3e0e949922c13a3fd11b818cbc5a8e26
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4545084
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-05-23 17:43:28 +00:00
Brian Ho
ea0b1b7b0e Selectively advertise base vertex and instance fns
On newer Mali GPUs (Valhall), the glDraw*BaseVertex* implementations
seem to be buggy and cause noticable artifacts. Chrome uses the
presence of baseVertexBaseInstanceANGLE and baseInstanceEXT
extensions to determine whether it can draw with a base vertex or to
fallback to manually offsetting the vbo.

This CL disables these extensions on Mali Valhall so that Chrome
takes the fallback path instead to fix the visual artifacts.

Bug: b/280931795
Change-Id: Ic27e37465283ca3338747b53aa7888c7eba4b7b8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4549682
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2023-05-19 21:05:57 +00:00
Shahbaz Youssefi
b76166d027 Vulkan: Separate image and sampler 2D view of 3D features
The sampler feature is used to determine if EGL_KHR_gl_texture_3D_image
can be exposed.  The image feature is used to support base GLES 3.1
storage images.

Bug: b/274478146
Change-Id: Ifb283633078ace7ee65f8aafe756d0a02b727bd7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4545005
Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2023-05-19 01:32:44 +00:00
Mark Lobodzinski
c9ce8f33a8 Revert "Don't export ANGLE platform methods."
This reverts commit 7a11f4415e.

Reason for revert:
Running Android games using ANGLE results in crashes or hangs.

Original change's description:
> Don't export ANGLE platform methods.
>
> These functions are loaded through eglGetProcAddress. We don't need
> to export these extra symbols and increase our binary size.
>
> Bug: chromium:1445969
> Change-Id: I494bbcb86973f167e8245b56e6eb73da7eab69f5
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4538367
> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>

Bug: b/283233503
Change-Id: I42418c0dabc440fb13ce3d48d63b2622b9edd15e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544216
Commit-Queue: Mark Łobodziński <mark@lunarg.com>
Reviewed-by: Mark Łobodziński <mark@lunarg.com>
Reviewed-by: Yuxin Hu <yuxinhu@google.com>
2023-05-18 23:17:00 +00:00
Geoff Lang
7a11f4415e Don't export ANGLE platform methods.
These functions are loaded through eglGetProcAddress. We don't need
to export these extra symbols and increase our binary size.

Bug: chromium:1445969
Change-Id: I494bbcb86973f167e8245b56e6eb73da7eab69f5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4538367
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2023-05-18 02:26:18 +00:00
Cody Northrop
ec308b3555 Vulkan: Add feature to limit sample count to 2
This CL adds a feature called `limitSampleCountTo2`.  Using it will
have the Vulkan backend limit max samples to 2.

Why 2?  That's the minimum required in Vulkan to multisample without
error.  Here's an example validation error:

    vkCmdResolveImage: srcImage sample count is VK_SAMPLE_COUNT_1_BIT.
    The Vulkan spec states: srcImage must have a sample count equal to
    any valid sample count value other than VK_SAMPLE_COUNT_1_BIT.
    https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdResolveImage-srcImage-00257

Using a limit as opposed to forcing a value allows non-multisampling
(sample count of 1) to continue working.

To see how tests fare when the feature is set, see the following test
results that force the value on:
https://chromium-review.googlesource.com/c/angle/angle/+/4534098/4

Test: adb shell setprop debug.angle.feature_overrides_enabled limitSampleCountTo2
Bug: b/279498079
Bug: angleproject:8162
Change-Id: I1df2822709151e6084c32055b5aff444e0b10db5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518562
Commit-Queue: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Greg Schlomoff <gregschlom@google.com>
Reviewed-by: Charlie Lao <cclao@google.com>
2023-05-16 23:17:32 +00:00
Geoff Lang
b1395bcbac GL: Disable EXT_clip_control on Mali-G72 and G76.
Querying the clip control state from the driver when sychronizing
external contexts generates driver errors.

Simply disable this extension in this configuration for now.
Chrome is currently not using it for rasterization.

This issue was noticed on specific Huawei devices in the wild. It
hasn't been observed on other OEMs.

Bug: chromium:1434317
Change-Id: I88d9bff1933274f61020b75e68aee9c94b0b684a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518062
Reviewed-by: Peng Huang <penghuang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
2023-05-11 16:26:30 +00:00
Hailin Zhang
8b9440b630 Vulkan: add option to control pipeline cache data compression.
Bug: b/258207403
Change-Id: I487b1cadbacfa2f7ee889a8f58278307a126a391
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4497248
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Hailin Zhang <hailinzhang@google.com>
2023-05-11 02:26:49 +00:00
Scott Violet
b0f9c01ec3 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>
2023-05-09 21:20:43 +00:00
Alexey Knyazev
b7a5714f11 Add polygon mode extension stubs
* Added NV_polygon_mode

* Specified a portable polygon mode extension
  implementable on all ANGLE backends

Bug: angleproject:1791
Bug: angleproject:8132
Change-Id: I018aaaf1fb43ec16910859b152049e02169ede91
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4492684
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
2023-05-01 21:21:01 +00:00