Commit Graph
422 Commits
Author SHA1 Message Date
Olli Etuaho 4ebd8f3d99 Fix issues with clearing deleted attachments
Deleting an object that was acting as a framebuffer color attachment
in the current framebuffer didn't previously update all of the
framebuffer state correctly. Fix this by going through the usual
resetAttachment path when any framebuffer attachment is deleted
instead of having custom code that only updated part of the state.

Also early out from clearbuffer calls in case of a missing color
buffer - even now that the draw buffer mask is being updated correctly,
some backend code doesn't take it into account. One example is
querying attachment format when the SRGB clear for linear framebuffer
attachments workaround is active.

BUG=angleproject:2831
TEST=angle_end2end_tests

Change-Id: I1071a60dc0251946fed00e88e43a244fe59f4863
Reviewed-on: https://chromium-review.googlesource.com/1235656
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-09-25 05:19:53 +00:00
Jamie Madill 77db6f4af1 Use global Context lookup in single-threaded cases.
In single-threaded cases we don't need to use a TLS lookup for the
current Context.

Assume a global context has 3 states: unset, set, and multi-threaded:

* global context unset -> set the global context
* global context set, matches TLS context -> set the global context
* global context set, doesn't match TLS -> set multi-threaded
* global context multi-threaded -> leave it

This also inlines the global context/TLS check into global_state.h.
Increases performance of the binding perf overhead test by up to 25%
and the draw call perf test by up to 3%.

Bug: angleproject:2824
Change-Id: Ib95953ca918f2408fe72ca83061f4e2d1bd1adad
Reviewed-on: https://chromium-review.googlesource.com/1231993
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-09-24 02:01:01 +00:00
Olli Etuaho ab5fb5edb1 Reland "Support EXT_blend_func_extended in the GLES2 context"
This re-lands EXT_blend_func_extended implementation. A lot of the
implementation has been rewritten on top of changes that have been
done since the last attempt.

For now we only expose the extension on desktop GL. To support GLES,
we'd need to investigate what's the most robust way to handle the
compiler output and make the binding of the fragment outputs
conditional.

The extension is disabled on AMD and Intel because of test failures.

BUG=angleproject:1085
TEST=angle_end2end_tests

Change-Id: I619ae3162769b90aad095ddec158ce6c57a114a8
Reviewed-on: https://chromium-review.googlesource.com/1233713
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-09-21 06:49:32 +00:00
Jamie Madill e25b800611 Move sampler sync out of syncProgramTextures.
We only need to call the syncState for samplers when they are dirty.
Also includes changes to refactor out the sampler sync in GL. Adds
observer bindings so sampler sync is handled correctly in resource
sharing scenarios.

Bug: angleproject:2763
Change-Id: I762f0738ee7572ae29ce6bd5384a30aa9588c848
Reviewed-on: https://chromium-review.googlesource.com/1227797
Reviewed-by: Shahbaz Youssefi <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-21 05:32:45 +00:00
Olli Etuaho dbce1f890a Fix trying to clear nonexistent FBO attachments
The D3D11 backend used to crash to a null pointer dereference if a
glClearBuffer call was done on a nonexistent depth or stencil
attachment. Validate for these conditions so that the backend can't
crash in this case.

BUG=angleproject:2827
TEST=angle_end2end_tests

Change-Id: Iecee78d213d11d492d52f246b4b068e8b6f34244
Reviewed-on: https://chromium-review.googlesource.com/1233675
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-09-19 18:30:59 +00:00
Olli Etuaho 2c8f084543 Add ANGLE_multiview_multisample
We add a novel multiview multisampling extension that includes the
requirement to explicitly resolve the multisampled framebuffer. The
explicit resolve is much more straightforward to implement on top of
OpenGL and D3D11 than implicit resolve found in the native extension
OVR_multiview_multisampled_render_to_texture. It also has predictable
performance characteristics.

The extension allows multiview drawing to 2D multisample texture
arrays and is now enabled on both the GL backend and the D3D11
backend. The implementation is fairly simple, as it involves just
small changes in validation to allow multisampled framebuffer
attachments. The multiview rendering logic is exactly the same
regardless of whether multisampling is enabled.

For the most part the same tests are used to test both multisampled
and non-multisampled rendering. The tests will use a different
framebuffer setup depending on the test param. They resolve the
multisampled framebuffer to a non-multisampled framebuffer prior to
any readbacks from the framebuffer.

Some of the tests are adjusted so that they have the correct sub-pixel
positioning of multisampled quads, so there won't be any pixels that
would be just partially covered.

The tests don't have any tolerance for partially covered pixels - if
we find any platforms where the tests run into a sub-pixel positioning
corner case, tolerance may need to be added later.

BUG=angleproject:2775
TEST=angle_end2end_tests

Change-Id: I590d7f300a92ea5439f2720d9db14a7976db2e1d
Reviewed-on: https://chromium-review.googlesource.com/1221214
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-09-19 13:19:40 +00:00
jchen10 99118c1c1d Improve dirtybits for compute
For D3D11 backend, dirtybits are used to sync and update state
for compute.
For GL backend, mProgramUniformBuffersDirty,
mProgramAtomicCounterBuffersDirty, mProgramImagesDirty are newly
applied.

Bug: angleproject:2814

Change-Id: Ia459ca26705b7c685179d64e0c934535bf16741f
Reviewed-on: https://chromium-review.googlesource.com/1215245
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jie A Chen <[email protected]>
2018-09-19 00:51:04 +00:00
Jamie Madill 0fdb956d9c Re-land "Inline and micro-optimize more for perf tests.""
Re-land fixes memory leaks.

Using a custom array instead of std::vector speeds up the resource
manager. One reason is because calls to size() are implemented in many
implementations as a difference between two pointers. This sub size
implementations are slower than storing a simple size variable in a
custom class.

Also includes more inlining of hot spots functions.

Also includes a small unit test class for ResourceMap. And an unrelated
but small test fix for TextureLimisTest. Also a small unrelated fix for
a Transform Feedback test.

Increase the scores of the draw call perf test with texture and buffer
bindings and the buffer binding perf test.

Bug: angleproject:2763
Change-Id: Ic2f0f689107b2bf05c63da2ed6bbc9f0feea63f7
Reviewed-on: https://chromium-review.googlesource.com/1229033
Reviewed-by: Shahbaz Youssefi <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-18 16:14:49 +00:00
Yuly Novikov 98a3e078c0 Revert "Inline and micro-optimize more for perf tests."
This reverts commit 57ff6f95f1.

Reason for revert: Memory leaks detected during roll in https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_asan_rel_ng/100284

Original change's description:
> Inline and micro-optimize more for perf tests.
> 
> Using a custom array instead of std::vector speeds up the resource
> manager. One reason is because calls to size() are implemented in many
> implementations as a difference between two pointers. This sub size
> implementations are slower than storing a simple size variable in a
> custom class.
> 
> Also includes more inlining of hot spots functions.
> 
> Also includes a small unit test class for ResourceMap. And an unrelated
> but small test fix for TextureLimisTest. Also a small unrelated fix for
> a Transform Feedback test.
> 
> Increase the scores of the draw call perf test with texture and buffer
> bindings and the buffer binding perf test.
> 
> Bug: angleproject:2763
> Change-Id: I41c327987db27ac45e6a62579f01e1cdc22e396c
> Reviewed-on: https://chromium-review.googlesource.com/1171510
> Reviewed-by: Shahbaz Youssefi <[email protected]>
> Reviewed-by: Jamie Madill <[email protected]>
> Commit-Queue: Jamie Madill <[email protected]>

[email protected],[email protected],[email protected],[email protected]

Change-Id: Ie047289c9bf23a842c3cbb9692c811da0534991c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:2763
Reviewed-on: https://chromium-review.googlesource.com/1228893
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Yuly Novikov <[email protected]>
2018-09-17 19:40:29 +00:00
Jamie Madill 57ff6f95f1 Inline and micro-optimize more for perf tests.
Using a custom array instead of std::vector speeds up the resource
manager. One reason is because calls to size() are implemented in many
implementations as a difference between two pointers. This sub size
implementations are slower than storing a simple size variable in a
custom class.

Also includes more inlining of hot spots functions.

Also includes a small unit test class for ResourceMap. And an unrelated
but small test fix for TextureLimisTest. Also a small unrelated fix for
a Transform Feedback test.

Increase the scores of the draw call perf test with texture and buffer
bindings and the buffer binding perf test.

Bug: angleproject:2763
Change-Id: I41c327987db27ac45e6a62579f01e1cdc22e396c
Reviewed-on: https://chromium-review.googlesource.com/1171510
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-17 13:50:00 +00:00
Courtney Goeltzenleuchter 62114aae85 glBufferSubData: Exit early if size is zero
glBufferSubData is calling vkMapMemory with a size of zero is invalid.
Check for that and exit early if found.

Bug: angleproject:2790

Change-Id: I965badeb3aa2cec1adc24dd7ff5695f8aa3e553d
Reviewed-on: https://chromium-review.googlesource.com/1194610
Commit-Queue: Courtney Goeltzenleuchter <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-09-14 20:27:44 +00:00
Jamie Madill 4230d4847f Finish fixing EGL enums.
This removes the temporary defines now that Chromium is up-to-date.

Bug: angleproject:2806
Change-Id: I8e3308d6b80e49c2b2a7a698ee5d8ad40f442475
Reviewed-on: https://chromium-review.googlesource.com/1227031
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-14 19:01:41 +00:00
Jamie Madill f4d429c1cb Fix EGL enum allocation.
The following enums had a small typo causing them to be takend from an
unused block:

EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE
EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM
EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE

Fix this by temporarily defining a secondary enum. Once Chromium is
fixed upstream we can remove the temporary enum.

Reported by [email protected].

Bug: angleproject:2806
Change-Id: I2ce1dec0a30d5e83f2bec0ae243fd860cbcea4fc
Reviewed-on: https://chromium-review.googlesource.com/1220371
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-09-13 16:19:36 +00:00
Jamie Madill 16e28fd3f2 More micro-optimization for draw call validation.
Mostly inlining checks on the hot draw call path.
Slight increase in draw call validation performance. (Up to 13%)

Bug: angleproject:2747
Change-Id: I34c4d7f412c3bca5e559e9bfb5689c0618bb7536
Reviewed-on: https://chromium-review.googlesource.com/1171506
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-13 15:28:05 +00:00
Jamie Madill 526a6f6b9f Cache valid draw modes for draw calls.
This optimizes some of our dynamic switching. It uses packed enum maps.

Bug: angleproject:2747
Change-Id: Ibd2f9306d066f2fd9eb64c99a25668b7ba5c009c
Reviewed-on: https://chromium-review.googlesource.com/1171505
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
2018-09-13 15:25:39 +00:00
Jamie Madill 0d0fb43f34 Pass unpack buffer as explicit parameter to texSubImage.
This allows us to override it in the incomplete texture init. Any
back-end that used incomplete textures was vulnerable to a bug where
the unpack buffer would be used to initialize the incomplete texture.

Bug: chromium:880906
Change-Id: Ica558e4a4d81de9212f0bc6619ccd812a048ad45
Reviewed-on: https://chromium-review.googlesource.com/1214207
Reviewed-by: Yuly Novikov <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-11 01:43:38 +00:00
Jamie Madill d84b6737fa Cache ValidateDrawStates.
This improves performance of all draw call validation. The error that
should be generated on the draw call is cached in the Context. The
cache is updated in several places.

Bug: angleproject:2747
Change-Id: I178617623731608e2e7166b53ab6489d8b742ff5
Reviewed-on: https://chromium-review.googlesource.com/1158612
Reviewed-by: Yuly Novikov <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-07 14:30:02 +00:00
Olli Etuaho dff32a0da1 Support multisample arrays in shader programs
The added tests check that using textureSize() and texelFetch() on
textures with a fixed point format return expected results. texelFetch
is also covered for integer format textures.

dEQP GLES 3.1 tests also cover a variety of multisampled array texture
formats.

BUG=angleproject:2775
TEST=angle_end2end_tests, angle_deqp_gles31_tests

Change-Id: I99b422e24b39e3563ed72f0fb85c9c1907df807d
Reviewed-on: https://chromium-review.googlesource.com/1196521
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-09-06 15:44:35 +00:00
Jamie Madill 0a17e48491 Vulkan: Fix sync of initially disabled attributes.
If an attribute was never enabled or disabled the default state was not
properly synced in our implementation. This wasn't caught by currently
enabled tests. Those tests are now enabled in VertexAttributeTest.

Bug: angleproject:2800
Change-Id: I97c063651911379e16de4ee557d9840782114c54
Reviewed-on: https://chromium-review.googlesource.com/1199724
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-09-03 16:35:44 +00:00
Jamie Madill 86792f442f Vulkan: Optimize ContextVk::updateDefaultAttributes.
This function was getting called every time because the dirty bit mask
included dirty bits for unused program attributes. Fix this by making
sure we never have dirty bits set for inactive attributes.

Bug: angleproject:2786
Change-Id: Icf72dadd8a853d3a448abb303119b7b71f6c8193
Reviewed-on: https://chromium-review.googlesource.com/1188951
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-31 15:21:38 +00:00
Olli Etuaho 064458a8f8 Remove separate ANGLE_texture_multisample_array
We can just expose OES_texture_storage_multisample_2d_array instead.
The compiler was already changed to accept
OES_texture_storage_multisample_2d_array, and now the change is made
also at the API level.

Out-of-bounds access guarantees provided by ANGLE were the only big
difference between the ANGLE spec and the OES spec, so it's simpler
to just expose the native extension. Safe out-of-bounds accesses can
be guaranteed without having them in the extension spec.

This also adds missing texStorage3DMultisample entry point to the proc
table, which will enable running dEQP tests.

BUG=angleproject:2775
TEST=angle_end2end_tests

Change-Id: Idf376ee877a3374a33de177df023f0531ec8f01d
Reviewed-on: https://chromium-review.googlesource.com/1196722
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-08-31 14:04:58 +00:00
Olli Etuaho 0c5a9e226b Implement TexStorage3DMultisample on the GL backend
BUG=angleproject:2775
TEST=angle_end2end_tests

Change-Id: Ic980d86cd787bcf29f622e68b0c38b0eb6ca5688
Reviewed-on: https://chromium-review.googlesource.com/1190182
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-08-30 16:05:10 +00:00
Olli Etuaho d310a4342c Add validation and negative tests for multisample arrays
This adds errors for binding and allocating multisample array
textures. New tests in TextureMultisampleTest.cpp check that the
errors are generated as specified.

Tests for querying supported sample counts are also improved and
extended for multisample array textures.

BUG=angleproject:2775
TEST=angle_end2end_tests

Change-Id: I6a0fe7ae04bb3d0072f6cbe09026b05e2bc47325
Reviewed-on: https://chromium-review.googlesource.com/1188576
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-08-28 20:48:02 +00:00
Jamie Madill 7b2f027471 Inline more buffer binding calls.
This splits checkObjectAllocation into the inline part and the
slow part. It uses ANGLE_INLINE to force the former to be inlined.

Also inlines and optimizes a few other buffer binding related checks.

Improves performance in a bindings performance test by about 20%.

Includes contributions from [email protected].

Test: Bindings_gl_100_objects_allocated_at_initialization
Bug: angleproject:2777
Change-Id: I71b07d72a8e81db7a90140ef84eca599a29239ed
Reviewed-on: https://chromium-review.googlesource.com/1190442
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-27 20:12:49 +00:00
Olli Etuaho 89664843c6 Add glTexStorage3DMultisampleANGLE entry point
This adds the entry point but does not implement it yet.

The entry point and enums are also added to the gl2ext_angle.h
header file.

BUG=angleproject:2775
TEST=angle_end2end_tests

Change-Id: I24c231c52e7cbb13637880b21044e655935b51e8
Reviewed-on: https://chromium-review.googlesource.com/1188575
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-08-27 14:59:00 +00:00
Jamie Madill 6d32cefd84 Use Observer pattern for Buffers in front-end.
This will allow us to react to state change notifications for validation
caching. It also cleans up some of the logic in the D3D11 State Manager.

Bug: angleproject:2747
Change-Id: I85ed6404206c2b9bf504d552cf5751be56e62146
Reviewed-on: https://chromium-review.googlesource.com/1172086
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-22 01:38:36 +00:00
Jamie Madill 70aeda4942 Add gl::Program::syncState and dirty bits.
Currently this handles uniform block bindings. Cleans up some logic in D3D.

Bug: angleproject:2747
Change-Id: I8c2989738d50a77d6f6d90a9ff11dceab6d3129c
Reviewed-on: https://chromium-review.googlesource.com/1172085
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-21 21:17:29 +00:00
Jamie Madill bf5177d33a Optimize element array binding.
This inlines some methods and code that was regressing binding
performance. Improves the score of a bindings benchmark by 15%.

Based on contributions by [email protected].

Test: bindings_gl_100_objects_allocated_at_initialization
Bug: angleproject:2777
Change-Id: Ied5fdbc67ced862a36c5145fff5ac94f93b40c21
Reviewed-on: https://chromium-review.googlesource.com/1181865
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-21 20:27:25 +00:00
Lingfeng Yang 6e5bf36ff5 GLES1: Fixes for Gets() test
- Fixed wrong face parameter for glGetMaterial*.
- Enabled GL_LINE_SMOOTH capability in state only (no rendering yet)
- Enabled logical operation capability in state only (no rendering yet)
- Fixed wrong handling of GL_RGB/ALPHA_SCALE and
GL_POINT_COORD_REPLACE_OES

Test: Enable and pass Gets() GLES1 conformance test

BUG=angleproject:2306

Change-Id: Ib5c50a2055129b76ad24053baf0dac24dcc00761
Reviewed-on: https://chromium-review.googlesource.com/1176161
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Lingfeng Yang <[email protected]>
2018-08-16 15:43:07 +00:00
jchen10 3fd614d06e Refactor Context dependency for resolveCompile
The context parameter of Shader::resolveCompile method causes a bad
impact that many methods in Shader, Program etc. have to have a same
context parameter. By removing it, these methods can be decoupled
from Context.

BUG=chromium:849576

Change-Id: Ia5545ee9dce45794550f6086bc0e6c4707e1276e
Reviewed-on: https://chromium-review.googlesource.com/1172202
Commit-Queue: Jie A Chen <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-08-16 02:29:46 +00:00
jchen10 7ae70d8fb3 ParallelCompile: Parallelize D3D linking
This adds a new linking state to Program. If a Program is in linking
state, on the one hand the foreground thread may continue issuing more
GL calls, and on the other hand the background linking threads may be
accessing Program internally too. Without a proper constraint there
must be conflicts between them. For this purpose, we block any further
GL calls to Program until it's actually linked. In addition, we
prohibit parallel linking an active program, so that ProgramD3D does
not have to worry about such similar conflicts.

Also changes the WorkerThread to support limiting the number of
concurrently running worker threads.

BUG=chromium:849576

Change-Id: I52618647539323f8bf27201320bdf7301c4982e6
Reviewed-on: https://chromium-review.googlesource.com/1127495
Commit-Queue: Jie A Chen <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-08-11 10:48:43 +00:00
Jamie Madill 6c43a01a57 Make Context handle dirty texture events.
Moving from State to Context allows the Context to update the State
Cache class directly. It also calls through to the State class to
update the Texture cache. This consolidates notification events into
the Context class. This is also in line with how we handle state event
updates in other gl classes.

Bug: angleproject:2747
Bug: angleproject:2763
Change-Id: Iff7dc7e46ee8768819235ebd151707cd2a03dfc9
Reviewed-on: https://chromium-review.googlesource.com/1166143
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-08-09 21:07:37 +00:00
Jamie Madill 7e4eff1160 Program: Add cache samplers and type masks.
This mask cleans up some of the iteration logic in
State::syncProgramTextures. It will make it easier to optimize this
function in the future. This will also make it easier to recompute
the sampler type validation.

Leads to a 5% improvement in State::syncProgramTextures.

Bug: angleproject:2747
Bug: angleproject:2763
Change-Id: Ic9a555df843ad23b4c562e6e4a2d425bee58a856
Reviewed-on: https://chromium-review.googlesource.com/1164306
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-08-09 20:12:12 +00:00
Jamie Madill c43cdad258 StateCache: Make external API easier to understand.
Instead of updating the cache directly we use event notifier functions.
For example instead of calling updateActiveAttribsMask in
Context::linkProgram we call onProgramExecutableChange. This makes the
code more self-documenting and easier to maintain.

Bug: angleproject:2747
Change-Id: Id27b58f646f6924db4c16e28609d6baf6b51c78e
Reviewed-on: https://chromium-review.googlesource.com/1164066
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-08-08 20:52:27 +00:00
Jamie Madill b983a4b28b Pass Context to Framebuffer::invalidateCompletenessCache.
This will be useful for validation state caching.

Bug: angleproject:2747
Change-Id: I0737adca7406f79b9e15429f30ae22e1299cd7e4
Reviewed-on: https://chromium-review.googlesource.com/1158611
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-08-07 13:11:21 +00:00
Jamie Madill a2d1d2dbd5 Context: Cache VAO element limits.
Cache the minimum value for non instanced and instanced active
attributes. The cache is updated in the following places:

1. Context: bindVertexArray.
2. Context: any executable change (linkProgram/useProgram/programBinary).
3. Vertex Array: any state change call.
4. Buffer: a dependent buffer resize.

This greatly reduces the time we're spending in ValidateDrawAttribs.

Bug: angleproject:1391
Change-Id: I84bb222a1b9736e6165fe40e972cd4299ca1178d
Reviewed-on: https://chromium-review.googlesource.com/1150516
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-08-01 18:30:09 +00:00
Jamie Madill a11819deca Context: Use Observer pattern for container objects.
Container objects in this case are the Vertex Array and Read and Draw
Framebuffers. Instead of using a mutable dirty bit state with a const
function to notify of dirty bits we can use the Observer/Subject
pattern. This more cleanly allows us to do cache updates.

Bug: angleproject:1391
Change-Id: I88f863894ec3efa00322038f323a84850166107d
Reviewed-on: https://chromium-review.googlesource.com/1153399
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-08-01 16:20:50 +00:00
Jamie Madill dc358af75d Context: Cache attributes masks.
This cache is updated in the following locations:

1. GLES1: clientActiveTexture.
2. GLES1: disableClientState/enableClientState.
3. Context: linkProgram/useProgram/programBinary.
4. Context: bindVertexArray.
5. Vertex Array: most state changes.

Improves performance by about 6% in the GL no-op test. Also includes
fixes for keeping the client memory attribs mask in sync. The cache
also includes a boolean if there are any enabled client attributes.

Bug: angleproject:1391
Change-Id: I93b6a2c8492355958fd5483f14b70535729091d6
Reviewed-on: https://chromium-review.googlesource.com/1147437
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-07-31 16:28:00 +00:00
Jamie Madill 2eb65034db Add Context::getActiveBufferedAttribsMask.
This will enable more caching for ValidateDrawAttribs. It requires some
minor refactoring of the GLES 1 code.

Bug: angleproject:1391
Change-Id: I52b73c9384d14cdb90ba6337bfc1ab345866fff0
Reviewed-on: https://chromium-review.googlesource.com/1147436
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-07-31 15:21:23 +00:00
Jamie Madill 306b6c168d D3D11: Use angle::Result error pattern. 1/3
This CL improves performance on the draw call microbenchmark by 10%
when no-oping driver calls.

Bug: angleproject:2738
Change-Id: I4f5c11db90d9056ce4557b2a4432bc55b42b5bba
Reviewed-on: https://chromium-review.googlesource.com/1150093
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-07-27 21:32:48 +00:00
Geoff Lang 9bf86f07ac Don't sync the read framebuffer on draw calls.
The read framebuffer may not be complete and be incapable of syncing.

Removed the generate syncDirtyObjects method so each caller must make sure they
are only syncing objects that are known to be valid for the operation.

BUG=angleproject:2737

Change-Id: Ia8edf3fca3a8369aa813be46ba99f6b50a36b2e6
Reviewed-on: https://chromium-review.googlesource.com/1151621
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
2018-07-27 18:50:18 +00:00
Jamie Madill 5188a2747b Pass Context to Query Impl methods.
The Context needed for the error refactor and Vulkan implementation.

Bug: angleproject:2738
Change-Id: Id816b61ebf342c953a320ab29b6386e356dc64e8
Reviewed-on: https://chromium-review.googlesource.com/1150092
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-07-25 16:55:36 +00:00
Jamie Madill a0691b77c3 Pass Context to Fence Impl methods.
This is needed for the error refactoring and also for the Vulkan
implementation.

Bug: angleproject:2738
Change-Id: I4e1bed7f67ef17feb5554b5838a2ed5feb22bba0
Reviewed-on: https://chromium-review.googlesource.com/1150091
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-07-25 16:50:06 +00:00
Lingfeng Yang 0df813c375 GLES1: GL_OES_draw_texture
BUG=angleproject:2306

This implements GL_OES_draw_texture using a few bits of new state
in the renderer and adding a code path for it in the shader, using
gl_VertexID to draw the quad backing the texture draw. This allows us
to avoid allocating a separate vertex array for the texture draw and
reuses the current shader as much as possible, plugging in to the
existing multitexturing pipeline.

- Add unit test and sample
- No new test expectations, but advertising GL_OES_draw_texture makes
the DrawTex GLES1 conformance test non-trivial and actually test
glDrawTex*.

Change-Id: I1485098249fe44d46a01cab4bb7b2c39d0492923
Reviewed-on: https://chromium-review.googlesource.com/1135930
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Lingfeng Yang <[email protected]>
2018-07-23 15:16:49 +00:00
Jamie Madill b4927eb0e7 Context: Fix missing "setErrorSet".
This would cause internal errors to trigger a nullptr dereference.
Bug introduced in "Add gl::ErrorSet and angle::Result." 6b873dd7

Bug: angleproject:2491
Change-Id: Ia98d59d27614912631d41ff0823ee5aa50769733
Reviewed-on: https://chromium-review.googlesource.com/1138408
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-07-16 16:30:40 +00:00
Jamie Madill 6b873dd796 Add gl::ErrorSet and angle::Result.
gl::ErrorSet can handle errors and is accessible from ContextImpl.
It allows the implementation to mutate the error set without using
the gl::Context directly.

angle::Result is the faster POD return value class. It should generate
optimal code. It can also be used seamlessly with the ANGLE_TRY macro.

Also introduces an internal enum as a workaround for generating and
consuming errors in the back-end. When the internal enum is used as
an error return value the error is not consumed in the front-end. This
is a temporary workaround only.

Bug: angleproject:2491
Bug: angleproject:2713
Change-Id: I6cbdaadd075ccbdf241844cbcbc4ed5c3be40a8b
Reviewed-on: https://chromium-review.googlesource.com/1133200
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
2018-07-13 17:06:40 +00:00
Luc Ferron 5396f2a62c Return Error from onMakeCurrent
- Preliminary change for gl_PointCoords fix for Vulkan.

Bug: angleproject:2673
Change-Id: Ie43e8aeccf75a8daa4a137b98292d848522ea2f0
Reviewed-on: https://chromium-review.googlesource.com/1134877
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Luc Ferron <[email protected]>
2018-07-12 14:06:02 +00:00
Jamie Madill dec86230bb Generalize Context scratch buffer errors.
This refactor will allow us to generate different error types in
different backends. This makes Vulkan happy because it won't have to
generate gl::Errors and can stay with vk::Error.

Bug: angleproject:2713
Change-Id: I981402450f3b519d4f79851982547695d583355a
Reviewed-on: https://chromium-review.googlesource.com/1128921
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Frank Henigman <[email protected]>
2018-07-11 19:29:20 +00:00
Jamie Madill 189ad877d8 Return an Error from ContextImpl::syncState.
This will allow the Vulkan back-end to call Vulkan commands that return
VkResult within syncState.

Bug: angleproject:2717
Change-Id: I05e1379e71acaac56bcc9493c8561e82da000934
Reviewed-on: https://chromium-review.googlesource.com/1120150
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Luc Ferron <[email protected]>
2018-07-09 19:16:41 +00:00
Tobin Ehlis d7890bca9b Skip noop draws in the frontend
If a draw does not have enough vertices for its primitive count to
produce a primitive then skip it. If an instanced draw has 0 instances
or not have enough vertices for its primitive count to
produce a primitive then skip it.
This means a Point with 0 vertices, a Line w/ 0-1 vertices, or a tri
with 0-2 primitives.

Updated some redundant code in the D3D11 backend. Draws below the
minDrawCount will no longer be passed to the backend so updated the
associated state in StateManager11 to only track the case where all
primitives should be culled due to GL state settings.

BUG=angleproject:2568
TEST=functional_transform_feedback_basic_types_interleaved_lines_lowp_int

Change-Id: I9faa767c12004fcdec923ec70a8ee5615d789813
Reviewed-on: https://chromium-review.googlesource.com/1120849
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-07-09 18:16:11 +00:00