Commit Graph
29 Commits
Author SHA1 Message Date
Jamie Madill 6c1f671b36 Add destroy hooks for several GL objects.
These hooks allow the back-end renderer to free object resources
without having to store pointers to shared device handles for
each and every object. This will allow us to save memory on
back-ends that really care about memory overhead.

There is a downside in that there is more boilerplate in passing
gl::Context handles around everywhere.

BUG=angleproject:1684

Change-Id: I89463bba8d23f92920e8956650cb73c7fc6d66b7
Reviewed-on: https://chromium-review.googlesource.com/426401
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-02-15 01:29:47 +00:00
Jamie Madill 5f45e7c34c Refactor ResourceManagers.
This makes ResourceManagers use more common code. It uses static
polymorphism to implement the various typed resource managers,
and unifies the FramebufferManager into a TypedResourceManager.
The lack of virtual calls and inlining in the header should keep
performance high.

This will make the upcoming refactor to add a destroy hook
for Vulkan objects simpler to implement.

TEST=manual performance testing of BindingPerf.
BUG=angleproject:1684
BUG=angleproject:1639

Change-Id: Ic2f102196020d1005e63a1b2cf0867577fc7c885
Reviewed-on: https://chromium-review.googlesource.com/439488
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-02-11 00:58:03 +00:00
Geoff Lang 3bf8e3a248 Refactor Framebuffer management into a FramebufferManager class.
BUG=angleproject:1639

Change-Id: I03a0950f26557983c8dc816a27cb4038c60e5755
Reviewed-on: https://chromium-review.googlesource.com/415611
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
2017-02-02 21:51:56 +00:00
Geoff Lang 4ddf5afb75 Refactor ResourceManager into separate managers per resource type.
BUG=angleproject:1639

Change-Id: I943f553cfb0e0feb57953770784b48e22fccc875
Reviewed-on: https://chromium-review.googlesource.com/423172
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-01-30 19:26:41 +00:00
Jamie Madill 8f775607eb Introduce a gl::BufferState class.
This state can share vital pieces of information with the impl.
The most elementary state is the buffer size, which then the
impl doesn't need to replicate.

BUG=angleproject:1579

Change-Id: I341393c64a6e49de65c1d53b1bad2fa143209862
Reviewed-on: https://chromium-review.googlesource.com/406644
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-11-04 18:09:04 +00:00
Jamie Madill ef300b153b Refactor some entry point stuff.
BUG=angleproject:747

Change-Id: I80634b5e6de8bae1433c49a56a92d3b19c24e11d
Reviewed-on: https://chromium-review.googlesource.com/395568
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2016-10-08 00:33:36 +00:00
Geoff Lang f41a7151a5 Add an extension to disable resource generation on bind.
BUG=angleproject:1518

Change-Id: I662f7b07da5c97831496f2617b0adadf9858bdc9
Reviewed-on: https://chromium-review.googlesource.com/386799
Reviewed-by: Antoine Labour <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
2016-09-23 14:16:37 +00:00
Martin Radev 4c4c8e7252 Add compute program compilation and linking support
Compute shaders can be now compiled and linked to create programs.
Some tests are added to verify successful and unsuccessful compute
shader linking.

The patch also replaces std::array<int, 3> with a custom struct
WorkGroupSize.

BUG=angleproject:1442

TEST=angle_end2end_tests
TEST=angle_unittests

Change-Id: I4ab0ac05755d0167a6d2a798f8d7f1516cf54d84
Reviewed-on: https://chromium-review.googlesource.com/366740
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2016-08-26 09:51:18 +00:00
Sami Väisänen e45e53bd20 Support CHROMIUM_path_rendering
This is partial support for CHROMIUM_path_rendering
and implements basic path management and non-instanced
rendering.

BUG=angleproject:1382

Change-Id: I9c0e88183e0a915d522889323933439d25b45b5f
Reviewed-on: https://chromium-review.googlesource.com/348630
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-06-20 12:45:43 +00:00
Jamie Madill 901b379f0c Fix use-after-free when deleting share contexts.
The pattern of gen context, share context, free context, then allocate
a shared GL object in the second context would cause a use-after-free
of the ContextImpl as a GLFactory. Fix this by passing the factory
as a parameter to the resource manager allocation methods instead of
storing the factory pointer. This allows the same ResourceManager to
work with separate Context implementations, which will work with
non-virtual contexts.

BUG=612931

Change-Id: Ifceeb893bebd072f318963d935ff9d17181f5305
Reviewed-on: https://chromium-review.googlesource.com/347463
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2016-05-26 16:14:37 +00:00
Jamie Madill 53ea9cc655 Replace rx::Renderer with rx::ContextImpl.
Previously Context had no Impl class, but had a special relationship
with the instanced Renderer class. Having a ContextImpl backing every
Context will allow new designs to enable things like multithreading
(where each ContextImpl stores a Context-specific device) or non-
virtual Contexts on Android or other platforms where it is more
efficient.

A large refactoring patch that touches every back-end.

BUG=angleproject:1363

Change-Id: Icb73a7d37447f08a664eeb499a310ba05d71a57e
Reviewed-on: https://chromium-review.googlesource.com/342052
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-05-17 15:59:29 +00:00
Jamie Madill 7aea7e056d Add EGLImplFactory.
Also rename ImplFactory to GLImplFactory.

This will allow us to use the same factory design pattern for EGL
objects, and to use State helper classes to share data with Impls.

BUG=angleproject:1363
BUG=angleproject:1369

Change-Id: I07a8fe40838d5d4ca32b04910c306edeab4d25a7
Reviewed-on: https://chromium-review.googlesource.com/342051
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-05-11 20:22:24 +00:00
Olli Etuaho 82c47ad026 Pass ImplFactory to Texture constructor
This improves encapsulation inside the Texture class, and removes
duplication of createTexture calls. This is a necessary step towards
adding a shared "Data" structure to the Texture classes, following a
similar pattern as for example the Framebuffer class.

This patch also shares the same MockFactory class among different
unit tests.

BUG=angleproject:596
TEST=angle_unittests

Change-Id: Ie8d3a9aa4ec35565d7ecbabb8c40e7b1ba068721
Reviewed-on: https://chromium-review.googlesource.com/340200
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2016-04-22 10:13:14 +00:00
Jamie Madill 4e25a0d6cf Use std::unordered_map in ResourceManager.
The hashed query performs significantly faster than std::map.
This improves performance in applications which use Bind* often.

Also use the same scheme for the Context-managed resources.

BUG=angleproject:1333

Change-Id: I8a1f25d80e060c62dab1f86005e1bc4df1c06dba
Reviewed-on: https://chromium-review.googlesource.com/331387
Reviewed-by: Zhenyao Mo <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-03-10 02:43:24 +00:00
Jamie Madill 3f01e6c253 Return pointers from check*Allocation.
This avoids the need to consult the resource maps twice per bind.
It improves performance in applications which call Bind* often.

BUG=angleproject:1333

Change-Id: I7b733cc89e50e24a2e38a2eb2dc7fd658d612e27
Reviewed-on: https://chromium-review.googlesource.com/331386
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Zhenyao Mo <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2016-03-10 00:53:51 +00:00
Geoff Lang 0af0b81d5b Add a SamplerImpl object and implement it for the GL backend.
Passes all tests in dEQP-GLES3.functional.samplers

BUG=angleproject:1162

Change-Id: I7713031a677aac2b41889a6b4297ab512e184863
Reviewed-on: https://chromium-review.googlesource.com/301582
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2015-09-28 14:53:57 +00:00
Jamie Madill 006cbc5b92 Remove rx::ShaderSh and move the shared code to the GL.
The GL layer can interact with the translator directly, to query all
the active shader variables and call ShCompile.

BUG=angleproject:1159

Change-Id: I334a9bef28f93cf85dd8cac0fb8542ac567cc3ec
Reviewed-on: https://chromium-review.googlesource.com/299877
Reviewed-by: Geoff Lang <[email protected]>
Tryjob-Request: Jamie Madill <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-09-24 18:34:51 +00:00
Jamie Madill 91445bce0e Make a shader Shader::Data state structure.
This design follows the similar designs for Program, Framebuffer, etc.
Because of the current design, share a mutable pointer with the Impl
so the patch becomes a bit smaller and easier to review. In a follow-
up patch we can move the shared code into the GL layer.

BUG=angleproject:1159

Change-Id: Ib243e74779f23be51cdca80f1b5c6e5f3e36059d
Reviewed-on: https://chromium-review.googlesource.com/299876
Reviewed-by: Geoff Lang <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-09-24 18:34:28 +00:00
Jamie Madill 5c6b7bfe27 Add a Program::Data shared state structure.
Similar to the Framebuffer and other classes, this gives the Impl
class a read-only view of the object's state.

BUG=angleproject:1123

Change-Id: I580eaebe2de236adf8131d6e3f54633cecce8c25
Reviewed-on: https://chromium-review.googlesource.com/293760
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-08-17 19:34:40 +00:00
Jamie Madill bdd419f9f5 Fix ResourceManager create-on-bind reallocations.
*re-land with build fix for Clang*

We had a funny bug where the Handle Allocator would re-allocate
reserved handles after the app layer creates one with Bind rather
than using Gen. This affects Textures, Buffers and Renderbuffers.

Fix this by using a different allocation scheme. It should still
be fast on the "good" case (using Gen) and use tree lookups on the
bind case. Also add some unit tests.

BUG=angleproject:942

Change-Id: I63ce608fcd6a11f92e2b5421f090551934e729ed
Reviewed-on: https://chromium-review.googlesource.com/261591
Tested-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2015-03-20 20:12:24 +00:00
Jamie Madill 21045f5a70 Revert "Fix ResourceManager create-on-bind reallocations."
Build break on GPU FYI Bots on Linux/Mac:

http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/28092

This reverts commit 61ce1a414e.

Change-Id: If2e7fb35c769708a783a32932b777dc97eaba8a4
Reviewed-on: https://chromium-review.googlesource.com/261590
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-03-20 19:28:55 +00:00
Jamie Madill 61ce1a414e Fix ResourceManager create-on-bind reallocations.
We had a funny bug where the Handle Allocator would re-allocate
reserved handles after the app layer creates one with Bind rather
than using Gen. This affects Textures, Buffers and Renderbuffers.

Fix this by using a different allocation scheme. It should still
be fast on the "good" case (using Gen) and use tree lookups on the
bind case. Also add some unit tests.

BUG=angleproject:942

Change-Id: I2e3f4c31b28cb86bd3699035f5d55568a2a1d7d5
Reviewed-on: https://chromium-review.googlesource.com/258904
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Jamie Madill <[email protected]>
2015-03-20 17:20:35 +00:00
Jamie Madill ae6495e507 Use rx::ImplFactory in ResourceManager.
This will make mocking easier for unit testing ResourceManager.

BUG=angleproject:942

Change-Id: I24b9d0be550991845225141d6e7d5630383a8718
Reviewed-on: https://chromium-review.googlesource.com/258901
Tested-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2015-03-16 17:32:07 +00:00
Geoff Lang 691e58cd84 Merge all gl::Texture* classes.
The validation for sampler completeness had a lot of duplicated code.
The special cases have been merged into the base class by checking mTarget.

BUG=angle:681

Change-Id: I11d94c1432f8fc70a1edaaf8228bbc43c3c8fff3
Reviewed-on: https://chromium-review.googlesource.com/236932
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2015-01-14 21:14:19 +00:00
Geoff Lang 492a7e43eb Encapulate the ESSL compiler into a GL object that is per-context.
* Allows for multiple contexts have to have different client versions, caps
   and extensions without causing shader compilation failures.

BUG=angle:823

Change-Id: I523679e90be031b0b7fa385d46d6839b1cf3029f
Reviewed-on: https://chromium-review.googlesource.com/227710
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2014-12-11 21:07:46 +00:00
Geoff Lang 7dd2e10da0 Merge the ProgramBinary class into Program.
BUG=angle:731

Change-Id: I2ee97155841dc62f04bb71c1f2035d210fd3883c
Reviewed-on: https://chromium-review.googlesource.com/232694
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2014-12-03 15:03:09 +00:00
Geoff Lang 2132941412 Revert "Merge the ProgramBinary class into Program."
Issues appeared on the FYI waterfall, content_gl_tests hangs.

This reverts commit 2195a6d603.

Change-Id: I9fe1a53cf40887ae5a98fd77b4872f41085fcea7
Reviewed-on: https://chromium-review.googlesource.com/232386
Reviewed-by: Geoff Lang <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2014-12-02 20:50:39 +00:00
Geoff Lang 2195a6d603 Merge the ProgramBinary class into Program.
BUG=angle:731

Change-Id: Ia0a356c0684f3a3576c71dfd04b00874318dd084
Reviewed-on: https://chromium-review.googlesource.com/228701
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2014-12-02 17:00:10 +00:00
Geoff Lang 2b5420c07f Merge libGLESv2 and libEGL classes into libANGLE.
BUG=angle:733

Change-Id: Ic491c971411fe82c56cd97c5c8325ac14ec218df
Reviewed-on: https://chromium-review.googlesource.com/230830
Reviewed-by: Geoff Lang <[email protected]>
Tested-by: Geoff Lang <[email protected]>
2014-11-21 19:46:02 +00:00