Граф коммитов

847 Коммитов

Автор SHA1 Сообщение Дата
Geoff Lang f02a6e0c7f Work around Mac glGenerateMipmap with missing levels bug.
Some Mac GL drivers fail to generate mipmaps if level zero is not set
before the texture is first used, all mipmap data is black.

To work around this, whenever a texture level is allocated, ensure that
level zero is also allocated with at least a 1x1 image.

Bug: angleproject:5223
Change-Id: If1a728e017dec600c77a54f7ae185b719aaaae84
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2497569
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2020-10-28 21:18:54 +00:00
James Darpinian e70f6aa679 ANGLE_platform_angle_device_context_volatile_* extensions
Change from Kimmo Kinnunen downstream:
https://bugs.webkit.org/show_bug.cgi?id=216106

Add two extensions for EAGL and CGL backends to declare the
underlying platform context being "volatile". It means that
the thread-global current context is being modified behind
ANGLE. If ANGLE context is marked volatile for a particular
API, it will sync the underlying context for every EGL
function that needs the context. Most intuitive use is
for the client to call eglMakeCurrent before calling any
gl function if the client knowns the platform state might
be dirty.

Implement eglReleaseThread for EAGL and CGL backends.
Releasing thread will unset the platform current context.

Fix a bug of omitting EGL_ANGLE_device_eagl from being
advertised.

Bug: angleproject:5104
Change-Id: I1ec98ad35bc0caada23556ae8697fdef20f65b1a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2486548
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-10-28 00:05:33 +00:00
Shahbaz Youssefi b0db7cca32 Vulkan: Initial emulated prerotation support
This is currently only supported for end2end tests (those which use
ANGLETestBase, excluding those that use WithNoFixture) and Vulkan.  Use
WithEmulatedPreoration(*_VULKAN(), degree) where degree is either 90,
180 or 270.

With emulated prerotation, the window dimensions are physically swapped
if 90 and 270 degrees, while the width and height is still reported as
requested by the test.  In the Vulkan backend, the width and height are
swapped after getting queried from the surface, and prerotation is
assumed.

Bug: angleproject:4901
Change-Id: I294436be4c7015d2a63463c4d61de7b67f38c95d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2495544
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Ian Elliott <ianelliott@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-27 09:23:14 +00:00
Mohan Maiya 5d0458fa5c Vulkan: Add OES_shader_multisample_interpolation support
Support OES_shader_multisample_interpolation extension if
maxInterpolationOffset >= 0.5

Bug: angleproject:3589
Tests: dEQP-GLES31.functional.shaders.multisample_interpolation.*
       dEQP-GLES31.functional.state_query.multisample_interpolation.*
Change-Id: I42997f10be82e3be8b63c56833cbbf791bf4be9b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477905
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-10-26 17:54:10 +00:00
Geoff Lang 089ef0fa65 Expose glGetTexLevelParameter{if}v before ES 3.1.
Add a new extension, ANGLE_get_tex_level_parameter which allows
users to query texture size and format information before ES 3.1.
This is very useful for re-using existing textures instead of
re-allocating.

Bug: chromium:1132514
Change-Id: I71f6bad8bdacb91875cc81b4884d4c3099235f3f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2469959
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-21 17:23:46 +00:00
Mohan Maiya 553726a4c5 Vulkan: Add OES_shader_multisample_interpolation extension
Addition of 'sample' qualifier keyword and 'interplateAt*'
fragment shader builtin functions with autogen

Bug: angleproject:3589
Change-Id: If358eb371fbcefffa715c8da4ba5e96eefaf6f52
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477904
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-21 04:57:21 +00:00
Geoff Lang 32f0dd6aee Add Queries and Setters for resource initialization state.
There are cases where we know that the next draw operation will fully
initialize a texture/renderbuffer and we can save the robust resource
init cost.

Default all resource init state to Initialized, any redefinition will
set it back to MayNeedInit.

After setting an individual texture image to initialized, check if
all images are now initialized and update the TextureState::mInitState
to match. The cost of this check is only performed after initializing
an image and allows future init checks to be faster.

Bug: chromium:1132514
Change-Id: Ia23664ae162559d1614f1eb5643e24a491d87f7f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2475456
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-10-20 20:11:55 +00:00
Courtney Goeltzenleuchter ed876984a9 Vulkan: functionally complete worker thread
Working on enhancing worker thread to completely own primary command
buffers. This will include not only processing SCBs from main thread
into a primary, but also submitting those command buffers to the queue.

The CommandProcessor is a vk::Context so it can handle errors in the
worker thread. When the main thread submits tasks to the worker
thread it also syncs any outstanding errors from the worker.

Include asynchronousCommandProcessing feature that will control
whether the worker thread task does it's work in parallel or not. If
false, we wait for the thread to complete it's work before letting the
main thread continue.  If true, the thread can execute in parallel with
the main thread.

Bug: b/154030730
Bug: b/161912801
Change-Id: I00f8f013d6cbb2af12a172c4f7927855db2f0ebf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2328992
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-20 19:03:15 +00:00
Jamie Madill e5590288b8 Rename "texelFetchInvoked" to "texelFetchStaticUse".
Technically more precise because something could be statically used
and never invoked. Also more consistent with the spec.

Bug: angleproject:5176
Change-Id: I70dd0787d67d9f046b7359abb24107cb430f5cae
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2483465
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
2020-10-19 18:56:20 +00:00
Geoff Lang 6d3d381e72 GL: Update BufferGL to use ANGLE_GL_TRY.
Refactor the check for keeping shadow data into a feature so it's only
initialized once.

Bug: angleproject:3020
Change-Id: I45575c246afa7cd54e3a07d7a8464f4d4f45b3be
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769064
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-19 16:10:25 +00:00
Mohan Maiya 7bbe497aa8 Vulkan: Implement EXT_texture_sRGB_decode
Implement EXT_texture_sRGB_decode. This builds on the existing
functionality from EXT_texture_sRGB_override, with 2 major edge
cases:
1. sRGB_decode allows the texture state to be overridden by
sampler state, which is implemented by forcing a a texture state
sync during updateActiveTextures if a texture is bound to the same
unit as a sampler with that state
2. texelFetch calls require us to reenable decoding, regardless
of decode state. We add a new compiler pass
(FlagSamplersWithTexelFetch) to mark samplers that are used with
texelFetch in order to support this.
This change also re-enables EXT_texture_sRGB_R8, which was disabled
due to a dEQP bug that this change will bypass.

Bug: angleproject:3609
Bug: angleproject:4503
Test: dEQP.GLES31/functional_srgb_texture_decode_skip_decode_*
Test: GLES31/functional_state_query_texture_*_srgb_decode_*
Test: GLES31/functional_state_query_sampler_*_srgb_decode_*
Test: GLES31/functional_debug_negative_coverage_*_srgb_decode_*
Test: GLES31/functional_android_extension_pack_extensions_ext_texture_srgb_decode
Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan*
Change-Id: I4a67e487dc82e2f57c8c87d4bcd8ef442b6fe220
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359481
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-10-18 22:29:30 +00:00
Jonah Ryan-Davis 96a49a488a GLX, EGL: Support NV_robustness_video_memory_purge
Chrome is showing rendering issues on Linux/Nvidia after returning from
the lock screen. This could be related to the fact that Nvidia drivers
are not able to guarantee conformance after certain events.
By exposing this extension, we can instruct Chrome to reinitialize
contexts after they are purged by the driver. If this is not explicitly
requested, we can still generate an UnknownContextReset to tell apps
to discard the invalid context anyway.

Bug: chromium:1113040
Change-Id: Ie99b6356cc27fea33643d61b1d74f4f68a271d70
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2453689
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-10-15 22:33:07 +00:00
Brandon Schade b22e437aff Add GL_EXT_copy_image extension entry points
Bug: angleproject:3593
Change-Id: I6d3a55a3112f5f9b20ef33c859a60b2952bfbc2f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444209
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-10-14 21:37:05 +00:00
Hyunchang Kim d9a88d63d5 Vulkan: Support OES_texture_cube_map_array extension
Add support for GL_OES_texture_cube_map_array to the Vulkan backend
if the underlying ICD supports creation of of cube array ImageViews

Bug: angleproject:3584
Test: dEQP-GLES31.functional.fbo.color.texcubearray.*
Change-Id: I636cbf347d718abfc1600119b312578370b8e02e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437989
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-14 16:20:43 +00:00
Jonah Ryan-Davis 1da7ac0ff4 GLX: Workaround to disable GLX_OML_sync_control support.
Some users on Linux/Wayland are reporting issues rendering Chrome
unusable when ANGLE exposes GLX_OML_sync_control. This CL adds a new
feature to ANGLE to disable this extension, but for now we leave the
feature off by default, so users can test it via command line flags.

Bug: chromium:1137851
Change-Id: I804ea935fe441c4794b93ee62ca335e78b9e453a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2468216
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-10-14 15:06:02 +00:00
Charlie Lao df6b7298bb Vulkan: Use StoreOp_None_QCOM for read only depth stencil buffer
For read only depth stencil buffers, there is no need to store depth or
stencil value. But we can not use DontCare for storeOp because vulkan
core spec says DontCare indicates data is undefined after this.
VK_QCOM_render_pass_store_ops extension introduces a new store op that
will leave data defined but skip the store. This CL utilize this if the
extension is available.

Bug: angleproject:5055
Change-Id: I104f3d01eb342a2d0cc900f342430e901bde1bff
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462604
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-13 03:25:18 +00:00
Geoff Lang cd8eb56468 GL: Work around Mac glBindBufferRange issue.
Mac GL drivers generat errors when binding transform feedback buffers
with glBindBufferBase/glBindBufferRange when the buffer has not been
bound to any binding point before. Work around this by simply binding
the buffer first.

Bug: angleproject:5140
Change-Id: I1895f8367412135c100a5072117c929be8a8e90b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2461826
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-08 23:48:00 +00:00
Le Hoang Quyen 6dfd855a10 Metal: Implement fence sync
Bug: angleproject:2634
Change-Id: If1f7bb12c0e661c8e4b5677798a92440995819e4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2433325
Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-10-08 11:56:49 +00:00
Trevor David Black e815afbf88 First pass at increasing inclusivity
Link to the inclusivity rules
https://source.android.com/setup/contribute/respectful-code

Bug: b/162834212
Bug: chromium:1097198
Change-Id: Ied5a9e3879d72bff3f77ea6fcda9b82f30c32c2f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396737
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Trevor Black <vantablack@google.com>
2020-10-02 19:49:38 +00:00
Mohan Maiya a2d9abef04 Vulkan: Add OES_sample_shading extension entry points
Addition of just the entry points for OES_sample_shading extension.

Bug: angleproject:3587
Change-Id: I7ef5ceb846d130c2d1e0b4ea7dcbe92452b5d7d3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444212
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-10-02 17:08:28 +00:00
Le Hoang Quyen 6136cbcbd6 Metal: Implement transform feedback
- XFB is currently emulated by writing to storage buffers.

- Metal doesn't allow vertex shader to both write to storage buffers and
  to stage output (i.e clip position). So if GL_RASTERIZER_DISCARD is
  NOT enabled, the draw with XFB enabled will have 2 passes:
  + First pass: vertex shader writes to XFB buffers + not write to stage
    output + disable rasterizer.
  + Second pass: vertex shader writes to stage output (i.e.
    [[position]]) + enable rasterizer. If GL_RASTERIZER_DISCARD is
    enabled, the second pass is omitted.
  + This effectively executes the same vertex shader twice. TODO:
    possible improvement is writing vertex outputs to buffer in first
    pass then re-use that buffer as input for second pass which has a
    passthrough vertex shader.

- If GL_RASTERIZER_DISCARD is enabled, and XFB is enabled:
  + Only first pass above will be executed, and the render pass will use
    an empty 1x1 texture attachment since rasterization is not needed.

- If GL_RASTERIZER_DISCARD is enabled, but XFB is NOT enabled:
  + we still enable Metal rasterizer.
  + but vertex shader must emulate the discard by writing gl_Position =
    (-3, -3, -3, 1). This effectively moves the vertex out of clip
    space's visible area.
  + This is because GLSL still allows vertex shader to write to stage
    output when rasterizer is disabled. However, Metal doesn't allow
    that. In Metal, if rasterizer is disabled, then vertex shader must
    not write to stage output.

- See src/libANGLE/renderer/metal/doc/TransformFeedback.md for more
  details.

Bug: angleproject:2634
Change-Id: I6c700e031052560326b7f660ee7597202d38e6aa
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2408594
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-10-01 18:04:08 +00:00
Shahbaz Youssefi a3b16c6b50 Vulkan: Workaround vkCmdClearAttachment bug on Pixel
Adds a workaround to use draw calls to clear color instead of
vkCmdClearAttachment when the clear happens in the middle of render
pass.  On Pixel phones, vkCmdClearAttachment races with the previous
draw calls in the render pass.

Bug: b/166809097
Change-Id: I8c96b87793da191757635658ad4ee2c3a7875aca
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2382416
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-09-25 23:49:02 +00:00
Jamie Madill 7a0faa8292 Revert "Pass #pragma optimize setting down to compilation."
This reverts commit 499173de1c.

Reason for revert: Causes unexpected HLSL compiler errors in some
cases. See bug.

Bug: angleproject:5094

Original change's description:
> Pass #pragma optimize setting down to compilation.
>
> This will allow us to disable optimizations in the back-end. This can
> be useful both for developers and for ANGLE to disable very slow
> shader compilation on D3D11.
>
> Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers.
> Reduces compilation time by half in local testing.
>
> Bug: angleproject:5076
> Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

TBR=geofflang@chromium.org,jonahr@google.com,jmadill@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: angleproject:5076
Change-Id: I733e788fe8e9421ae0af662c0eb51af1ed79dde3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2429517
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2020-09-24 22:14:21 +00:00
Shahbaz Youssefi a76b68362a Vulkan: Support MSRTT depth/stencil resolve
VK_KHR_depth_stencil_resolve is used by this change to resolve
depth/stencil multisampled-render-to-texture renderbuffers.

This extension is not widely supported yet.  If it's not present, the
depth/stencil resolve operation is silently ignored and the renderbuffer
acts as a normal multisampled one.  This is not correct, but our primary
user (Chrome), and most applications don't care for the resolved
depth/stencil data.  In fact, it's recommended for the depth/stencil
attachment to be invalidated after rendering.

Exposing EXT_multisampled_render_to_texture even in the absence of
depth/stencil resolve allows the majority of the applications to still
take advantage of MSRTT color attachments.

Bug: angleproject:4836
Change-Id: I6ba4187344a0c9330d2c77bdc5e2c6fc5483c299
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2417645
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-09-24 15:34:24 +00:00
Geoff Lang f0b020544c Add a Vulkan feature to compress float32 vertex formats.
Use the vertex conversion pipeline in VertexArrayVk to detect
static vertex data and convert float32 vertices to float16. This
feature is useful for determining if an allication is vertex
bandwidth bound and seeing what gains could be had by using smaller
attributes.

This feature could be implemented in ANGLE's frontend but new
infrastructure for converting and storing the converted attributes
would need to be added to gl::VertexArray. Our backends already
have the functionality needed to handle unsupported attribute formats
and this can be repurposed for compressing vertex formats.

Bug: b/167404532
Bug: b/161716126
Change-Id: I9a09656a72e8499faa4124adf876d7261c8341c9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2342285
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-09-24 14:55:24 +00:00
Geoff Lang 49f01a53b0 Vulkan: Add features to modify sampling parameters
Add features to optionally increase the LoD offset of all sampling
operations or disable linear filtering. These can be used to compare
performance without recompiling ANGLE.

These features could be potentially implemented in the frontend it is
more difficult because the features are not available at texture
initialization time.

Bug: b/167404532
Change-Id: Ifcf56fbcf130c24c54834737733bbffa5ade3959
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2411475
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-09-22 16:30:45 +00:00
Jamie Madill 499173de1c Pass #pragma optimize setting down to compilation.
This will allow us to disable optimizations in the back-end. This can
be useful both for developers and for ANGLE to disable very slow
shader compilation on D3D11.

Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers.
Reduces compilation time by half in local testing.

Bug: angleproject:5076
Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-09-22 15:31:04 +00:00
Mohan Maiya 48588bd181 Vulkan: Add GL_EXT_buffer_storage extension entry points
Addition of just the entry points for GL_EXT_buffer_storage extension.

Bug: angleproject:5056
Change-Id: I7a3d7c151f004f89fd945d5d06dbe7afcd491578
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2419951
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-09-21 00:03:30 +00:00
Shahbaz Youssefi 68c424fe42 Vulkan: Workaround oldSwapchin bug on Android
When vkCreateSwapchainKHR is called with a valid oldSwapchain, the
Android framework destroys the images in oldSwapchain.  This is not
correct, as it should be deferred to the actual vkDestroySwapchainKHR
call performed later by ANGLE.  This is because rendering to the
oldSwapchain could still be in progress.

While this issue affects all of Android, currently only ARM shows any
symptoms.  A workaround is added for ARM to vkDeviceWaitIdle before
recreating the swapchain if oldSwapchain is valid.

Bug: angleproject:5061
Change-Id: I308e4798c6418d7891d880218b0ebcfd7a795643
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2416238
Reviewed-by: Sunny Sun <sunny.sun@arm.com>
Reviewed-by: Ian Elliott <ianelliott@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-09-18 04:55:04 +00:00
Jamie Madill 5b0b183063 Add feature for disabling compressed formats.
Can be useful when doing captures to make the replay more portable.

Bug: angleproject:5040
Change-Id: I3a045c636bc2638d601aff2536eed3d0e49c3643
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2408714
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2020-09-15 23:41:46 +00:00
Charlie Lao c03c4490a1 Vulkan: Defer glFlush issued in middle of renderpass to endRenderpass
Manhattan is calling glFlush in middle of a renderpass. This CL defers
the flush that issued in the middle of renderpass to the end of
renderpass.

Bug: b/166475273
Change-Id: I6baa3898d5efc456e2205c44e13c64f3d79d1464
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2381942
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-09-14 23:57:38 +00:00
Jonah Ryan-Davis 1ab73f0f8c Cleanup disable_program_binary workaround
This workaround should also clear the shader binary formats. Also,
we can use this workaround when disabling program binaries for
capture/replay.

Bug: angleproject:5007
Change-Id: I57c78e2cc95e7148cb8a1e7fb9bf3ed958fa69c8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404383
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-09-10 20:51:01 +00:00
Jonah Ryan-Davis 9a7b0a2dc5 Workaround bogus MscRate reported by some XWayland drivers.
XWayland defaults to a 1hz refresh rate when the surface is not
visible, but this can sometimes cause issues in Chrome. If we see
a bogus rate like that, ANGLE can just report 30hz.

Bug: chromium:1042393
Change-Id: I554b05b4107cea528525ced6e95a5ce529eec3b1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2388700
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-09-09 21:04:48 +00:00
Geoff Lang a568b7e38f Add a frontend feature to disable anisotropic filtering.
This allows us to disable support for GL_EXT_texture_filter_anisotropic
at runtime and make performance comparisons.

Bug: b/167404532
Change-Id: Id80458e7f116e195366432fe73e8e776e9a3047b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278024
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-09-02 21:09:40 +00:00
Jonah Ryan-Davis 6b2639b023 Workaround to disable OES_get_program_binary
This is a useful workaround for testing/diagnostics.
Disabled by default.

Bug: angleproject:5007
Change-Id: If459f60ae7f8a2cd4ea934fe3e54d890387d57db
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2385933
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-09-02 16:32:15 +00:00
Geoff Lang 7e815c77a4 Implement EXT_shadow_samplers
Bug: angleproject:4863,b/161716126
Change-Id: I6beb45d91f59a851787c9f40b40266fb985198d5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2288330
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: back sept 10 - Jamie Madill <jmadill@chromium.org>
2020-09-01 19:30:14 +00:00
David Reveman 9a19a996ec Vulkan: Use 4 MB as preferredLargeHeapBlockSize for allocator.
This reduces preferredLargeHeapBlockSize from the default
value of 256 MB to 4 MB, which reduces the initial block
size from 32 MB to 512 KB.

4 MB is the same size as used by Chromium and Skia. It seems
to be a good compromise of not wasting unused allocated space
and not making too many small allocations.

This change is limited to non-Qualcomm GPUs as a number of
tests are failing on Qualcomm after this change and the
initial investigation indicates a potential driver bug. See
http://anglebug.com/4995 for more details.

Bug: chromium:1122718
Bug: fuchsia:58959
Change-Id: Ifdaf863ef38e72098a04ee57dec46ee71cab6ac3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2376891
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: David Reveman <reveman@chromium.org>
2020-08-28 16:29:05 +00:00
Le Hoang Quyen a4f706b2ca Metal: Use compute to generate 3D texture's mipmap.
- Metal's built-in blit based mipmap generator doesn't use box
  filtering. Hence manual generation using compute is needed.

- Compute based mipmap gen can generate up to 4 mips per pass if the
  base level is power of 2.

- This approach can be extended to 2D/cube texture's mipmap generation
  in future.

Bug: angleproject:4921
Bug: angleproject:2634
Change-Id: I7f997669fe39afef075b2bca2406e9424cbb3016
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336120
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
2020-08-26 01:58:32 +00:00
Shahbaz Youssefi c76458860d Vulkan: Remove the flipViewportY feature
This was featurized as a workaround for Intel/Windows drivers that did
not render flipped in comparison to GL per Vulkan spec.  This issue has
long since been fixed, and due to missing parentheses the feature was
accidentally unconditionally true for a long time already.

Bug: angleproject:4896
Change-Id: I1db55d298bd47df649ff1f03d287d0cfa7453ea7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372632
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-08-25 15:08:43 +00:00
Le Hoang Quyen 4f247baf66 Metal: Implement EXT_draw_buffers & ANGLE_framebuffer_blit
Bug: angleproject:2634
Change-Id: I769ca7e113e660870e9b31dafb706c313db8ac24
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332146
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2020-08-23 19:21:10 +00:00
Jamie Madill 682f9141d1 Remove feedback loop support from back-end.
Front-end detection still in place and will be removed in a follow-up.
Removes the Vulkan feature and the special clear handling.

Bug: angleproject:4959
Change-Id: I5d44c3f7dbdb49d8aa0375f54b7148df09732ba2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2363208
Reviewed-by: Tobin Ehlis <tobine@google.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2020-08-21 17:02:47 +00:00
Le Hoang Quyen f37f1dcb16 Metal: Init format table using Metal-Feature-Set-Tables.pdf
- Format table is now initialized using informations from
  https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf.
  Previously, it was setup using gl::GenerateMinimumTextureCaps().

- This CL also adds InitializeTextureDataFunction and LoadFunctionMap to
  mtl::Format. They are needed to properly initialize/convert textures
  with non-normalized formats.

- This CL is prerequisite for integer & floating point format supports.

- New test: DXT1CompressedTextureTest.DXT1Alpha (this test was added
  in the past but was reverted for some reasons).

Bug: angleproject:2634
Change-Id: I5eaad812909a49c4c138d0f65fd21a6a199fcb22
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332144
Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-08-11 05:55:26 +00:00
Shahbaz Youssefi 1dcb3eb267 Vulkan: Don't expose MSRTT on Mac/SwiftShader
Frequently causes failures as such:

    [...:ERROR:drawing_buffer.cc(854)] Initialization failed to allocate backbuffer.
    [...:INFO:CONSOLE(197)] "Unable to initialize webgl context.", source:  (197)

Bug: chromium:1112986
Bug: angleproject:4937
Change-Id: I5058f78434c0ac49345fe1167043f2dca759b1b9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2341350
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-08-07 19:27:56 +00:00
Shahbaz Youssefi e4e2a847da Entry points for ANGLE_external_objects_flags
Bug: angleproject:4912
Bug: fuchsia:52759
Change-Id: If339f096a74cc87d16a6494562711d718a7738ea
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2335019
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-08-05 09:20:36 +00:00
Jonah Ryan-Davis 4f7f438729 Add entry points for OES/EXT_texture_buffer
This extension is core in 3.2

Bug: angleproject:3573
Change-Id: If08736759da2fdc680cfa396d354dbfa97d1a60f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2317040
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-08-03 18:08:23 +00:00
Shahbaz Youssefi 41442cce3d Autogenerated changes for GL_EXT_multisampled_render_to_texture2
Bug: angleproject:4836
Change-Id: I86143c6b21ecdbc666ce316b6e4a4b402257f01c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332957
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2020-08-01 13:48:53 +00:00
Le Hoang Quyen cbd5bee81d Disable shader's pre-rotation code on Metal & non-Android.
Pre-rotation code were added to transform gl_Position, gl_FragCoords,
gl_PointCoords, dFdX, dFdY in shader. However, it is only useful for
android's surface pre-rotation and completely un-needed in Metal
back-end.

This CL disables these pre-rotation code if the platform is not
android.

Bug: angleproject:4678
Change-Id: I89c42fcf24b49896f4ed9c2f9465da521beaf25f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2295000
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Ian Elliott <ianelliott@google.com>
2020-07-31 04:16:55 +00:00
Peng Huang 4cf2501c67 Add extension EGL_ANGLE_display_semaphore_share_group
For sharing semaphores globally.

Bug: angleproject:4877
Change-Id: I472e0902fd04ca8350d74e6c0ae6925ee930ccf9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2319370
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-07-29 22:33:31 +00:00
Charlie Lao cf49403e47 Vulkan: Increase default uniform buffer size to 64K
Since these are per context, we can increase it (and subject to the
driver maxUniformBufferRange limit) to reduce the amount of descriptor
set allocated.

Bug: b/161391337
Change-Id: I89e5cf16ee377735c412e9a9a22c651e1c677ded
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2310910
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
2020-07-27 20:45:18 +00:00
Shahbaz Youssefi 8adc54693b Vulkan: Generate mipmap in compute
An initial implementation based on AMD's FFX SPD (Single Pass
Downsampler).

Apart from requiring STORAGE_IMAGE support for the image format, the
following limitations are in place due to FFX SPD:

- Image must be 2D or 2D array (including cube maps)
- Image must be single-sampled

The following _can_ be supported, but not yet implemented:

- sRGB formats
- Integer formats
- depth/stencil formats

Bug: angleproject:4551
Change-Id: Ibc4d5cea701cca31e55e3d651540872bbd3b473f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278713
Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-07-26 19:38:41 +00:00
Kenneth Russell 08c4d09493 Improve WebGL 2.0 readPixels support.
Emulate GL_PACK_SKIP_PIXELS and GL_PACK_SKIP_ROWS on macOS, where it
appears the OpenGL driver ignores these parameters.

Add WebGL 2.0-specific validation constraints for pixel pack and
unpack parameters.

Bug: angleproject:4849
Change-Id: Iab566299223e05484a009817acb1ed2816023823
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2303905
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-07-18 00:16:03 +00:00
Le Hoang Quyen 9277ee7413 Metal: Implement MSAA default framebuffer.
GL_SAMPLE_COVERAGE_VALUE is implemented by inserting gl_SampleMask
writing logic to fragment shader.

New test added: MultisampleTest.ContentPresevedAfterInterruption.
- Skip on D3D11 (Bug: angleproject:4609)

Bug: angleproject:2634
Change-Id: Ib44daf0baccc36ea320596d81713156047da059c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2281783
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-07-15 16:27:43 +00:00
Courtney Goeltzenleuchter f61272fbf3 Add support for VK_KHR_sampler_ycbcr_conversion
This adds ability for applications to import Android Hardware Buffers
(AHBs) as OpenGL images which in turn can be sampled from and/or
written.

This was specifically tested with the common use case of importing a
buffer created by an media decoder and using that as a texture source to
include that video content on the screen. Tested with:
- Angry Birds 2 video player (for ads) requires YUV conversion.
- Basic Media Decoder example:
    https://github.com/android/media-samples/tree/master/BasicMediaDecoder

Bug: b/155487768
Change-Id: I9255450f81aa4daa2aace7205d4f6c3f225abcca
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2175103
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-07-09 19:05:52 +00:00
Mohan Maiya 62ff54ebb3 Vulkan: Featurize shadow buffers
Shadow buffers help reduce the latency of glMap* operations
at the cost of CPU overhead. It might not be desirable to
incur such an overhead for all usecases. Featurize it but
enable it by default.

Bug: angleproject:4339
Change-Id: I6374618bf99677eef55fd50a139fb86f5ea70791
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278102
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
2020-07-02 17:47:30 +00:00
Jonah Ryan-Davis c70b8f8485 GL: Workaround NVIDIA issue in glLinkProgram
When TSAN is enabled, it catches some bad memory access in the NVIDIA
driver on Linux during glLinkProgram with multithreaded linking.
To workaround this, assume we don't have native support for
KHR_parallel_shader_compile

Bug: chromium:1094869
Change-Id: I92f042b39028df108de2c5378311cc0c7b683e08
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2250938
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-06-19 14:13:06 +00:00
Etienne Bergeron 9e83c15193 Active the delegate worker pool for chromium (3/3)
This CL is activating the delegate WorkerPool in Chromium.

Must land after:
  https://chromium-review.googlesource.com/c/angle/angle/+/2231708

Related CLs:
1) https://chromium-review.googlesource.com/c/angle/angle/+/2231708
2) https://chromium-review.googlesource.com/c/chromium/src/+/2231864
3) [this CL]

Bug: chromium:1091259
Change-Id: I62c7175fec2846fee014702d8561eeaf48ca93de
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2231710
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-06-17 18:22:21 +00:00
Kenneth Russell af72779224 Improve EGL_ANGLE_power_preference on dual-GPU MacBook Pros.
Add the ability to release and reacquire the high-power GPU, and to
respond to changes in the active GPU. In Chromium, the GPU process can
not access the WindowServer. An external process must inform ANGLE
that the active GPU has changed, and that ANGLE should switch its
internal context to the new GPU.

Incorporates a couple of functions from WebKit, used with permission,
to effect this GPU switch.

A follow-on change in Chromium which uses these new APIs will make the
existing dual-GPU tests pass with ANGLE and the passthrough command
decoder.

Carry forward Chromium's workaround of disabling GPU switching on
older MacBook Pros to ensure stability.

Document the process of adding new EGL extensions to ANGLE.

Bug: chromium:1091824
Change-Id: I499739156e851b493555d4d6e4aef87d8b97fa31
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2240638
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-06-12 23:38:22 +00:00
Etienne Bergeron 707868aefa Implement a WorkerPool delegate to execute background task (1/3)
This CL is adding a WorkerPool delegate to allow an embedder
to post task on a custom thread pool. The target for this code
is Chromium.

The plan is to post tasks into the Chromium ThreadPool.

Related CLs:
1) [this]
2) https://chromium-review.googlesource.com/c/chromium/src/+/2231864
3) https://chromium-review.googlesource.com/c/angle/angle/+/2231710

Bug: chromium:1091259
Change-Id: Ib990b06d4672b6f859d04b97ac4311a7a80ef7a9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2231708
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-06-11 19:42:09 +00:00
James Darpinian 336e8915e8 Workaround broken copyTexImage2D on iOS
Use BlitGL to reimplement copyTex[Sub]Image2D on iOS.

Bug: angleproject:4674
Change-Id: Ie3018d6d33da57797162922410f76557124df4b6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2222718
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-06-08 18:41:56 +00:00
Geoff Lang 6080383848 GL: Work around drivers that generate mipmaps in linear color space
Mac drivers generate mipmaps in linear color space. To work around
this, copy the sRGB texture to a linear texture, generate mipmaps
and then copy back.

TEST=conformance2/textures/misc/tex-srgb-mipmap.html

BUG=angleproject:4646

Change-Id: I8675d0ab004bcd2985f685d64cbb84deff5f1c86
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2211083
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2020-06-05 20:55:38 +00:00
Jamie Madill 0df92012a1 Rename Platform.h to PlatformMethods.h.
"platform.h" is too common a name and causes headers to be
included incorrectly. Disambiguate the header using a more
specific name.

Solves a problem that came up with the GLES 1 tests and the
standalone test harness.

Bug: angleproject:3162
Change-Id: I88229a2c9407e0db57f5beee44daa11a4075f700
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2229065
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2020-06-04 15:44:40 +00:00
Maksim Sisov 8ba5cf99b0 Add EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE
This CL adds a new attribute that helps to identify
lower platform angle should use. We identified
several different use cases that ANGLE must
comply with when choose a display implementation.
Please refer to the
Support Matrix for EGL_ANGLE_platform_angle table

Bug: chromium:1084458
Change-Id: I6ea3d5081012ddf450f1c641343d1ba1a673483b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2210151
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
2020-06-04 02:20:23 +00:00
Philip Lamoureux 9515707bae Move ShaderVariable utility function from utilities.cpp ShaderVars.cpp.
Fixes an implied dependency cycle between translator and angle_common. This will also allow us to be more strict about declaring dependencies on GLSLANG headers.

Tested by building and running angle_unit_tests on Linux.

Bug: angleproject:4672
Change-Id: I331230d2cf179ccea140ee7a0d5a3c8768c58cb1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2222682
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2020-06-01 17:56:23 +00:00
Ethan Lee 209cf8fa40 GGP: Check and enable VK_GGP_frame_token
Bug: angleproject:4668
Change-Id: I9ecbdf37e206cb6eb93699091bbff70ad898040f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219032
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-05-28 19:18:43 +00:00
Jonah Ryan-Davis 2383f3449e Port disable_timestamp_queries GPU workaround to ANGLE
There is a driver bug in VMWare drivers related to timer queries.
This driver is already disabled in Chrome, this CL ports the
workaround to ANGLE.

Bug: chromium:1075876
Bug: chromium:811661
Change-Id: I87ab28b803191884658d0c1ad4bfdfdd1b727fd0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219420
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-05-28 18:31:13 +00:00
Tobin Ehlis 02fa731345 Vulkan:Initial worker thread disabled by default
Created new CommandProcessor class that can be run as a worker thread.
Running CommandProcessor within RendererVk as a worker thread that
takes a CommmandBufferHelper (CBH) ptr as the interface and processes
that CBH into a primary command buffer.

Main thread has a queue of CBH to draw from. After submitting a CBH to
the worker, it pulls next CBH from the queue. Worker thread releases CBH
back to the main thread queue when done.

Synchronization goes two ways:
1. Work submitted to worker thread is managaed with a mutex and
condition variable based around the work queue.
2. Available CBH ptrs for the main thread have a mutex and condition
variable that manages the CBH queue.

The worker thread is disabled by default, and, when enabled, it will
currently behave and perform as the non-threaded code. This is because
the kNumCommandBuffers const in ContextVk.h is set to 2. With only 2
command buffers, they will be assigned to the inside and outside
RenderPass command buffers respectively. Then, as soon as one is
submitted, the main thread will stall waiting for it to be completed
and put back into the queue mentioned in #2 above.

The next step is to move command submission to the worker thread and
update the number of command buffers so that processing/submission
will occur in parallel with the main thread. Right now there is a
race condition issue when attempting to run in parallel because the
main thread updates and submits the same primary command buffers
that are used in the worker thread, which is in violation of the
Vulkan spec.

The follow-on CL will fix this issue as the main thread will only
touch SecondaryCommandBuffers and the worker thread will be the
only thread touching the primary command buffers.

Bug: b/154030730
Change-Id: Ib0c518bbd7ca9a3a7e789f4e1f2f7131ddc0509e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174719
Commit-Queue: Tobin Ehlis <tobine@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-05-27 19:54:24 +00:00
Jonah Ryan-Davis eadc387c3e GL: Support GL_OES_texture_cube_map_array in shader translator
GL_OES_texture_cube_map_array is core in 3.2. This CL adds support
for this extension in the shader translator.
Now passes dEQP.KHR_GLES31/core_texture_cube_map_array.*,
dEQP.GLES31/functional_fbo_color_texcubearray_*, and
dEQP.GLES31/functional_opaque_type_indexing*samplercubearray* with GL backend.

Bug: angleproject:3584
Change-Id: I1a8485c7d9d3fffb9b5109d292b35b0c56a3c665
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2133086
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2020-05-27 17:07:26 +00:00
Charlie Lao 258d94f61e Vulkan: Add workaround for nvidia to always merge barriers into one
vkCmdPipelineBarrier call

Nvidia preferes one barrier call than multiple calls with fine grained
stage dependency information. They do not care much about stage
dependency. This adds a feature flag that sets to true on nvidia and
will merge all barriers into one call.

Bug: angleproject:4633
Change-Id: I204484aa4c5989655f74d70a0eaa235c3c83f548
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2207635
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
2020-05-20 00:20:50 +00:00
Antonio Maiorano 4f343f3e4a Reland "Add support for GL_CHROMIUM_texture_filtering"
This is a reland of 38780ae392 modulo the
changes to disable VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT, as
this was causing problems. With this landed, the extension will not work
on SwiftShader until we find a way to allow this extension through the
validation layers.

Bug: b/146423360
Bug: b/154620295
Change-Id: Ie09fc507c01a47be3bb227bc78771660170ba5d3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2199639
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-05-19 17:04:42 +00:00
Sunny Sachanandani 4b225c70c1 Add texture offset attributess for D3D texture pbuffer surfaces
Add EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE attributes
to EGL_ANGLE_d3d_texture_client_buffer which are used to specify offsets
used for rendering into the pbuffer surface backed by a D3D11 texture.
Rendering with the correct offset is needed when Chrome gets a texture
and offset from an external source e.g. when calling BeginDraw() on
IDCompositionSurface.

Bug: angleproject:2997
Change-Id: I363f739f3f05c38720f385e34c91e98fc6a622a0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2186176
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
2020-05-14 19:24:55 +00:00
Tim Van Patten 3b82fdcf1c Revert "Add support for GL_CHROMIUM_texture_filtering"
This reverts commit 38780ae392.

Reason for revert:
Breaks SWANGLE-VK:

05-12 23:42:28.612 22836 22861 D libEGL  : dlopen_ext from APK (libEGL_angle.so) success at 0x79f4485a10
05-12 23:42:28.617 22836 22861 D libEGL  : dlopen_ext from APK (libGLESv1_CM_angle.so) success at 0x79f4485eb0
05-12 23:42:28.619 22836 22861 D libEGL  : dlopen_ext from APK (libGLESv2_angle.so) success at 0x79f4485c60
05-12 23:42:28.624 14223 14223 D StatusBar: disable<e i a s b h r c s > disable2<q i n >
05-12 23:42:28.633 14014 14057 V DisplayPowerController: Brightness [0.19986142] reason changing to: 'automatic', previous reason: 'automatic [ dim ]'.
05-12 23:42:28.635 22836 22861 D vulkan  : searching for layers in '/data/app/~~0AfWfBsFEO78tqKlnanevg==/org.khronos.gl_cts-NOs3SGclHqlbcqe-08gHrw==/lib/arm64'
05-12 23:42:28.635 22836 22861 D vulkan  : searching for layers in '/data/app/~~0AfWfBsFEO78tqKlnanevg==/org.khronos.gl_cts-NOs3SGclHqlbcqe-08gHrw==/base.apk!/lib/arm64-v8a'
05-12 23:42:28.632 22836 22836 W .khronos.gl_cts: type=1400 audit(0.0:218): avc: denied { ptrace } for scontext=u:r:zygote:s0 tcontext=u:r:untrusted_app_25:s0:c512,c768 tclass=process permissive=0 b/77925912 app=org.khronos.gl_cts
05-12 23:42:28.636 14014 14034 I EventSequenceValidator: Transition from ACTIVITY_LAUNCHED to ACTIVITY_FINISHED
05-12 23:42:28.637 22836 22861 F SwiftShader: external/swiftshader/src/Vulkan/libVulkan.cpp:425 vkCreateInstance TRACE_ASSERT: pCreateInfo->pNext sType = 1000247000
--------- beginning of crash
05-12 23:42:28.637 22836 22861 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 22861 (.khronos.gl_cts), pid 22836 (.khronos.gl_cts)


Original change's description:
> Add support for GL_CHROMIUM_texture_filtering
> 
> Chromium enables a custom extension, GL_CHROMIUM_texture_filtering, when
> using SwiftShaderGL, to enable high precision filtering. This change
> makes it so ANGLE also handles this same extension when using the
> SwiftShaderVK backend, by enabling the new
> VK_GOOGLE_sampler_filtering_precision custom extension.
> 
> Bug: b/146423360
> Bug: b/154620295
> Change-Id: I69cafc1ccf5970a3d220ac7e13ec3c8fdd4a9643
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2185822
> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>

TBR=geofflang@chromium.org,jmadill@chromium.org,amaiorano@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: b/146423360, b/154620295
Change-Id: I803d7a7baac81cf178b59c4bf2789346ec1d3f87
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197168
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Tim Van Patten <timvp@google.com>
2020-05-13 01:41:39 +00:00
Antonio Maiorano 38780ae392 Add support for GL_CHROMIUM_texture_filtering
Chromium enables a custom extension, GL_CHROMIUM_texture_filtering, when
using SwiftShaderGL, to enable high precision filtering. This change
makes it so ANGLE also handles this same extension when using the
SwiftShaderVK backend, by enabling the new
VK_GOOGLE_sampler_filtering_precision custom extension.

Bug: b/146423360
Bug: b/154620295
Change-Id: I69cafc1ccf5970a3d220ac7e13ec3c8fdd4a9643
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2185822
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-05-11 16:31:14 +00:00
Patrick To a2ec926cfc Specify LUID in D3D11
Add an extension to provide the ability to specify the LUID of the
GPU adapter to use when using D3D11.

Corresponding chromium CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2096778

Bug: chromium:792657
Change-Id: Iefebea221a4b7a20f150b445ae1adf375444726d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2096663
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
2020-05-06 22:21:27 +00:00
Alexey Knyazev 6193fd692f OpenGL: Implement OES_draw_buffers_indexed
OpenGL state sync issues as few GL commands as possible to update the
blend state regardless of an application input.

Enhanced ClearTestES3.MaskedIndexedClearMultipleAttachments
regression test.

Disabled OES_draw_buffers_indexed on Windows/AMD/OpenGL.

Bug: angleproject:4394
Change-Id: I244ac2975678bc559634152cf4eb997d9dbe83d0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2145874
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-04-27 19:17:17 +00:00
Jeff Vigil e20f36f495 EGL: Implement EGL_ANDROID_native_fence_sync on vulkan
Check the following -
1. Vulkan ICD supports VK_KHR_external_fence_fd
2. ExternalFenceProperties and ExternalSemaphoreProperties
   support Android FD.

eglCreateSync - if FD was provided import to VkFence,
                else create VkFence with new FD and then
                flush and submit VkFence on next vkQueueSubmit.

eglGetSyncAttrib - for status call vkGetFenceStatus.

eglDupNativeFenceFdANDROID - return FD from vkGetFenceFD call.

eglClientWaitSync - call vkWaitForFences.

eglWaitSync - dup FD, create VkSemaphore and import FD, then
              flush() and add VkSemaphore to next vkQueueSubmit
              as a waiting semaphore.

Extended end2end test suite with nativefence test cases.

Bug: angleproject:2517
Test: angle_end2end_tests --gtest_filter=EGLSyncTest.AndroidNativeFence_*
Change-Id: I8f6a6f4c3d71d83007f662b78377aa015a740035
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2026177
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-04-23 17:59:08 +00:00
Le Hoang Quyen dadd198650 Implement GL_APPLE_clip_distance
- Built-in variable gl_ClipDistance has been added to compiler.
- Desktop GL: gl_ClipDistance is supported since GL 3.0. Enable/Disable
each gl_ClipDistances[i] works out of the box via glEnable().
- Vulkan/Metal: Use uniform variable to control writing to each
gl_ClipDistance. One bit flag controls one element in the gl_ClipDistance
array. The writing to the disabled element in vertex shader will be
ignored, and turned into zero assignment instead.
- Direct3D/Mobile GL: Not implemented yet.
- Added ClipDistanceTest to gl_tests and compiler unittests.
- GL_APPLE_clip_distance is a subset of GL_EXT_clip_cull_distance, so
GL_EXT_clip_cull_distance could be implemented in future if needed.

Bug: angleproject:4452
Change-Id: I571ac8b56826989808a680226a04bec4cf59988e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2084324
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-04-22 18:17:56 +00:00
Mohan Maiya b7d6949b91 Vulkan: Enable persistently mapped buffer objects
The VMA allocator has a handy feature where during memory
allocation we can request persistently mapped memory.
This saves IOCTL overhead for apps that update buffers
frequently.

Bug: angleproject:2162
Change-Id: I870d880033beec343efae6de06f1c5935de4c2c1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2155131
Reviewed-by: Tobin Ehlis <tobine@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Tobin Ehlis <tobine@google.com>
2020-04-21 23:24:38 +00:00
Geoff Lang 8cae5e19f5 GL: Re-enable emulatePrimitiveRestartFixedIndex
This workaround is needed when the GL driver is less than 4.3 (all
MacOS). The driver will generate many errors during execution without
this enabled which blocks GL driver error checking.

Add additional workarounds for Intel drivers that need a sufficiently
large primitive restart index when doing DrawArrays calls.

BUG=angleproject:3997

Change-Id: Idd293ff1dbc0a3609b11ea1d6b30da0a99e8f5c5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2141714
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2020-04-20 16:54:46 +00:00
Charlie Lao dee4d7a54e Vulkan: Early fragment tests optimization
Checks if early fragment tests as an optimization is feasible and enable
it if we can. In the link time, if context state diagrees with
optimization (in rare case), then remove the
ExecutionModeEarlyFragmentTests sprv op code.

Bug: angleproject:4508
Change-Id: Ifbb06c0ffb050a9f3ddb16ab50362e908b4b9cf6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136490
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
2020-04-13 23:37:58 +00:00
Yuly Novikov 4609c4aca8 Feature::condition must not be NULL
Since it's returned by eglQueryStringiANGLE, and the doc says:
1. eGLQueryStringiANGLE returns a pointer to a static, null-terminated string
2. On failure, NULL is returned

So, we shouldn't be returning NULL when there is no failure.
This was breaking 'chrome --enable-gpu-service-logging'.

Bug: angleproject:3947
Change-Id: I2dcc7d479899dc1fc5fd59a502e84defe44f64c9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2137939
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2020-04-07 17:42:35 +00:00
Mohan Maiya 96c26c681b Add support for NV_shader_noperspective_interpolation
Added support for GL_NV_shader_noperspective_interpolation on
the Vulkan and Desktop OpenGL backends

Bug: angleproject:4388
Test: angle_end2end_tests --gtest_filter=ShaderInterpTest.NoPerspective/*
Change-Id: I12473830c0ea8b4fffeae9c4a8ec92d979c8e18c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2107234
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-04-03 19:01:16 +00:00
Jonah Ryan-Davis 4b94d7bb4f Split EGL_CHROMIUM_sync_control into EGL_ANGLE_sync_control_rate
eglGetMscRateCHROMIUM was added to EGL_CHROMIUM_sync_control based
on the original extension GLX_OML_sync_control. However, this new
function is not universally implemented. This CL moves it to a new
extension, EGL_ANGLE_sync_control_rate, and renames it to
eglGetMscRateANGLE.

Bug: chromium:1064078
Change-Id: Ia2a29c6776b2b2bf2b98e58ee83b5f141ed01301
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2118154
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-03-31 20:55:48 +00:00
Jamie Madill d03b15b2f9 Vulkan: Mask out Depth/Stencil RTs in feedback loops.
This should enable some cases of limited support for feedback loops
with depth/stencil buffers. For example with Manhattan and the Vulkan
back-end.

Increases the number of RenderPasses in Manhattan slightly. This will
regress performance slightly until we can work out a better solution
that is also conformant with the spec.

Bug: angleproject:4517
Change-Id: I2758e6b4c2a930474c09cdc0950f3b6c34541089
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2106670
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
2020-03-27 21:41:55 +00:00
Mohan Maiya ca2b6e1f6f Vulkan: Implement EXT_shader_non_constant_global_initializers
Enables the translator to handle non-constant global initializers in
all essl versions iff the shader enables the extension to do so.

Bug: angleproject:4468
Test: angle_end2end_tests --gtest_filter=ShaderNonConstGlobalInitializerTest.*
Change-Id: I8f138c12fc83d2f38ff8f45ca9133222b01e4087
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102959
Reviewed-by: Tobin Ehlis <tobine@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
2020-03-20 20:49:47 +00:00
Geoff Lang 07467b4aca Remove GL_CHROMIUM_path_rendering
Bug: chromium:1063193
Bug: angleproject:4270
Change-Id: I35b24b7d8d892181955e49dd2495655bc57cb0df
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2112275
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2020-03-20 19:13:16 +00:00
Julien Isorce 07044c6549 Reland "Instantiate rx::DisplayEGL when device type EGL is selected"
This is a reland of 7455b54401

Original change's description:
> Instantiate rx::DisplayEGL when device type EGL is selected
>
> Define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE that should be
> used to request a driver egl-backed implementation with ANGLE.
>
> Bug: angleproject:4328
> Change-Id: I6871d3a27e2bfc02af9815dcf86ae1cb6524f0cc
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2030038
> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

Bug: angleproject:4328
Change-Id: I4e997c4fa1b5b59f081436f05bd208303ffe38e9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2093412
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
2020-03-12 22:21:48 +00:00
Ian Elliott 03ed5f6c46 Revert "Instantiate rx::DisplayEGL when device type EGL is selected"
This reverts commit 7455b54401.

Reason for revert: This appears to break the "Linux FYI Ozone (Intel)" bots on the chromium.gpu.fyi waterfall.  Ozone means ChromeOS.

Original change's description:
> Instantiate rx::DisplayEGL when device type EGL is selected
> 
> Define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE that should be
> used to request a driver egl-backed implementation with ANGLE.
> 
> Bug: angleproject:4328
> Change-Id: I6871d3a27e2bfc02af9815dcf86ae1cb6524f0cc
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2030038
> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

TBR=geofflang@chromium.org,syoussefi@chromium.org,jonahr@google.com,julien.isorce@chromium.org

Change-Id: I8aec6c2783b0acb67d3315d351cdc9e526f58d6b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:4328
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2091864
Reviewed-by: Ian Elliott <ianelliott@google.com>
Commit-Queue: Ian Elliott <ianelliott@google.com>
2020-03-06 22:15:53 +00:00
Tobin Ehlis 1a5c7a16ba Reland "Vulkan:Include precision qualifier in GLSL"
Currently still ignoring precision qualifiers for Vulkan shaders by
default, but have added feature "enablePrecisionQualifiers" that can be
enabled in order to include precision qualifiers.

With this initial implementation, it's possible to get precision
qualifier mis-matches in the generated GLSL 4.50. According to the
spec this is allowed. From GLSLangSpec 4.50 section 4.7 "Precision and
Precision Qualifiers":

For the purposes of determining if an output from one shader stage
matches an input of the next stage, the precision qualifier need not
match.

However, when converted to SPIR-V and run through the shader validation
any mismatches will cause shader validation errors. Initially just
ignoring those errors with this commit.

Bug: angleproject:3078
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057749
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tobin Ehlis <tobine@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Tobin Ehlis <tobine@google.com>
Change-Id: Ieecca604bb2c834c9b1c2bcab85279d1f8755dfa
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2086280
2020-03-06 18:13:05 +00:00
Julien Isorce 7455b54401 Instantiate rx::DisplayEGL when device type EGL is selected
Define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE that should be
used to request a driver egl-backed implementation with ANGLE.

Bug: angleproject:4328
Change-Id: I6871d3a27e2bfc02af9815dcf86ae1cb6524f0cc
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2030038
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-03-06 17:39:35 +00:00
Xiaoxuan Liu f8b2867816 Vulkan: Add support for VK_EXT_index_type_uint8
Enable VK_EXT_index_type_uint8 Vulkan extension if supported by
VkDevice.

Bug: angleproject:4405
Change-Id: I84d030497898c5944a36d9a88a31e7377ccd5e9e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2082391
Commit-Queue: Xiaoxuan Liu <xiaoxuan.liu@arm.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-03-03 16:24:14 +00:00
Jamie Madill 80f55e9742 Expose glGetInteger64vEXT.
This entry point is specifically for retrieving very large timestamp
values from EXT_disjoint_time_query. In GLES 2.0 contexts with the
Vulkan back-end we were getting some astronomical values that couldn't
be cast to 32-bit ints.

Also fix missing dependencies in generate_loader.py.

Bug: angleproject:4433
Change-Id: I59146dcc1a163a24ac2d7c37546f4551a7a8890a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2080595
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2020-03-03 02:01:39 +00:00
Alexey Knyazev 51a9da21ff Add OES_draw_buffers_indexed autogenerated wrappers and validation redirects.
This extension allows setting independent blend state (and color write mask) for each draw buffer. OES and EXT versions provide exactly the same functionality. It is also included in GLES 3.2 core.

Bug: angleproject:4394
Change-Id: I0c27c419472622e309a038dd1463fa0b3e4ca595
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2078587
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-03-02 21:38:09 +00:00
Tobin Ehlis ff60abaf62 Vulkan:Disable FramebufferVk cache on Apple
Currently hitting a crash on Apple so disabling FramebufferVk cache.

Bug: angleproject:4442
Change-Id: I3824252210aeeaf9919c8d17730395b394a50862
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2080661
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Tobin Ehlis <tobine@google.com>
2020-03-02 16:47:29 +00:00
Jamie Madill daf6e47111 Upgrade gl2ext.h.
Includes a new entry point needed for disjoint timer queries. This
header is copied exactly from Khronos's official repo. We add one
change so that we can include special ANGLE modifications in
gl2ext_angle.h.

Bug: angleproject:4433
Change-Id: I6c9cbdfa73ca3de052ff49c5ea91eb5e9a9ee699
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2080596
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-02-29 02:33:28 +00:00
Ian Elliott e488d8b8da Vulkan: Implement Android pre-rotation
As an Android GLES driver on top of Vulkan, ANGLE must pre-rotate
rendering on behalf of the application.  This involves modifying the
vertex shader to multiply gl_Position with a mat2 "rotation matrix".
Not doing so means that SurfaceFlinger (SF) will perform a costly
rotation blit before presenting every image.  Setting
WindowSurfaceVk::mPreTransform to mCurrentTransform tells SF to not do
the blit.

When the surface is rotated 90 or 270 degrees, the width and height
must be swapped for:

- The swapchain images, and for any depth, stencil, and/or multisample
  attachments used with the swapchain image.

- The viewport, scissor, and render area.

Because the Metal back-end shares the TranslatorVulkan, it will define
the same preRotation (mat2) DriverUniform that is used for Vulkan.

Bug: angleproject:3502
Change-Id: I968dbe8869ba0f50de18dd41f1195e847c06b545
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2038272
Commit-Queue: Ian Elliott <ianelliott@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-02-27 01:11:16 +00:00
Jamie Madill 660c0dd6f5 Vulkan: Fix padding out Buffer allocations on AMD.
We would often pad incorrectly given the constraints of the max stride.
We shouldn't really be rounding up the buffer size, but we should
instead be adding the max alignment size to the end of the buffer.

Bug: angleproject:4428
Change-Id: Id2afc572c85985548a18f60b42cdc388d83d5c4c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2071235
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-02-25 20:14:03 +00:00
Michael Spang c419771396 Implement glImportMemoryZirconHandle & glImportSemaphoreZirconHandle
Implement import of fuchsia external objects passed by zircon handle. This
works exactly the same as with file descriptors.

Bug: angleproject:3492
Change-Id: I4d46917dfc5902f00c94550158a9f8073097f0a4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1642334
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-02-21 18:35:23 +00:00
Jamie Madill c58458e633 Vulkan: Remove CommandGraph code.
Also updates relevant comments to no longer refer to a graph.

Bug: angleproject:4029
Change-Id: Ic29716e9ae4926870f902947d49d8fee7af98662
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057804
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-02-21 04:36:29 +00:00
Jamie Madill ce4918f18f Vulkan: Sanitize Images & Buffers with non-zero values.
Only enabled for specific tests at the moment. This CL allows our tests
to sanitizes memory for the robust resource access extension. It is
quite slow so should not be enabled by default.

Only works for 1 level 2D color textures and buffers. Makes several
flaky robust resource initialization tests consistently fail.

Controlled via an angle::Feature in FeaturesVk.

It works by initializing memory to an abitrary non-zero value:

 - if newly allocated memory is mappable, we map it in init and set it
 - if a buffer or texture can be a transfer destination, we use a
   staging resource
 - otherwise we don't attempt to initialize the resource.

Bug: angleproject:4384
Change-Id: I9b4f347bfcddf3096f491ed0243bef86837feaa0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2043271
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2020-02-21 00:09:27 +00:00
Michael Spang dec00bc833 Generate entrypoints for Fuchsia external objects extensions
Add GL_ANGLE_memory_object_zircon_handle &
GL_ANGLE_semaphore_zircon_handle extensions to supported extensions list
and re-generate bindings.

Bug: angleproject:2475
Change-Id: I464aa402aaac916c1f459930c771a0813ec63c9b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1642333
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-02-20 23:44:31 +00:00
Michael Spang 0941e65385 Add external object extensions for Fuchsia to GL API
Add extensions layered on top of GL_EXT_memory_object and GL_EXT_semaphore
to support GL & Vulkan interoperation on Fuchsia. They are analagous to
the file descriptor versions, except not quite as opaque.

This is a draft; the underlying vulkan extensions have not been submitted
to Khronos.

Bug: angleproject:3492
Change-Id: Ic4723ded9fff752c4186eaa6a7f07d9ac51a3364
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1642332
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-02-20 21:54:21 +00:00
Pierre-Marc Berube 9a481b6ec8 Add missing #include to fix build with GCC 10.
Bug: angleproject:4389
Change-Id: I4a2f04a12a059924871f5d54f137c67670747ebd
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2063042
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2020-02-19 19:16:44 +00:00
Shahbaz Youssefi 1f5f7ea3e9 Vulkan: Fix SPIR-V transformation name-info association
Prior to this commit, when "OpName %id name" was encountered, the info
corresponding to "name" was immediately associated with %id.  This is
not necessarily correct because there could be multiple ids with the
same name.  For example a sampler declaration and an unrelated function
argument could have the same name.  In this case, the sampler
declaration and function argument name don't even need to be in the same
shader stage.

This change modifies the SPIR-V transformation such that the name-id
mapping is tracked until the OpVariable instruction that actually
declares the variable is visited.  The mapping to variable info is only
done if the storage class specified in this instruction corresponds to a
shader interface variable.

Bug: angleproject:3394
Change-Id: I35a1f6f8278e4b1ad81c9955a55e1b72d6f2e4ea
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057248
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-02-19 18:59:03 +00:00
Peng Huang fa9eff37c3 Disable GL_EXT_semaphore_fd for Mesa version < 19.3.5 on AMD GPUs
Bug: chromium:1053516
Change-Id: Idfc271ac70c8ded7d05a258beb4a7578a5a652c3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2062162
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2020-02-18 23:21:22 +00:00
Jonah Ryan-Davis 806ba5663b Extend ANGLE_iosurface_client_buffer to Vulkan backend for Swangle
Implement an IOSurface-backed pBuffer surface for the Vulkan backend
on Mac, through SwANGLE. ANGLE will pass a raw pointer to Swiftshader
and handle locking/unlocking the IOSurface.

Bug: chromium:1015454
Change-Id: Ia3ead55334736003d405b54ba8dcc7701706fbb2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1965434
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-02-05 21:19:16 +00:00
Alexey Knyazev 9e774041f8 Update S3TC GL extension strings
Added avoid_dxt1_srgb_texture_format workaround

Bug: angleproject:4266
Change-Id: I286a9c66f6ea1d2c9d3587f6ca85608336eb44a6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2033065
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2020-02-04 14:37:37 +00:00
Tobin Ehlis 1736c47b74 Vulkan: Remove transient cmd buffer workaround
We no longer need this workaround. Also mCommandPoolFreeList dead code.

Bug: angleproject:3508
Change-Id: Ib73ddd431eb1bf9a55c3421111af4df5976cc1fb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2033485
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tobin Ehlis <tobine@google.com>
Commit-Queue: Tobin Ehlis <tobine@google.com>
2020-01-31 20:33:22 +00:00
Jeff Gilbert a805ac7cbe Allow overriding ANGLE_PLATFORM_EXPORT.
Bug: angleproject:4365
Change-Id: I4098ebdd718624e9d0578e0ee69f0a84a5b78183
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2033064
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-01-31 18:43:28 +00:00
Charlie Lao 71153201dc Vulkan: Disable restartRenderPassAfterLoadOpClear workaround
This workaround was added due to qualcomm driver bug b/129281932. But
this has been fixed with recent drivers. Removing the WR here so that it
will not negatively affect performance.

Bug: angleproject:4344
Change-Id: Iea2ec86082a0ced64bfe843bf916c6bdb2aea60b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2029210
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Tobin Ehlis <tobine@google.com>
2020-01-31 18:22:58 +00:00
Kenneth Russell e196bc85ac Add driver bug workaround for rewriting row major matrices.
Joint work with syoussefi@, who wrote the RewriteRowMajorMatrices
pass, and revised it for this CL to not rely on the
NameNamelessUniformBuffers pass - which was breaking it on the GL
backend.

Hook up previously written RewriteRowMajorMatrices transformation, and
enable on all GPU types on macOS. It is needed at least for AMD and
Intel GPUs.

Add a new test which verifies the behavior of dynamically-indexed
arrays of row-major matrices.

Bug: angleproject:2273
Bug: angleproject:3843
Change-Id: Id582f9cf6b9b1a59091aab1786539174f360b705
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2008717
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-01-30 22:08:39 +00:00
shrekshao eca11cc81c SH_CLAMP_INDIRECT_ARRAY_BOUNDS logic update
Remain the old hardware requirement for turning on clampArrayAccess. But
also turns it on universally for WebGL context. So that we won't suffer
from clampArrayAccess not handled properly on some compute shader deqp
tests.

Bug: chromium:1042252, angleproject:4361
Change-Id: Ib11affd6df27ce7d2100980d2b8decdee36876e8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2026029
Reviewed-by: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2020-01-29 16:53:37 +00:00
Shahbaz Youssefi f1f082e137 Vulkan: Set varying location & xfb decorations in SPIR-V
The shader translator outputs arbitrary location indices.  Once compiled
by glslang, the SPIR-V transformer modifies these decorations.  If the
transform feedback extension is used, it will also add the relevant
decorations to the varyings that are captured.

Bug: angleproject:3394
Change-Id: I5ecafd0536408612a5d4b920dbabbfabe650657c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2008468
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-01-29 15:01:27 +00:00
Shahbaz Youssefi 71e6afb1c1 Vulkan: Set set/binding in SPIR-V
This change introduces a SPIR-V transformer that modifies shader
interface variable decorations directly in SPIR-V instead of
manipulating the input GLSL.  Currently, descriptor set and binding
indices are set by the transformer.

The shader translator outputs arbitrary set and binding indices.  Once
compiled by glslang, the SPIR-V transformer modifies these decorations.
The ultimate goal is to be able to modify the SPIR-V again when program
pipeline objects decide a different set/binding is necessary.

Bug: angleproject:3394
Change-Id: If358265a72bf1fe9f5676562b39a632cb2e05dc4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2001477
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-29 05:24:40 +00:00
Jonah Ryan-Davis 1a1a1427fd Expose eglGetMscRateCHROMIUM from EGL_CHROMIUM_sync_control
When ANGLE is using the GL backend on GLX, we can expose
eglGetMscRateCHROMIUM via glXGetMscRateOML. Otherwise, this function
should return false.

Bug: chromium:1042393
Change-Id: Id9b308c2217e07ee9860e2869be0e23b7a0c7411
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2017048
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2020-01-27 19:30:45 +00:00
Shahbaz Youssefi b36e46ab02 Vulkan: Line raster emulation through specialization constant
In preparation for compiling shaders early at link time, this change
reworks line raster emulation such that it uses specialization constants
instead of a preprocessor condition.  This means drawing both triangles
and lines with this program will still result in a one-time shader
compilation.

The compilation is still done at draw time in this change.

Bug: angleproject:3394
Change-Id: I0bf91398868d7f7147456533b728906b505192b2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1992365
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2020-01-22 22:26:11 +00:00
Jamie Madill 62475e95da Allow tests to pick ANGLE features.
This uses the EGL_ANGLE_feature_control extension through the test
harness to control feature selection via a test config. This obviates
the need for the hacky platform methods table override.

Also adds a command graph feature that will be used to prototype the
command graph linearization for Vulkan.

Bug: angleproject:4029
Change-Id: Id37fadd5d2c317c9d9dd90dfab1fdc8e4ac3701f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2007612
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-20 21:45:20 +00:00
Kenneth Russell 86f7309717 Upstream support for iOS Simulator.
Originally authored in the WebKit repository:
https://bugs.webkit.org/show_bug.cgi?id=205618

Has been tested with WebKit's WebGL backend on top of ANGLE inside the
iOS Simulator. TODOs will be addressed in forthcoming CLs.

Bug: angleproject:4263
Change-Id: Ic879866aaee5f933599d956b0646d0c01db55d0d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1995824
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
2020-01-14 21:08:21 +00:00
Shahbaz Youssefi 6b2754066a Vulkan: Workaround vertex attributes vs stride issue on AMD
Under robustBufferAccess, Vulkan states that:

Vertex input attributes are considered out of bounds if the offset of
the attribute in the bound vertex buffer range plus the size of the
attribute is greater than either:

- vertexBufferRangeSize, if bindingStride == 0; or
- (vertexBufferRangeSize - (vertexBufferRangeSize % bindingStride))

The latter implies that if the buffer size is not a multiple of the
vertex attribute stride, what lies beyond the last multiple of stride is
considered out of bounds.

It also says:

Out-of-bounds buffer loads will return any of the following values:

- Values from anywhere within the memory range(s) bound to the buffer
  (possibly including bytes of memory past the end of the buffer, up to
  the end of the bound range).
- Zero values, or (0,0,0,x) vectors for vector reads where x is a valid
  value represented in the type of the vector components and may be any
  of ...

The first bullet point indicates that the driver is allowed to load the
attribute values from the buffer if its range still lies within the
buffer size.

Take the following example:

- Buffer size = 12
- Attribute stride = 8
- Attribute offset = 0
- Attribute size = 4

Basically the buffer is thus laid out as follows:

          attr stride
      _________/\_________
     /                    \
    +----------+----------+----------+
    | vertex 0 | padding  | vertex 1 |
    +----------+----------+----------+
     \___ ____/
         V
     attr size

In the above example, the attribute for vertex 1 is considered out of
bounds, but the driver is allowed to either read it correctly, or return
(0, 0, 0, 1) for it.

Most drivers implement the former, while AMD implements the latter.
This change introduces a workaround for AMD where
GL_MAX_VERTEX_ATTRIB_STRIDE is limited to 2048 (the common value for it
according to gpuinfo.org) and conservatively rounds up every buffer
allocation to that size.

While technically, this workaround should be applied on any device with
the robustBufferAccess feature enabled, it is currently limited to AMD
to avoid the inefficiency.  A possible future revision of Vulkan may
relax the above restrictions.

Bug: angleproject:2848
Change-Id: Ida5ae5d777da10f22ce8be5a09a7644b5bbd778e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1991709
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-11 06:07:42 +00:00
Kenneth Russell 12ce8f687d Upstream WebKit's iOS port of ANGLE.
Added the EAGL backend authored by Dean Jackson from Apple, and the
refactoring changes needed to support it side-by-side with the macOS
backend. Ran "git cl format" against these diffs.

Defined the EGL_ANGLE_device_eagl extension and allocated an enum out
of ANGLE's reserved range.

The iOS backend is not yet included in any of the GN files.

Bug: angleproject:4263
Change-Id: I631c32930433c03bb16a242955ffedf55174bb29
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1987278
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: James Darpinian <jdarpinian@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
2020-01-10 02:00:18 +00:00
Kenneth Russell 7a37d3acf5 Work around Intel driver bug with CopyTex{Sub}Image2D/DeleteTextures.
Dependencies seem to be incorrectly tracked in some Intel OpenGL
drivers (on macOS specifically), causing crashes in glDeleteTextures
if a GL command buffer is being constructed where those textures are
destinations of CopyTexImage2D/CopyTexSubImage2D. Work around this bug
by flushing before texture deletion if CopyTex{Sub}Image have been
called recently. The tracking is only done on a per-context rather
than a per-device basis, but seems sufficient to work around the
problem as identified.

Tested both with new ANGLE test on affected hardware, and in WebKit's
ANGLE backend for WebGL. Works around the crash reported in
https://bugs.webkit.org/show_bug.cgi?id=205707 .

Bug: angleproject:4267
Change-Id: I2266a5590759f6a3f19080def08710ef4b66d463
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1987932
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-09 23:58:27 +00:00
James Darpinian 27db24581e Optimize disabling ARB_texture_rectangle
In https://crrev.com/c/1838418 I added the ability to disable
ARB_texture_rectangle so that we can use it in the WebGL implementation
but disable it when compiling user shaders. Unfortunately disabling
and re-enabling the extension causes the shader translator to be
reinitialized which turns out to be more expensive than the actual
work of shader translation, at least for small shaders. It's slow enough
to cause timeouts in WebKit's WebGL conformance test runs.

This introduces an alternate method of disabling ARB_texture_rectangle
in the translator which is much faster because it avoids reinitializing
the translator.

Bug: angleproject:3956
Change-Id: I5d31b683ff19a59bdfd289cfd3c609f64ef5e25b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1991969
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
2020-01-09 17:46:38 +00:00
Shahbaz Youssefi 0721cc8ba0 Vulkan: No line raster emulation code if extension
A flag is added to the translator to disable generation of Bresenham
line raster emulation code when the Bresenham line raster Vulkan
extension is present.  This is primarily for the sake of conversion of
line raster emulation condition to specialization constant:

- Avoid dead SPIR-V code in every shader
- Avoid ANGLEUniforms being active in every shader stage even if it's
  not used anywhere but in line raster emulation.
- Optimize SPIR-V transformations by both having fewer instructions to
  iterate through, and to avoid generating line raster patches.
- Reduce the severity of anglebug.com/4251 where the location assignment
  of ANGLEPosition can incorrectly overlap a varying array or struct, by
  making only platforms without Bresenham extension afflicted by the
  bug.

Bug: angleproject:3394
Change-Id: Ic0ae6ce0392b4eae0cc79cb94bbcd0805b276a31
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1986379
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-06 21:05:38 +00:00
Jeff Vigil 3311ef6568 update date comments to 2020
run_code_generation.py updated comments with 2019 to 2020.
Put all date updates into this one CL.
This also updated hashes.

Bug: angleproject:4262
Change-Id: Ia213dd5e47f155986cbb4161d777724355878af0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1986994
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2020-01-06 16:25:35 +00:00
shrekshao 81ee4d2919 Workaround EXT_texture_norm16 for OpenGL ES drivers
Implement a workaround for widespread bugs calling glReadPixels with
RGBA/UNSIGNED_SHORT against R16/RG16 color attachments. Read back the
data using the GL_IMPLEMENTATION_COLOR_READ_FORMAT, and then rearrange
the read back pixels to fit the RGBA layout.

Also skip RGB16/RGB16_SNORM texture sample test on Nexus 5X/Nexus 6P
due to a another driver bug.

Bug: chromium:1000354, angleproject:4214, angleproject:4215, angleproject:4245
Change-Id: Iedea6f4136878cac5ad0dec3757c77b73502e1cd
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1952166
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2020-01-03 17:56:58 +00:00
Xinghua Cao 1fdf6ca514 D3D11: Restrict to translate uniform block to StructuredBuffer
Only translate uniform block to StructuredBuffer when system is
Windows 10 and later.

Bug: angleproject:3682
Change-Id: I27e3f4503392791883a44e1d486ffe9512e04bd8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1984863
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2020-01-02 14:13:13 +00:00
Mohan Maiya 942d91520a EGL: Add support for EGL_KHR_gl_colorspace extension
If the Vulkan backend supports VK_EXT_swapchain_colorspace extension,
enable the option for applications to create surfaces with non-linear
formats. Not all formats have non-linear versions and is platform
specific.

Tests: dEQP-EGL.functional.wide_color.*
       angle_deqp_egl_tests --use-angle=vulkan --deqp-gl-context-type=egl --deqp-case=dEQP-EGL.functional.wide_color.*
Bug: angleproject:2514
Change-Id: I441ee797cceef92c84473bfa18605c4fd8180de1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1951963
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2019-12-30 23:45:18 +00:00
Xinghua Cao 0af8b59612 D3D11: Translate uniform blocks to StructuredBuffer when necessary
fxc exhibits slow compile performance with dynamic cbuffer indexing.
So when a uniform block contains only one large array member, which is
an array of structures, translate this uniform block to
a StructuredBuffer instead.

Bug: angleproject:3682
TEST=angle_end2end_tests.UniformBufferTest.*
Change-Id: Ife80dba8aae65b761737e095895e00a570230f88
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1782046
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-12-21 03:35:38 +00:00
Yan 17b3c2f3f8 Implement SamplerVideoWEBGL for WEBGL_video_texture extension on desktop
WEBGL_video_texture is an extension that will improve uploading video frame to WebGL performance.
(https://www.khronos.org/registry/webgl/extensions/proposals/WEBGL_video_texture/)

This extension introduced a new texture type TEXTURE_VIDEO_IMAGE_WEBGL and a new sampler type
samplerVideoWEBGL to sample it.

In chromium implementation, TEXTURE_VIDEO_IMAGE_WEBGL maps to different native texture type
based on platform. On desktop, it maps to GL_TEXTURE2D(Currently supported). On Android, it
should map to GL_TEXTURE_EXTERNAL(TODO). SamplerVideoWEBGL needs to be mapped to sampler2D or
samplerExternalOES according to TEXTURE_VIDEO_IMAGE_WEBGL implementation.

This patch implements samplerVideoWEBGL in Angle to support WEBGL_video_texture on desktop. In
this case, samplerVideoWEBGL should map to sampler2D.

Bug: chromium:776222, angleproject:3889
Change-Id: Idb0a5fcde37ca75ccc1181226b91f257212e7500
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866274
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-12-18 16:49:26 +00:00
Le Hoang Quyen d1860ea17e Metal: support OES_depth_texture
Also added Depth32 & Depth16 texture data upload tests.

Bug: angleproject:2634
Change-Id: I103f1cda1dc915f0dc8b04f7aaa2d8c0f9220cda
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919281
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-12-15 14:44:43 +00:00
Hyunchang Kim caa6eccde3 Vulkan: Implement Transform Feedback support via extension
Implemented transform feedback extension path. Where
VK_EXT_transform_feedback is supported, extension path will be taken
over an emulation path. Extension path has advantages in terms of
performance.

BUG=angleproject:3206
Test: dEQP-GLES3.functional.transform_feedback.*
      angle_end2end_tests --gtest_filter=TransformFeedbackTest*

Change-Id: Ia07c23afb289d9c67073469a97b714ec96f5265a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1882767
Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2019-12-10 21:33:32 +00:00
Shahbaz Youssefi 795a355921 Vulkan: EXT_gpu_shader5 support: precise
The precise keyword is used in tessellation shaders but introduced in
this extension.

EXT_gpu_shader5 introduces a handful of features to shaders.  This
change only implements the `precise` keyword.

Bug: angleproject:3569
Change-Id: I2252b79098eb8ba2d2faa040d7eaed7548b7051e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1939851
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-12-05 20:20:07 +00:00
Courtney Goeltzenleuchter 33a00efd7c Add Compute Shared Memory Size Validation
Add tracking of shared memory declarations in compute shaders.

Test:
  angle_deqp_gles31_tests --gtest_filter=dEQP.GLES31/functional_debug_negative_coverage_callbacks_compute_exceed_shared_memory_size_limit

Bug: 4173
Change-Id: If2a86d467a82f73fa5b2ee0ced752701acfe1872
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1934653
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-12-04 19:45:47 +00:00
Ethan Lee a825eb70cc Implement BaseVertex draw calls for Vulkan, OpenGL, NULL contexts.
This adds support for the following functions:

- glDrawElementsBaseVertex
- glDrawRangeElementsBaseVertex
- glDrawElementsInstancedBaseVertex

Bug: angleproject:3582
Bug: angleproject:3402
Bug: angleproject:4166
Change-Id: I83770f62e3a918c0965fd4ca8c7d9e598b8b4154
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1929083
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-11-25 21:27:58 +00:00
Jonah Ryan-Davis f9c3eaf457 Add ability to disable all ANGLE features
Chrome has a --disable-gpu-driver-bug-workarounds flag that needs to be
able to be forwarded to ANGLE

Bug: 1016377
Change-Id: Ied6c8656742e25c32d508b8bfe76a902d82bcf93
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1925249
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-11-20 17:01:23 +00:00
Jiawei Shao 0303cf6b95 OpenGL: Port all Intel-related workaround conditions from gpu_driver_bug_list.json
This patch ports all the Intel-related shader workarounds defined in
gpu_driver_bug_list.json used by Chromium validating command buffer
into ANGLE so that they can also take effect in Chromium passthrough
command buffer.

Bug: 1020467
Bug: 642605
Bug: 403957
Change-Id: I8e4866fc34d5e8f1b2f4dbfa8e526b80249ba166
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1889386
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-11-20 16:00:28 +00:00
Ethan Lee 736164ff79 Headers: Add EGLAPI to SwapBuffersWithFrameTokenANGLE
Bug: angleproject:4116
Change-Id: I83392c7bad002d9b6b939983385ace7c9ebcc090
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919633
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-11-19 23:34:33 +00:00
Jamie Madill 3f647b1bf9 Vulkan: Improve Bresenham line emulation.
Clamps the vertex position to the subpixel grid before interpolation.
This will give more correct results on systems that have less than
8 bits of subpixel accuracy.

Also uses a more accurate formulation for the emulation filter in the
fragment shader using dfdx and dfdy.

Fixes line raster CTS tests on SwiftShader. Still does not produce spec
conformant lines. Updates the public docs to indicate this.

Bug: angleproject:2830
Change-Id: Ib9a268df3e7d986bd2b1348be664389fe8fc0ef2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1826598
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
2019-11-12 14:32:58 +00:00
Jamie Madill e167f76b08 Capture/Replay: Pass gl::State to capture functions.
This replaces passing gl::Context. Using a gl::State directly will more
easily let the mid-execution replay code pass a mocked gl::State
instead of having to modify the real underlying Context state. For
example when capturing pixel pack and unpack parameters the states
could not be overridden without changing the gl::Context itself.
Similarly when capturing client side data.

Also moves a query parameter info function into queryutils so it can be
accessible to the State-based capture.

Refactoring change only.

Bug: angleproject:3611
Change-Id: I3c064001cfa83ebbb67a2b8fc8b6180491edd215
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1899728
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-11-07 13:39:59 +00:00
Jamie Madill c898ec1a5e Add EGL GGP extensions.
This CL adds two new extensions:

 * EGL_ANGLE_ggp_stream_descriptor:
    Introduces a new attribute to CreateWindowSurface. Allows the app
    to pass in a stream descriptor to VkCreateSurfaceKHR.
    Mirrors VK_GGP_stream_descriptor_surface.

 * EGL_ANGLE_swap_with_frame_token:
    Introduces a new function 'eglSwapBuffersWithFrameTokenANGLE'. This
    allows the app to pass a GGP frame token down to vkQueuePresentKHR.
    Mirrors VK_GGP_frame_token.

Bug: angleproject:4078
Change-Id: I4313ac4c264e68999905049f661bc64b44f72fab
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1897315
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2019-11-05 01:50:17 +00:00
Tim Van Patten 0c541c30cf Fix Platform methods list
Functions have to be added to the end of the list to prevent breaking
EGL on Android.

Bug: angleproject:2634
Change-Id: I19705144d8ab873c13891038f840b9fc96a79103
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1897646
Commit-Queue: Tim Van Patten <timvp@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-11-04 19:02:48 +00:00
shrekshao 35f74cd6f8 Reorder BaseVertexBaseInstance draw calls parameters
To match the parameter order of MultiDraw* calls.
And potentially expose in chromium directly with ANGLE_ prefix.

Bug: angleproject:3402, chromium:891861
Change-Id: I19548f4c3c7faa422e43905850b218039de43015
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1894241
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
2019-11-01 20:14:45 +00:00
Le Quyen fe26bae452 Metal backend implementation pt 2
This is without Metal specific shader translator implemented yet.

Bug: angleproject:2634
Change-Id: I95d589442251c9ba111bd05a2dc379a36739046c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1855069
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-11-01 17:37:15 +00:00
Alexis Hetu 5e6be1d627 Provoking vertex feature support enabled
Added support in ANGLE for the provoking vertex feature,
which allows to choose the provoking vertex convention
(first or last) for flat shading.

Just copying the vk_ext_provoking_vertex.h file into ANGLE src tree for now.
When the extension lands in the vulkan header we'll migrate to that and remove this
file from ANGLE.

With this, all these tests pass with SwANGLE:
dEQP-GLES3.functional.fragment_out.* (fixes 526 failures)
dEQP-GLES3.functional.rasterization.flatshading.* (fixes 6 failures)
dEQP-GLES3.functional.shaders.linkage.varying.* (already passing before, still passing)

Bug: angleproject:3430
Bug: angleproject:3677
Bug: angleproject:4063
Change-Id: Icc361f567072c12472398e37a94a61d7f95007ad
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1855681
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Reviewed-by: Alexis Hétu <sugoi@chromium.org>
2019-10-31 13:24:52 +00:00
Tim Van Patten 287b0a670f Vulkan: Enable forceOldRewriteStructSamplers for all Android ICDs
Both Qualcomm and SwS require forceOldRewriteStructSamplers to be
enabled, so this change will enable that feature for all of Android.

We aren't sure yet why this is required for SwS also, but that will be
chased as part of issue 2703.

Bug: angleproject:4045
Change-Id: I83b2ac18e0111ed35438ffd457bfe120911a7767
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1879711
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-29 15:40:49 +00:00
Jamie Madill 0964988b77 Fixups to ANGLE_get_image boilerplate.
- Remove level parameter from GetRenderbufferImage.
- Add packed enum handling to GetTexImage.
- Fix ext spec reference to table 8.4.

Bug: angleproject:3944
Change-Id: I8f67608396217aaddb789dd95d0f3e2378ce918d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1879960
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-10-28 15:21:53 +00:00
Jamie Madill 04ee27efff Capture/Replay: Add ANGLE_get_image extension.
Will be used for mid-execution capture. Only has a
stubbed-out implementation right now.

Bug: angleproject:3944
Change-Id: I6ddae07907ecbdbd3be9a5d2d3fcafeb425445e4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1878888
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
2019-10-25 19:02:16 +00:00
jchen10 df9a7500d3 Remove forceNonZeroScissor workaround
The original driver bug no longer exists after upgrading the bots. This
workaround has the side effect causing the bug 3867.

Bug: angleproject:3407
Bug: angleproject:3867
Change-Id: I64f2e41729f209a1cef5ba49140650207666992c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1870845
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-23 03:12:21 +00:00
jchen10 b307010280 Add SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR
This is a workaround for the webgl2 conformance test case
WebglConformance_conformance2_glsl3_vector_dynamic_indexing_swizzled_lvalue.
Dynamic indexing of swizzled lvalue like "v.zyx[i] = 0.0" is problematic on
various platforms. This removes the indexing by translating it this way:

void dyn_index_write_vec3(inout vec3 base, in int index, in float value){
  switch (index) {
    case (0):
      (base[0] = value);
      return ;
    case (1):
      (base[1] = value);
      return ;
    case (2):
      (base[2] = value);
      return ;
    default:
      break;
  }
  if ((index < 0))
  {
    (base[0] = value);
    return ;
  }
  {
    (base[2] = value);
  }
}

...
dyn_index_write_vec3(v.zyx, i, 0.0);
...

Bug: chromium:709351
Change-Id: I971b38eb404209b56e6764af1063878c078a7e88
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1869109
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-10-23 02:45:10 +00:00
Geoff Lang 0b779a7c4e GL: Emulate primitive restart when PRIMITIVE_RESTART_FIXED_INDEX is unavailable.
PRIMITIVE_RESTART_FIXED_INDEX isn't available until desktop GL 4.3. When it is
not available, emulate it by enabling PRIMITIVE_RESTART and set the primitive
restart index before each draw call based on the index type.

TEST=deqp/functional/gles3/primitiverestart/*

BUG=angleproject:3997

Change-Id: Id736f1056cb07da91c6d592693406333142e6265
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1853885
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-10-22 23:20:01 +00:00
Tobin Ehlis be1fa7d8cd Vulkan: Enable VK_EXT_line_rasterization
Plumbing to make ANGLE use VK_EXT_line_rasterization
extension when available.

Bug: angleproject:3981
Change-Id: I12913c20bff69ab0b7c16462c10b8b5fd8e1c2a5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1865027
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Alexis Hétu <sugoi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-10-22 20:45:20 +00:00
Jonah Ryan-Davis ae1b7786b8 Fix ANGLE_FEATURE_CONDITION style issue
Macro should end with a ;

Bug: angleproject:3976
Change-Id: I4aaa146464d9d7e6230a3de44c30cfd1179a89ae
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1864620
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-16 22:32:04 +00:00
James Darpinian c42da4e57c Extend ANGLE_request_extension with DisableExtension
ARB_texture_rectangle is the only currently supported disablable
extension. This allows us to use ARB_texture_rectangle in WebGL
implementations without exposing it to WebGL user shaders.

Bug: angleproject:3956
Bug: angleproject:3770
Change-Id: I80b10d2e9c9feebe545ce15195721487165ecc51
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1838418
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-10-12 00:42:21 +00:00
Le Quyen d200a77a22 Metal backend skeleton implementation.
Bug: angleproject:2634
Change-Id: I34be82f4a80a6851fecb53a51e069b134d82613a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1849079
Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-10 17:27:38 +00:00
Ian Elliott aa292a59f9 Generate GLES 3.2 entry points
This is a combination of:

- Changing the "scripts/generate_entry_points.py" script to tell it to
  also auto-generate GLES 3.2.  Also changing "scripts/gen_proc_table.py".

- Generating new and modified files needed to add GLES 3.2 to the
  ANGLE front-end.  This is done by running the following command:
  "python scripts/run_code_generation.py".

- Creating the following files:

  - src/libANGLE/validationES32.h
  - src/libANGLE/validationES32.cpp
  - src/libANGLE/capture_gles_3_2_params.cpp

- Hand-editing the following files:

  - src/libGLESv1_CM/libGLESv1_CM.cpp
  - include/GLES2/gl2ext_angle.h
  - src/libGLESv2.gni
  - src/libANGLE/Context.h
  - src/libANGLE/Context.cpp
  - src/libANGLE/Context_gl.cpp
  - src/libANGLE/ErrorStrings.h
  - src/libANGLE/State.h
  - src/libANGLE/validationES1.cpp
  - src/libANGLE/validationGL3.cpp
  - src/libANGLE/validationGL31.cpp
  - src/libANGLE/validationGL32.cpp
  - src/libANGLE/validationGL33.cpp
  - src/libANGLE/validationGL4.cpp
  - src/libANGLE/validationGL43.cpp
  - src/libANGLE/validationGL45.cpp

Bug: angleproject:3649
Change-Id: I5b67f72e3e3b55e74039ec3e28aa8d399ec08cf2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1850231
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Ian Elliott <ianelliott@google.com>
2019-10-10 16:15:48 +00:00
Nathan Zabriskie 5d9c4ee328 Add D3D11on12 device option
This CL adds a new D3D11on12 device option which runs the D3D11
API on top of D3D12. This is done to aid in preliminary
investigations into the feasibility of creating a full D3D12
backend implementation.

Bug: angleproject:3919
Change-Id: I0ad4250eb3c93b0b74274c904aac74f03753c7ad
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1814404
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-10 02:07:39 +00:00
Jamie Madill 09495f87d9 Add ANGLE Platform Metal extension.
EGL_ANGLE_platform_angle_metal is the new extension name.

Bug: angleproject:2634
Change-Id: I6ebffbd4f6d7974bc5ef6d48849e985ee83e9808
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1848793
Reviewed-by: Le Hoang Quyen <le.hoang.q@gmail.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-10-09 15:41:52 +00:00
Kenneth Russell 8e7d9d6c23 Add EGL_ANGLE_device_cgl extension.
Supports querying the CGLContextObj and CGLPixelFormatObj associated
with ANGLE's underlying OpenGL context on macOS.

Minor refactorings to implementation of device attribute queries on
all platforms.

Bug: angleproject:3973
Change-Id: I24341668be4cbfed0b7f2df4c1402df1effe275e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1846733
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-09 03:45:28 +00:00
James Darpinian dce0916859 Enable unfold_short_circuits workaround on Apple.
Bug: angleproject:3957
Change-Id: I49ba77b2daeed01a2b668fc68c26663e87997ad5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1838421
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
2019-10-04 17:34:53 +00:00
Jonah Ryan-Davis 7dd034469a Ensure Features* descriptions stay up to date
Created a macro to help keep Features' descriptions up to date. This
will avoid confusion in the future when conditions change. Also update
all descriptions to match current state.

Bug: angleproject:3947
Change-Id: Ifc65e7789c916fab79f1323798dfb59d7a4efad2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1829584
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-10-02 15:57:35 +00:00
Jamie Madill 8be7a4c7f7 Re-land "Vulkan: SwiftShader integration."
Re-land fixes Win7 configs and placement of the SwiftShader module for
ASAN/TSAN configs.

Adds a new EGL extension for picking SwiftShader when using the Vulkan
back-end. Also cleans up ICD enabling code RendererVk. Also includes a
change to a buffer size necessary to support SwiftShader's minimum
limits.

Bug: angleproject:3876
Bug: b/140251624
Change-Id: I5e16057ac4de07bbdbbd248542b1b9103133294f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1810065
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-09-21 14:00:27 +00:00
Geoff Lang e6582161b0 Convert DXT1 RGB data to DXT3 RGBA when uploading to the GPU.
DXT1 has a specific 'BLACK' code that results in transparent black pixels when
sampled. D3D does not have specific RGB-only DXT1 formats like OpenGL does so
when this code is encountered, we sample 0 alpha for these pixels when GL would
expect 1 because the alpha channel should not exist.

Work around this by converting to DXT3 RGBA, adding an extra block of 1.0 alpha
pixels for each color block.

Mac Intel OpenGL requires additional workarounds to always sample 1.0 alpha.
Set the texture swizzle parameters to force it.

BUG=angleproject:3729

Change-Id: Ia3647085acd97bb01af4e95ef3f6f21dcfb6a554
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1804880
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Ian Elliott <ianelliott@google.com>
2019-09-19 14:49:26 +00:00
Zhenyao Mo db7a36f456 Revert "Vulkan: SwiftShader integration."
This reverts commit 1224802c21.

Reason for revert: https://bugs.chromium.org/p/angleproject/issues/detail?id=3912

Original change's description:
> Vulkan: SwiftShader integration.
> 
> Adds a new EGL extension for picking SwiftShader when using the Vulkan
> back-end. Also cleans up ICD enabling code RendererVk. Also includes a
> change to a buffer size necessary to support SwiftShader's minimum
> limits.
> 
> 32-bit is currently left disabled to work around an issue on AMD Win7.
> 
> Bug: angleproject:3876
> Bug: b/140251624
> Change-Id: I33c55d994801d6154caca0cad0a608c1e808d517
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1776231
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

TBR=geofflang@chromium.org,jonahr@google.com,jmadill@chromium.org

Change-Id: Id7464250f6941b0228a6b2a9bd0349823727275b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:3876, b/140251624
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1808101
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
2019-09-17 00:22:43 +00:00
Jamie Madill 1224802c21 Vulkan: SwiftShader integration.
Adds a new EGL extension for picking SwiftShader when using the Vulkan
back-end. Also cleans up ICD enabling code RendererVk. Also includes a
change to a buffer size necessary to support SwiftShader's minimum
limits.

32-bit is currently left disabled to work around an issue on AMD Win7.

Bug: angleproject:3876
Bug: b/140251624
Change-Id: I33c55d994801d6154caca0cad0a608c1e808d517
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1776231
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-09-16 20:52:55 +00:00
Sunny Sachanandani c1af9abfce Add support for overriding internal format for D3D11 texture EGLImages
Add an optional EGL_D3D11_TEXTURE_FORMAT_ANGLE attribute that is the
GL internal format to use for EGLImage being created.  This will be used
for RGB emulation of swap chain texture backed WebGL contexts in Chrome
when they have alpha:false set.  Without RGB emulation it is possible to
observe side-effects of the underlying swap chain being RGBA such as
reading/writing the alpha channel, BlitFramebuffer working/not working
when expected, etc.

Also document creating EGLImages from D3D11 textures in the existing
EGL_ANGLE_d3d_texture_client_buffer extension along with RGB emulation.

Bug: chromium:699566, chromium:939657
Change-Id: I4931cb7bdc46e9bc6debd56b79ecc10ea27bd78b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1777099
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
2019-09-09 21:32:50 +00:00
Tim Van Patten 90a58622fd Refactor ShaderVariable to Remove Specializations
The following structs are being refactored and moved into the parent
struct ShaderVariable:

VariableWithLocation
Uniform
Attribute
OutputVariable
InterfaceBlockField
Varying

Bug: angleproject:3899
Test: CQ
Change-Id: I389eb3ab4ed44a360e09fca75ecc78d64a277f83
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785877
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Commit-Queue: Tim Van Patten <timvp@google.com>
2019-09-06 14:51:31 +00:00
Mingyu Hu 7e44ec26d6 GL_EXT_multisampled_render_to_texture extension. Part 1.
Adding new parameters for extension without adding any real code change. Since no new code paths were added, we expect all tests to pass as before.

Bug: angleproject:980428
Change-Id: I551b46a66f422eabd357fd021e00cf266a991efb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1772377
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-09-04 19:37:30 +00:00
Geoff Lang d8e821aa52 Expand the TextureGL::releaseTexImage size reset workaround to Win AMD.
Windows 10 AMD drivers have also had issues with generating errors when calling
glTexImage2D with zero size after unbinding a surface.

BUG=angleproject:3859

Change-Id: Iae3e31418b6c89056d0d4aab954519598d8f25f9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1775111
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-08-29 20:29:20 +00:00
Jamie Madill 886698bc3f Vulkan: Style cleanups to TextureVk.
Pass params by const & and use "CPU instead of "Cpu" naming. Also
prefer "ContextVk *contextVk" to "ContextVk *context".

Bug: angleproject:2464
Change-Id: I887de5b2e5494d14f0e9c7db269eb63744f2a3cf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1771499
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-08-27 21:14:06 +00:00
Geoff Lang 5c81d94fa3 Fix a typo in the GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE enum value.
GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE had a typo between the spec and the
header but any user who used our header would still get the correct
beaviour.

BUG=angleproject:3861

Change-Id: Ibc85607ad41a8419246e057065ab4ce797f0ce66
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1772376
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-08-27 14:59:11 +00:00
shrekshao cd31f2860b Implement Draw base vertex and base instance functions
This patch implements functionality of  glDrawArraysInstancedBaseInstanceANGLE,
glDrawElementsInstancedBaseVertexBaseInstanceANGLE,
glMultiDrawArraysInstancedBaseInstanceANGLE,
and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE

Workaround for OpenGL driver on Mac:
gl_VertexID on Mac with AMD GPU doesn't include baseVertex value.
So replace gl_VertexID with (gl_VertexID + angle_BaseVertex) if any.

Workaround for Vulkan GLSL:
gl_InstanceIndex on Vulkan includes baseInstance. So replace
gl_InstanceIndex with (gl_InstanceIndex - angle_BaseInstance) when
angle_BaseInstance is declared.

Bug: chromium:891861, angleproject:3402
Change-Id: Ia1d94b5d4d7da7e635468c05c962c4f7eb1b1919
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750126
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-08-26 21:33:24 +00:00
James Dong 83a369bbec Vulkan: Improve cubemap emulation seam handling
Changes seamful cubemap emulation to always compute the derivative,
emulating the bias parameter by scaling the provided derivatives.
This results in more accurate mipmap levels for seams within primitives.
There are some artifacts as a result of how derivatives are calculated,
but this matches the native driver.

Bug: angleproject:3243
Bug: angleproject:3732
Change-Id: Icb976e2a7e14cb4210645571edc037d4e607bd0d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754383
Commit-Queue: James Dong <dongja@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-08-23 22:49:46 +00:00
Geoff Lang e2ea45bac5 Don't reset the texture size to zero in TextureGL::releaseTexImage on Mac.
After unbinding IOSurface textures, we reset the texture size to 0 because
some platforms don't correctly update their state tracking.  This call ends
up generating GL_INVALID_OPERATION errors on Mac for unknown reasons.

Skip the call, the size reset is not required on Mac anyways.

BUG=angleproject:3859

Change-Id: I5e39b6a36aaff41082a5fcc923970f8e97774675
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769059
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-08-23 21:04:20 +00:00
James Dong 1d5aaa6cd9 Vulkan: support dynamic indices in array of arrays
Expands existing struct-sampler rewrite to flatten arrays of arrays.
This allows us to support dynamically-uniform array indexing, which is
core in ES 3.2.

Samplers inside (possibly nested) structs are broken apart as before,
and then if the type resulting from merging the array sizes of the field
and its containing structs is an array of array, the array is flattened.

Also adds an offset parameter to functions taking in arrays to account
for this translation.

As a result of outer array sizes leaking into function signatures,
functions taking arrays of different sizes are duplicated according to
how the function is invoked.

Bug: angleproject:3604
Change-Id: Ic9373fd12a38f19bd811eac92e281055a63c1901
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744177
Commit-Queue: James Dong <dongja@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-08-23 16:37:46 +00:00
Shahbaz Youssefi 472c74c60c Translator: Allow tree validation in children of TCompiler
This is to be able to perform validation inside TranslatorVulkan, even
if it's through ASSERTs.

Additionally, every transformation is changed such that they do their
validation themselves.  TIntermTraverser::updateTree() performs the
validation, which indirectly validates many of three tree
transformations.  Some of the more ancient transformations that don't
use this function directly call TCompiler::validateAST.

Bug: angleproject:2733
Change-Id: Ie4af029d34e053c5ad1dc8c2c2568eecd625d344
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1761149
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2019-08-23 14:35:06 +00:00
Jiacheng Lu 24456989e2 Fix incorrect parameter in gl_angle_ext.xml
The first parameter of glGetFramebufferParameterivRobustANGLE should be
`GLenum target`.

Bug: angleproject:3826
Change-Id: Ice4ea265389794a51838d8e61fff774c55588512
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1762714
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jiacheng Lu <lujc@google.com>
2019-08-21 20:07:38 +00:00
Clemen Deng ca8ea0a46a Get Desktop GL games running on desktop frontend
Games:
SkyEngine: Open source on github
The Deep Deep: Geoff's game

Bug: angleproject:3620
Change-Id: I5feee91a94648b385708cafe8d7412e86704ecd0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1721189
Commit-Queue: Clemen Deng <clemendeng@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-08-19 16:01:29 +00:00
James Darpinian 153f3c226c Miscellaneous build fixes for WebKit
Add a USE_SYSTEM_EGL define to allow compilation on Unix systems
without X11.

Feature detect __popcnt using Microsoft-specific _MSC_VER rather than
_M_X64/_M_IX86, which can be set by the Dinkumware stdlib on
non-Microsoft systems.

Apple's clang is too old to have -Wextra-semi-stmt

Ran generate_parser.sh using Cygwin64 bison 3.0.4, flex 2.6.4

Bug: 3439
Change-Id: Ie0d01a112a17f70ef60c120063a958b8f1a094f4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1759135
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
2019-08-17 05:14:36 +00:00
shrekshao cdecd97cee Add Draw base vertex and base instance function entrypoints
Split from https://chromium-review.googlesource.com/c/angle/angle/+/1705035/27

This patch adds entrypoints glDrawArraysInstancedBaseInstanceANGLE,
glDrawElementsInstancedBaseVertexBaseInstanceANGLE,
glMultiDrawArraysInstancedBaseInstanceANGLE,
and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE

Implementation will come in a later separate patch.

Bug: chromium:891861, angleproject:3402
Change-Id: I18e19b850cddd79be4798b9ae7efe0680a050c7f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750125
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-08-16 00:27:22 +00:00
Stuart Morgan 9d737966ac Standardize copyright notices to project style
For all "ANGLE Project" copyrights, standardize to the format specified
by the style guide. Changes:
- "Copyright (c)" and "Copyright(c)" changed to just "Copyright".
- Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1").
- Fixed a small number of files that had no copyright date using the
  initial commit year from the version control history.
- Fixed one instance of copyright being "The ANGLE Project" rather than
  "The ANGLE Project Authors"

These changes are applied both to the copyright of source file, and
where applicable to copyright statements that are generated by
templates.

BUG=angleproject:3811

Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-08-14 23:05:33 +00:00
Shahbaz Youssefi 5a2553a7b6 Vulkan: Emulate subgroup ops in seamful cubemap emulation
Where subgroup ops are not available, they are emulated as such:

Code with subgroup ops:

    float lH = subgroupQuadSwapHorizontal(layer);
    float lV = subgroupQuadSwapVertical(layer);
    float lD = subgroupQuadSwapDiagonal(layer);

    bool isHelperH = subgroupQuadSwapHorizontal(gl_HelperInvocation);
    bool isHelperV = subgroupQuadSwapVertical(gl_HelperInvocation);

    if (gl_HelperInvocation)
    {
        layer = !isHelperH ? lH : !isHelperV ? lV : lD;
    }

Emulated code:

    float nonHelperLayer = gl_HelperInvocation ? 0.0 : layer;
    float lH = abs(dFdxFine(nonHelperLayer));
    float lV = abs(dFdyFine(nonHelperLayer));
    float lD = abs(dFdxFine(lV));

    float isHelperDiffH = abs(dFdxFine(float(gl_HelperInvocation)));
    bool isNonHelperH = isHelperDiffH > 0.5;

    float isHelperDiffV = abs(dFdyFine(float(gl_HelperInvocation)));
    bool isNonHelperV = isHelperDiffV > 0.5;

    if (gl_HelperInvocation)
    {
        layer = isNonHelperH ? lH : isNonHelperV ? lV : lD;
    }

Both paths are supported as on nvidia devices the emulated code
misbehaves.  This change therefore effectively only enables seamful cube
map emulation on Android where subgroup operations are not supported.

Bug: angleproject:3243
Bug: angleproject:3732
Change-Id: I9664d9760756758748183eb121c626f176789f3a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1742222
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2019-08-14 19:45:49 +00:00
Jamie Madill 9e4b116ccc Use official EGL.h.
We upstreamed the changes here so it is no longer necessary to maintain
a fork.

Bug: angleproject:3706
Change-Id: I21cc63cb94f8b3603d75ce8ec86b856514a8cb5d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1749335
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-08-12 21:45:25 +00:00
Shahbaz Youssefi 93560ef51d Vulkan: Seamful cube map emulation
In GLSL, a cube texture is sampled with one of textureCube* functions.
This function takes a 3D coordinate which is a vector from the center of
the cube and identifies a direction to sample from. GLES2.0 has the
following table that translates this 3D coordinate (Rx, Ry, Rz) to a
face and ST coordinates within that face. This table can be found in
Section 3.7.5 (Cube Map Texture Selection).

A compiler pass is implemented in ANGLE that replaces samplerCube
declarations with a sampler2DArray. The textureCube* functions are
replaced with the corresponding texture* functions with the translated
coordinates according to that table.

Gradients provided to textureCubeGrad are translated using the same
formulae, which is not precise but the spec specifies this projection to
be implementation dependent.

Helper invocations enabled through WQM (whole quad mode) cause a
nuisance in that the extrapolated varyings used as coordinates in a
textureCube call could have a different major axis (and therefore face)
from the non-helper invocations that lie within the geometry.
subgroupQuadSwap* operations are used in conjunction with
gl_HelperInvocation to make sure the helper threads calculate texture
UVs in the same face as the non-helper invocations.

Bug: angleproject:3300
Bug: angleproject:3240
Bug: angleproject:3243
Bug: angleproject:3732
Change-Id: I0cb6a9b1f2e1e6a392b5baca1c7118ed1c502ccf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1715977
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2019-08-07 16:16:31 +00:00
Jiacheng Lu ed5f7e4dbc Vulkan: Use a persistent CommandPool
Previously transient CommandPool is used for CommandBuffer allocation,
it is created and destroyed per frame. However, profiling found that
CommandPool destroy is very inefficient. So this commit removed the
previous logic and use two preallocated resetable CommandPools (One for
Primary and One for Secondary)

Bug: angleproject:3508
Change-Id: I8b36f2738b082811c3177935c61b10e01acb6947
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1648667
Commit-Queue: Tobin Ehlis <tobine@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-08-06 19:47:14 +00:00
Tim Van Patten a79c2440f6 Make libEGL function pointers hidden in symbol table
The libEGL_angle.so and libGLESv2_angle.so libraries are typically
loaded into the same process each time, so we need to make sure there
aren't any duplicated symbols which could violate ODR and lead to
crashes or undefined behavior.   In this case, the libEGL_angle.so
function pointer names were colliding with libGLESv2_angle.so function
names, causing crashes at runtime.   The fix here is to mark the
libEGL_angle.so function pointer symbols 'hidden', so they don't appear
in the symbol table for other executables/libraries to see and can't be
overridden by other symbols.

Bug: angleproject:3751
Test: Embed ANGLE within dEQP.apk and verify no crashes
Change-Id: Ibb78369374a4a68b3489a7dd7775c52e29fa37e0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1724909
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-07-30 05:25:19 +00:00
Clemen Deng f2412bca35 Get rendering to texture working
Other small fixes for desktop compatibility

Bug: angleproject:3620
Change-Id: I8e75bce1f850fb891c8bb6e16f79302a6d59276c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1707932
Commit-Queue: Clemen Deng <clemendeng@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-07-26 16:25:02 +00:00
Jonah Ryan-Davis 0716ce0a2c Re-add case to blitframebuffer workaround where src is outside of bounds.
On Mac, blitFramebuffer calls fail if the source region is not enclosed
by the framebuffer. In this case, we must naively clip the source region
and adjust the dest region accordingly. This is slightly different
behavior and may cause issues with scaling so we use a separate
workaround.

Also, Windows NVIDIA has a driver bug that affects Vulkan device
creation after blitting large textures, so it should be included in the
original workaround.

This CL cleans up the workaround to use more helpers from ANGLE and to
generally improve readability.

Bug: chromium:830046
Change-Id: I50bd97449725b738036e6bd3af82362020d7eda8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1713090
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-07-26 15:18:36 +00:00
Jonah Ryan-Davis 7151fe54fe Port adjust_src_dst_region_for_blitframebuffer workaround to ANGLE.
BlitFramebuffer has issues on some platforms with large source/dest
textures. As per the WebGL2 spec, this was caught with validation for
sizes over 2^32, but there is a specific issue on Linux NVIDIA where it
fails on sizes over 2^16. A better workaround (from chromium), resizes
the blitframebuffer call based on the framebuffer size.

Bug: chromium:830046
Change-Id: Ic6196db6228d0d0ac92b12a68bbced76dcbcdf8c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1707115
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-07-22 15:01:34 +00:00
Geoff Lang 6a02f06dfd Implement EGL_ANGLE_create_context_backwards_compatible
This extension allows the user to specify if ANGLE should create a
context of the exact requested version or a higher version context that
is backwards compatible.

BUG=angleproject:3425

Change-Id: I7d0b75cdd7e34a2fc888aa238e1eeb67af82ae0d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1601560
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-07-18 22:51:46 +00:00
Jamie Madill 0efe516eea Fix egl.h compatiblity.
We should include logic for defining EGL prototypes when no other
preference is specified.

Bug: angleproject:3706
Change-Id: Ie1b5ea6150c7c998a9fe71cf5ee7353dca4ae7ba
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1706908
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-07-17 18:50:09 +00:00
Jonah Ryan-Davis aded991bff Fix hang on Linux Intel when allocating large textures.
Intel Linux graphics drivers before kernel 5.0 can hang when allocating
large textures. Limit the texture size as a workaround.

Bug: chromium:927470
Change-Id: Ic8c14235396492efafd663b1cd012fd752427992
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1700146
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-07-12 22:39:03 +00:00
Geoff Lang 2a4f36b14f GL: Work around Intel driver bug when clearing to zeros or ones.
When clearing to zeros or ones on some Intel drivers on Mac, the clear color
would be incorrect.

This replicates the chromium clear_to_zero_or_one_broken workaround.

BUG=angleproject:3672

Change-Id: I0f065420b577bd8f8d931ccdbeeebdcbf9fd08d2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1692977
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-07-12 14:51:47 +00:00
Geoff Lang ecd2e3b152 GL: Reset the texture base level before uploads on Mac.
Reset the base level of textures before call glTexImage on Mac
to prevent driver bugs that cause texture corruption.

BUG=angleproject:3671

Change-Id: I90e94b8395a781a2142ef6be3af1d6117f084152
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1692975
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-07-11 20:41:06 +00:00
Clemen Deng 1d672749e7 WGL implemetation for OpenGL tutorial
Fixes to make WGL implementation work with OpenGL tutorial
- Give directive parser the correct shader spec when on Desktop GL
- Minor changes to parse Desktop GL shaders
- Moved clientType parameter from Context to Context->mState
- Minor fixes to WGL functions

Bug: angleproject:3666
Change-Id: I01ddb828f6d581ad445f49942589436849eae5d9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1693244
Commit-Queue: Clemen Deng <clemendeng@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-07-11 15:58:50 +00:00
shrekshao cdab03aa93 Add flags to shader translator to emulate gl_BaseVertex and gl_BaseInstance
Adds support for translating gl_BaseVertex and gl_BaseInstance for implementation of
GL_ANGLE_base_vertex_base_instance.

They will only be available in WebGL 2. Since there's no gl_VertexID and
gl_InstanceID in WebGL 1. It won't be very useful to add them to WebGL
1.

Mostly follow pattern of gl_DrawID of GL_multi_draw

BUG=angleproject:3402,chromium:891861

Change-Id: Ifcd990c52d12f6814127b904e61a779b8d382e0c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666361
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-07-11 01:38:25 +00:00
Cody Northrop 4fbbdb15d6 texture3D: Compiler changes for sampler3D
Bug: angleproject:3188
Change-Id: Iac1408f8b91c6a6610a63cef236205b7dcdbd2c4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1682781
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Cody Northrop <cnorthrop@google.com>
2019-07-03 17:01:31 +00:00
Cody Northrop 5faff91af4 texture3D: Codegen changes towards OES_texture_3D
Also accompanying hand edits to validationES2.cpp and
Context.cpp to allow linking.

Bug: angleproject:3188
Change-Id: I89832265092fabc71bade464f0171d65038d8b0e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1648454
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-07-01 14:15:07 +00:00
Jiacheng Lu f116aa9c15 Vulkan: detect swapchain recreation passively
Currently ANGLE vulkan query current window size every frame to detect
whether a swapchain recreation is needed, however profiling shows some
bottle neck on window size query on X11. So here removing the per frame
window size query and only depend the result of vkAcquireImage and
VkQueuePresent to detect a need for swapchain recreation.

Bug: angleproject:3535
Change-Id: I4ddf70b973d78dfcd5f8fab28e29e802edad1b2d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1662759
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Ian Elliott <ianelliott@google.com>
Commit-Queue: Ian Elliott <ianelliott@google.com>
2019-06-28 23:41:14 +00:00
Geoff Lang 2074d5f764 GL: Clamp uniform array access on Android and AMD devices.
Chrome used to clamp it everywhere but in practice it is only needed on
these devices.

TEST=conformance/uniforms/out-of-bounds-uniform-array-access.html

Change-Id: Idffe84023f8b27733bfda209edd59bbb220b5c0c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1680054
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-06-28 14:10:45 +00:00
Shahbaz Youssefi 0bfa55044f Vulkan: Emulate Transform Feedback with vertex shader output
In ES 3.0 and 3.1, only non-indexed GL_POINTS, GL_LINES and GL_TRIANGLES
is supported for transform feedback.  Without tessellation and geometry
shaders, we can calculate the exact location where each vertex transform
output should be written on the CPU, and have each vertex shader
invocation write its data separately to the appropriate location in the
buffer.

This depends on the vertexPipelineStoresAndAtomics Vulkan feature.

Bug: angleproject:3205
Change-Id: I68ccbb80aece597cf20c557a0aee842360fea593
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1645678
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-06-27 20:36:53 +00:00
Geoff Lang 5ff8cae9bc GL/D3D: Use texture uploads instead of clearing for robust init.
Chrome uses regular texture uploads on all platforms except OpenGL on
Mac to do robust resource init for textures because multiple bugs have
been observed with texture corruption.

BUG=883276
BUG=882580
BUG=941620

Change-Id: I5fcd6862147822a08c7533e6a6a9277223034ebd
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1669104
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-06-25 17:24:33 +00:00
Geoff Lang 647f200016 Limit max texture size and max MSAA samples on Android.
Android devices will often fail to allocate textures this large and it is
prefereable to return an error from ANGLE instead of losing the context
due to an out of memory error.

This mirrors the limits Chrome applies with the max_texture_size_limit_4096
and max_msaa_sample_count_4 workarounds that are broadly applied to Android.

BUG=882580

Change-Id: I63890baa8712f13b37c607fa475432e67e9384a4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1351357
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-06-21 19:53:39 +00:00
Geoff Lang bce4b9f857 Always scalarize mat and vec constructor arguments.
This workaround is always enabled in Chrome, do the same in ANGLE.

BUG=882580

Change-Id: I2c01f34a589b07bd0035d7408be884f7a51b1706
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666699
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-06-21 18:53:59 +00:00
Geoff Lang 857880e5b8 GL: Add extensions to enable hardware video decode on Android.
The Android SurfaceTexture API has to be initialized with a texture id
which Chrome has to query from an ANGLE external texture. It also
rebinds and sets the texture dimensions on calls to
SurfaceTexture.updateTexImage so ANGLE must be notified about these
changes so that state tracking and validation continue to function.

BUG=967410

Change-Id: I92e9077f75835b088da3a8caffb3ff40e9ad0361
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1630293
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-06-18 21:10:07 +00:00
Sunny Sachanandani f9686af021 Add support for D3D11 texture backed EGLImages
Implement EGL_ANGLE_image_d3d11_texture extension.  Images created with
this extension might not be renderable based on bind flags and resource
usage of the client provided texture in which case attaching them to a
framebuffer won't succeed.

The intended use case is to bind the front and back buffers of a swap
chain to GL textures that can be used for rendering in the case of the
back buffer and as a shader input for the front buffer.

Bug: chromium:939655
Change-Id: Ic3328e831880292217b88be84740740df6031fa6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1646732
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-06-18 20:14:17 +00:00
Jonah Ryan-Davis eee67c6ec2 Fix Platform.h integration with ANGLE
A function was renamed which broke the platformMethods table strings.
This CL reverts the rename (originally from crrev/c/1660952)

Bug: angleproject:1621
Change-Id: I8121a4956ba1d3e3c5036f72f6f1fdf5509dc491
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1664792
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2019-06-18 19:05:07 +00:00
Jonah Ryan-Davis beb0eb2d8c Clean up workarounds/features to single location.
Rename all workarounds structs to features, and move the lists to a
shared location in include/platform (to help with documentation,
see:
https://cs.chromium.org/chromium/src/ui/gl/gl_switches.cc?sq=package:chromium&g=0&l=69)

Bug: angleproject:1621
Change-Id: I4069f08131db5e886047a007efb5d7764dfee5f2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660952
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-06-17 19:44:51 +00:00
Jonah Ryan-Davis fce1e2d1e2 Extend eglGetPlatformDisplay to allow feature overrides.
Add EGL_FEATURE_OVERRIDES_ENABLED_ANGLE and
EGL_FEATURE_OVERRIDES_DISABLED_ANGLE to submit lists of strings naming
the features that should be overridden (either enabled or disabled) on
display creation.

Bug: angleproject:1621
Change-Id: I4bb75c5dbab0e3b701a72069c38f8c60ecfffad2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1646595
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-06-12 14:01:50 +00:00
Shahbaz Youssefi b407e1a0b5 Vulkan: implement ES3 blit
Augment the resolve shaders to be able to stretch and blit too.  The
UtilsVk resolve function is accordingly expanded to include blit.

Bug: angleproject:3200
Change-Id: I30b172a5e388089735ab494f55cbfdc2781a8bf9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1635753
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-06-07 14:25:25 +00:00
Jonah Ryan-Davis e431aaa15a Rename EGL_ANGLE_workaround_control to EGL_ANGLE_feature_control.
For consistency, call these ANGLE "features", a subset of which may be
workarounds. Also, whether the feature is enabled/disabled should be
publically visible as "status".

Bug: angleproject:1621
Change-Id: I0de90a932fbfe1fc9b59138153d616d29fa7268b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1643410
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2019-06-04 18:51:44 +00:00
Jonah Ryan-Davis 2dd40a44d1 Add eglQueryDisplayAttribANGLE to query workarounds count.
Add eglQueryDisplayAttribANGLE based on eglQueryDisplayAttribEXT to add
behavior for quering the count of all workarounds available. Used
externally to build a list of workarounds.

Bug: angleproject:1621

Change-Id: I793acedc76111fd018600169d58bf5d8cf4a63ee
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1637817
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-06-03 22:36:28 +00:00
Jonah Ryan-Davis f52f2637ae Add EGL_ANGLE_workaround_control extension.
This extension is used to query strings from an array based on index,
which will be used to query all the information about workarounds in
ANGLE.

Bug: angleproject:1621

Change-Id: I27157f278f7f17c92c8b4fd7753e2a5ecd0528f6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1627723
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-05-29 19:39:42 +00:00
Shahbaz Youssefi f2a1c384f7 Vulkan: Implement multisampled framebuffers
Simultaneously implements ANGLE_framebuffer_multisample and ES3
multisampled framebuffers.

Additionally, implements ES3 framebuffer blitting where multisampled
framebuffers are involved.

Bug: angleproject:3203
Bug: angleproject:3204
Bug: angleproject:3200
Change-Id: I5694a30f71168e807688a9568e3742b81d907918
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1622667
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2019-05-29 15:28:49 +00:00
Jonah Ryan-Davis 46fe0e4be9 Cleanup Features headers.
Cleanup redundant angle:: prefix in Features headers.
Cleanup workaround descriptions.

Bug: angleproject:1621
Change-Id: I4325d3603877efee9c6a035cd5b5bbbbc4f5c169
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1625609
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
2019-05-28 14:30:19 +00:00
Jeff Gilbert d9fa0744e8 Emit OVR_multiview2 on ESSL/GLSL outputs.
Add ARB_shader_viewport_layer_array support to
SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER.

Bug: angleproject:3404
Change-Id: Ia89517d0cc92400ce47c9118e8c1abf8285aec41
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1585452
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-05-23 14:21:14 +00:00
Courtney Goeltzenleuchter eaf2d928e6 Add support for OES_depth_texture
Note: Includes workaround for http://anglebug.com/3452 - some Android
devices do not indicate filtering support on VK_FORMAT_D16_UNORM.

Bug: angleproject:3103
Test: angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.DepthTexture/*
angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.PackedDepthStencil/*
angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.DepthTextureRender/ES2_VULKAN

Change-Id: Ic325fb94ab0e619a17c2e149e0e0865fa4142f3a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575426
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-05-15 16:47:37 +00:00
Geoff Lang bff32703c7 D3D11: Disable B5G6R5 on AMD drivers.
Texture data corruption has been seen with this format, specifically
on AMD Radeon R7 240 cards with the 15.201.1301.0 driver.

BUG=941620

Change-Id: I42d0d86a8319afdfaf17b44e142c6414092c647d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610681
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
2019-05-15 00:42:47 +00:00
Shahbaz Youssefi 9d519ab1e3 Vulkan: Rework layout block storage conversion
Previously, a pass over the shader was made, converting shared and
packed interface blocks with block storage to std140.  This resulted in
link success between interface blocks with different storage as they
were all translated to std140.

With this change, this pass is removed.  The link step proceeds with the
block storage specifiers as seen by GLES, and only upon Vulkan GLSL
shader generation "shared" and "packed" are converted to std140.

Bug: angleproject:3199
Change-Id: I069415ab9c9b4e1034bc00f64cd2d9e2d73f5956
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1605262
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-05-13 17:15:16 +00:00
Jonah Ryan-Davis 776694cdad Change all ANGLE workarounds to use struct definition with info.
Change each workaround from a simple bool to a struct with info
including name, workaround set, description, and bug IDs. This will help
with future workaround integration with Chrome.

Bug: angleproject:1621
Change-Id: Ia27c180abaf845e280060c803e5994cc3152a057
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593917
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-05-09 21:05:59 +00:00
Mingyu Hu ebab670cb3 Adding new extension GL_OVR_multiview
GL_OVR_multiview functions exactly the same as GL_OVR_multiview2.
All GL_OVR_multiview2 tests now also repeat the same test using GL_OVR_multiview

Bug: angleproject:3341
Change-Id: I7e5294fb6bbf7692535174a15da6a42e1b5fc4e2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575904
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-05-08 23:14:55 +00:00
Ian Elliott 19905aea14 Vulkan: Set the Vulkan scissor to the GLES viewport
Some Vulkan drivers are not clipping rendering that is outside of the viewport,
and the Vulkan spec has some language that indicates that ANGLE should set the
scissor:

  The application must ensure (using scissor if necessary) that all rendering
  is contained within the render area.

In this case, ANGLE is "the application".

Bug: angleproject:3253
Bug: angleproject:3254
Change-Id: I6885a3aa6daed57f6ae1c3d974663d763cad10c9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1553973
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Ian Elliott <ianelliott@google.com>
2019-05-08 00:44:23 +00:00
Shahbaz Youssefi 216f73d00f Vulkan: add uniform buffer object support
Support for layout qualifiers in interface blocks are added.  All
interface blocks are adjusted to either be in std140 or std430.

In the Vulkan backend, a new descriptor set is added for UBOs.  A dirty
bit is added for UBO updating and pipeline layouts and descriptor
bindings are updated.

Bug: angleproject:3199, angleproject:3220
Change-Id: I271fc34ac2e1e8b76dee75e54a7cff0fe15fe4ee
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565061
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-05-07 18:12:37 +00:00
Kenneth Russell 51386f4a5e Reland "Define and expose EGL_ANGLE_power_preference extension."
This is a reland of ac58e63295

The original CL was reverted in a rush because I thought there was an
uninitialized variable bug, but upon later re-review this turned out to
not be the case.

Original change's description:
> Define and expose EGL_ANGLE_power_preference extension.
>
> Allows application to select the integrated or discrete GPU on
> dual-GPU macOS systems.
>
> Tested by modifying the example program at:
> https://github.com/grorg/ANGLEIOSurfaceTest
>
> and verifying that both integrated and discrete GPUs can be selected.
> (The changes to that program will be upstreamed once some build issues
> are resolved.)
>
> Bug: 2813
> Change-Id: Ibeb17778512896456d220e9bc4cf8f222aa57057
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1570081
> Commit-Queue: Kenneth Russell <kbr@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

Bug: 2813
Tbr: geofflang@chromium.org
Tbr: cwallez@chromium.org
Change-Id: Iea000dd718f4f4b4f57237adb1dc44381b10106b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575419
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
2019-04-19 07:22:23 +00:00
Kai Ninomiya 145ec7fa7c Revert "Define and expose EGL_ANGLE_power_preference extension."
This reverts commit ac58e63295.

Reason for revert: Revert on kbr's request: "has an uninitialized variable bug"

Original change's description:
> Define and expose EGL_ANGLE_power_preference extension.
> 
> Allows application to select the integrated or discrete GPU on
> dual-GPU macOS systems.
> 
> Tested by modifying the example program at:
> https://github.com/grorg/ANGLEIOSurfaceTest
> 
> and verifying that both integrated and discrete GPUs can be selected.
> (The changes to that program will be upstreamed once some build issues
> are resolved.)
> 
> Bug: 2813
> Change-Id: Ibeb17778512896456d220e9bc4cf8f222aa57057
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1570081
> Commit-Queue: Kenneth Russell <kbr@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

TBR=geofflang@chromium.org,kbr@chromium.org,cwallez@chromium.org

Change-Id: Icb936d91eec70deb825585da3ff8835ca2794736
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 2813
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575134
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-04-19 01:50:45 +00:00
Kenneth Russell ac58e63295 Define and expose EGL_ANGLE_power_preference extension.
Allows application to select the integrated or discrete GPU on
dual-GPU macOS systems.

Tested by modifying the example program at:
https://github.com/grorg/ANGLEIOSurfaceTest

and verifying that both integrated and discrete GPUs can be selected.
(The changes to that program will be upstreamed once some build issues
are resolved.)

Bug: 2813
Change-Id: Ibeb17778512896456d220e9bc4cf8f222aa57057
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1570081
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-04-19 01:40:32 +00:00
Geoff Lang 057b76e149 Implement GL_CHROMIUM_lose_context.
This is useful for testing context lost behaviour.

BUG=angleproject:3379

Change-Id: If0e1538553b1761e313fc36ccde5138cd495200f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1566141
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
2019-04-17 15:48:14 +00:00
Mingyu Hu 7d64c4863d GL_ANGLE_multiview has been renamed to GL_OVR_multiview2.
changes include:
1) GL_OVR_multiview to GL_OVR_multiview2 extension directive change
2) Removal of all references to side by side. We no longer support multiple views in a single 2DTexture. Only 2DTextureArray's are supported
3) WebGL 2 (ES3) is required for multiview

Bug: angleproject:3341
Change-Id: Ie0c1d21d7610f8feebdb2e4d01c6947f57e69328
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552023
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-04-16 17:37:10 +00:00
Michael Spang a0b00e979f Vulkan: Expose GL_EXT_memory_object_fd & GL_EXT_semaphore_fd
If the vulkan driver has support for VK_KHR_external_memory_fd or
VK_KHR_external_semaphore_fd, add the GL versions of these to the vulkan
renderer's extensions.

Bug: angleproject:3289

Change-Id: I7f04b5cf883f93f6ccd579c2b75d6831b854bfd0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552027
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-04-10 16:07:24 +00:00
Michael Spang 9de3ddb511 Generate entrypoints for GL_EXT_memory_object_fd & GL_EXT_semaphore_fd
This adds entrypoints for the Linux variants of GL_EXT_memory_object &
GL_EXT_semaphore.

Bug: angleproject:3289

Change-Id: I40de40f27aa82cd9479d5913dac0a7493919bb8f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552026
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-04-05 04:44:47 +00:00
Michael Spang 7a8c3e5ebe Generate entrypoints for GL_EXT_memory_object & GL_EXT_semaphore
This adds entrypoints for two new extensions that will be useful for
importing external Vulkan objects into ANGLE.

Bug: angleproject:3289

Change-Id: I206dc76eda5c6c8d836db7c6413c5544326aa722
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552024
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-04-04 23:42:53 +00:00
Shahbaz Youssefi 27f115aa0b Vulkan: clean up framebuffer clear
The Qualcomm bug workaround is changed such that clears still go through
the render pass loadOp, but the render pass is immediately closed.  This
allows us to remove a few fallback methods.

Bug: angleproject:2361
Change-Id: I24c3884a183f8bb40673e922773f70faffad848f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1545524
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
2019-04-04 20:37:32 +00:00
Shahbaz Youssefi 0c128e15be Vulkan: Use render pass ops to clear images when possible
On tiling GPUs, render pass loadOp and stencilLoadOp can be used to very
cheaply clear an image as it is being render to.  This change uses this
feature to clear render targets when possible.

Bug: angleproject:2361
Change-Id: Ic4bdc908873f4802760d549f4893f84a47beac0f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1500576
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-03-28 15:26:31 +00:00
Enrico Galli ee7ffd9ebb ES31: Enabling skipped deqp atomic counter tests on D3D11
Enabling deqp tests previously skipped due to lack of atomic counters. Fixing
bug found in translator found by new tests.

* Switching atomicCounterDecrement from pre to post decrement
* Added 4 byte alignment check to atomic_uint offset
* Added workaround for NVIDIA D3D bug
* Added globallycoherent to atomic counters

Bug: angleproject:1729
Change-Id: If62ea003826fbe2df0834b905ff3ad7b76328399
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1480867
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-03-26 00:15:34 +00:00
Yuly Novikov 1581ff030b Vulkan: disable VK_PRESENT_MODE_FIFO_KHR on Linux Intel
Causes random timeouts.

Bug: angleproject:2932, angleproject:3153
Change-Id: I69a200684afab9e00642850bfa8e8efd0da5ad1d
Reviewed-on: https://chromium-review.googlesource.com/c/1495229
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@google.com>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2019-03-01 04:46:28 +00:00
Geoff Lang 009696c561 Vulkan: Support EGL_ANDROID_image_native_buffer on Android.
BUG=angleproject:2668
BUG=angleproject:3121

Change-Id: I0dfb2ec0737ebd963b0fadb78cf720a90874f00b
Reviewed-on: https://chromium-review.googlesource.com/c/1452264
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-02-26 22:05:33 +00:00
Jonah Ryan-Davis 2b0553ce59 Implement EXT_instanced_arrays
Bug: angleproject:3015
Change-Id: Ib01cc5e0df6db27981cb843a6bd386de5d10c2db
Reviewed-on: https://chromium-review.googlesource.com/c/1452740
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2019-02-08 20:40:08 +00:00
Jamie Madill c09ae15c08 Enable -Wextra-semi and -Wextra-semi-stmt.
This will prevent users from accidentally making semicolon errors in
the future.

Bug: chromium:926235
Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9
Reviewed-on: https://chromium-review.googlesource.com/c/1446493
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2019-02-01 21:53:28 +00:00
Qin Jiajia 1521442384 ES31: Add top_level_array_stride support
Bug: angleproject:1920
Change-Id: Id18c6cc1bb840c05f73a019156c462886f01d9eb
Reviewed-on: https://chromium-review.googlesource.com/c/1396745
Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-18 11:12:27 +00:00
Jeff Gilbert 465d6090cd Add GL_ANGLE_provoking_vertex on D3D11 and GL.
This extension is a subset of GL_ARB_provoking_vertex without the
QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION query.

Bug: angleproject:2829
Change-Id: I907a4d16b7b13d3bbfb948842091eedd7b6a8b77
Reviewed-on: https://chromium-review.googlesource.com/c/1410289
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-01-16 20:32:14 +00:00
Jamie Madill ab2bfa814c Enable Chromium clang style plugin for libANGLE.
This fixes a few style warnings:

 * auto should not deduce to raw pointer type
 * inlined virtual methods are not allowed
 * non-trivial constructors and destructors should be explicit
 * inlined non-trivial constructors should not be in-class
 * missing override keywords

Bug: angleproject:3069
Change-Id: I3b3e55683691da3ebf6da06a5d3c729c71b6ee53
Reviewed-on: https://chromium-review.googlesource.com/c/1407640
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2019-01-16 01:44:15 +00:00
Xinghua Cao f3179a6a17 ES31: Implement bindImageTexture binds a single layer on D3D backend
Dynamically generate image2D variables' declaration and function
definition in libANGLE.

Bug: angleproject:1987
TEST=angle_end2end_tests.ComputeShaderTest.*

Change-Id: Idacc756f7bd15f22eccb1d689e18e997f3e74159
Reviewed-on: https://chromium-review.googlesource.com/c/1142885
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
2019-01-15 03:42:50 +00:00
Shahbaz Youssefi 4f3b207d04 Vulkan: Shader path for texture-to-texture copy
This change implements glCopy[Sub]TextureCHROMIUM in GPU.  As with the
previous change implementing glCopyTex[Sub]Image2D, it currently only
selects the shader path if the texture is already defined.

Bug: angleproject:2958
Change-Id: Ia1b5625f92e6c9f91807c9b601e5c34d2d5e5c30
Reviewed-on: https://chromium-review.googlesource.com/c/1392394
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2019-01-09 04:07:30 +00:00
Jamie Madill 1f56ed2a9b Add WGLWindow and WGL test configs.
WGLWindow lets us use a Windows driver's bindings instead of ANGLE.
This only works if the underlying driver supports OpenGL ES
compatibility.

Also adds the WGL headers, WGL XML, and a specialized WGL loader.

Because of a small driver issue with NVIDIA I added a retry for the WGL
Window initialization.

Bug: angleproject:2995
Change-Id: Ie5148ece470dd03df33015f4919ad1fa79a859ec
Reviewed-on: https://chromium-review.googlesource.com/c/1366021
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2019-01-03 21:35:24 +00:00
Jamie Madill ba319ba31c Re-land "Load entry points dynamically in tests and samples."
Fixes the Android/ChromeOS/Fuchsia builds by using consistent EGL
headers.

This CL adds a dynamic loader generator based on XML files. It also
refactors the entry point generation script to move the XML parsing
into a helper class.

Additionally this includes a new GLES 1.0 base header. The new
header allows for function pointer types and hiding prototypes.

All tests and samples now load ANGLE dynamically. In the future this
will be extended to load entry points from the driver directly when
possible. This will allow us to perform more accurate A/B testing.

The new build configuration leads to some tests having more warnings
applied. The CL includes fixes for the new warnings.

Bug: angleproject:2995
Change-Id: I5a8772f41a0f89570b3736b785f44b7de1539b57
Reviewed-on: https://chromium-review.googlesource.com/c/1392382
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2019-01-01 18:56:45 +00:00
Yuly Novikov 9f088621eb Revert "Load entry points dynamically in tests and samples."
This reverts commit 03923558a7.

Reason for revert: fails compilation on Android, ChromeOS and Fuchsia during roll https://chromium-review.googlesource.com/c/chromium/src/+/1392624

Original change's description:
> Load entry points dynamically in tests and samples.
> 
> This CL adds a dynamic loader generator based on XML files. It also
> refactors the entry point generation script to move the XML parsing
> into a helper class.
> 
> Additionally this includes a new GLES 1.0 base header. The new
> header allows for function pointer types and hiding prototypes.
> 
> All tests and samples now load ANGLE dynamically. In the future this
> will be extended to load entry points from the driver directly when
> possible. This will allow us to perform more accurate A/B testing.
> 
> The new build configuration leads to some tests having more warnings
> applied. The CL includes fixes for the new warnings.
> 
> Bug: angleproject:2995
> Change-Id: I6726d4163f7a6e54d2482f094c0a952f59702a05
> Reviewed-on: https://chromium-review.googlesource.com/c/1359516
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>

TBR=ynovikov@chromium.org,jmadill@chromium.org,syoussefi@chromium.org

Change-Id: I902bec2d733c2b879be29c02ab52a0b7d4eaa077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:2995
Reviewed-on: https://chromium-review.googlesource.com/c/1392381
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2018-12-29 20:46:23 +00:00
Jamie Madill 03923558a7 Load entry points dynamically in tests and samples.
This CL adds a dynamic loader generator based on XML files. It also
refactors the entry point generation script to move the XML parsing
into a helper class.

Additionally this includes a new GLES 1.0 base header. The new
header allows for function pointer types and hiding prototypes.

All tests and samples now load ANGLE dynamically. In the future this
will be extended to load entry points from the driver directly when
possible. This will allow us to perform more accurate A/B testing.

The new build configuration leads to some tests having more warnings
applied. The CL includes fixes for the new warnings.

Bug: angleproject:2995
Change-Id: I6726d4163f7a6e54d2482f094c0a952f59702a05
Reviewed-on: https://chromium-review.googlesource.com/c/1359516
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
2018-12-29 16:24:36 +00:00
Jamie Madill 8c78ce4bd3 Use visitor pattern for Shader Variable APIs.
In many places in ANGLE we need to traverse a ShaderVariable tree. We
do this to store uniform offset and other information, to flatten the
tree of uniforms for the front-end, or to produce active variable lists
for uniform and shader storage blocks. In each case, we would write
separate tree traversal code.

This patch introduces a shared visitor pattern for all of the shader
variable tree traversal instances. With that get more common code. Also
it is easier to write new variable traversals. ProgramD3D and
ProgramLinkedResources in particular get nice simplificiations.

The visitor object recieves callbacks from the traversal when entering
structs, array elements, and new variables. The visitor can treat these
differently depending on the use case. A common visitor that constructs
full variable names is used as a base class in several places.

Also moves the 'isRowMajorLayout' from sh::InterfaceBlockField to
sh::ShaderVariable. This allows us to forgo using templates in several
call sites.

Bug: angleproject:3024
Change-Id: I472d81ec775e2eee92fb3d2eb0ca83860221ba2e
Reviewed-on: https://chromium-review.googlesource.com/c/1358722
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2018-12-29 08:04:48 +00:00
Ian Elliott bcb7890895 Implement eglSwapBuffersWithDamage on top of VK_KHR_incremental_present
Bug: angleproject:2510
Change-Id: I12b0877f787dbcb48e2890f54ba4bc8ebe8294b4
Reviewed-on: https://chromium-review.googlesource.com/c/1383373
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Ian Elliott <ianelliott@google.com>
2018-12-20 17:09:46 +00:00
Jamie Madill 4638dc9def Re-land "Load correct libGLESv2 on Linux and Mac."
Re-land fixes build to ensure commit_id is built before libEGL.

libEGL was implicitly loading libGLESv2 on startup. This is bad
because on platforms like Linux and Mac we could sometimes use the
incorrect rpath. This in turn meant we needed workarounds like using
"_angle" extensions to our shared objects to get the correct loading
behaviour.

Fix this by loading libGLESv2 dynamically in libEGL. We build the
loader automatically from egl.xml. The loader itself is lazily
initialized on every EGL entry point call. This is necessary because
on Linux, etc, there is no equivalent to Windows' DLLMain.

We also use an EGL.h with different generation options so we have the
proper function pointer types. A README is included for instructions
on how to regenerate EGL.h.

The entry point generation script is refactored into a helper class
that is used in the loader generator. Also adds the libGLESv2 versions
of the EGL entry points in the DEF file on Windows. This allows them to
be imported properly in 32-bit configurations.

Also fixes up some errors in ANGLE's entry point definitions. Also
includes a clang-format disable rule for the Khronos headers.

This CL will help us to run ANGLE tests against native drivers.

Bug: angleproject:2871
Bug: chromium:915731
Change-Id: I4192a938d1f4117cea1bf1399c98bda7ac25ddab
Reviewed-on: https://chromium-review.googlesource.com/c/1380511
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2018-12-18 18:54:44 +00:00
Yuly Novikov 175d918a1f Revert "Load correct libGLESv2 on Linux and Mac."
This reverts commit dd815b623e.

Reason for revert: Broke https://luci-milo.appspot.com/p/chromium/builders/luci.chromium.ci/win-rel/8006

Original change's description:
> Load correct libGLESv2 on Linux and Mac.
> 
> libEGL was implicitly loading libGLESv2 on startup. This is bad
> because on platforms like Linux and Mac we could sometimes use the
> incorrect rpath. This in turn meant we needed workarounds like using
> "_angle" extensions to our shared objects to get the correct loading
> behaviour.
> 
> Fix this by loading libGLESv2 dynamically in libEGL. We build the
> loader automatically from egl.xml. The loader itself is lazily
> initialized on every EGL entry point call. This is necessary because
> on Linux, etc, there is no equivalent to Windows' DLLMain.
> 
> We also use an EGL.h with different generation options so we have the
> proper function pointer types. A README is included for instructions
> on how to regenerate EGL.h.
> 
> The entry point generation script is refactored into a helper class
> that is used in the loader generator. Also adds the libGLESv2 versions
> of the EGL entry points in the DEF file on Windows. This allows them to
> be imported properly in 32-bit configurations.
> 
> Also fixes up some errors in ANGLE's entry point definitions. Also
> includes a clang-format disable rule for the Khronos headers.
> 
> This CL will help us to run ANGLE tests against native drivers.
> 
> Bug: angleproject:2871
> Change-Id: Id6ecf969308f17b1be4083538428c9c1a1836572
> Reviewed-on: https://chromium-review.googlesource.com/c/1370725
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>

TBR=ynovikov@chromium.org,geofflang@chromium.org,jmadill@chromium.org

Change-Id: I921b3c45435ab4f05cbc2d1c1172b4185d6257b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:2871
Reviewed-on: https://chromium-review.googlesource.com/c/1378887
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2018-12-16 19:53:36 +00:00
Jamie Madill dd815b623e Load correct libGLESv2 on Linux and Mac.
libEGL was implicitly loading libGLESv2 on startup. This is bad
because on platforms like Linux and Mac we could sometimes use the
incorrect rpath. This in turn meant we needed workarounds like using
"_angle" extensions to our shared objects to get the correct loading
behaviour.

Fix this by loading libGLESv2 dynamically in libEGL. We build the
loader automatically from egl.xml. The loader itself is lazily
initialized on every EGL entry point call. This is necessary because
on Linux, etc, there is no equivalent to Windows' DLLMain.

We also use an EGL.h with different generation options so we have the
proper function pointer types. A README is included for instructions
on how to regenerate EGL.h.

The entry point generation script is refactored into a helper class
that is used in the loader generator. Also adds the libGLESv2 versions
of the EGL entry points in the DEF file on Windows. This allows them to
be imported properly in 32-bit configurations.

Also fixes up some errors in ANGLE's entry point definitions. Also
includes a clang-format disable rule for the Khronos headers.

This CL will help us to run ANGLE tests against native drivers.

Bug: angleproject:2871
Change-Id: Id6ecf969308f17b1be4083538428c9c1a1836572
Reviewed-on: https://chromium-review.googlesource.com/c/1370725
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
2018-12-16 14:04:28 +00:00