6 Commits

Author SHA1 Message Date
Brandon DeRosier
e118869e40 [Flutter GPU] Get the GLES backend/Windows working. (flutter/engine#55694)
Resolves https://github.com/flutter/flutter/issues/156305.

* Resolve pipelines and submit command buffers on the raster thread.
* Don't use desktop GL shader variation on Windows.
* Fix interpretation of `array_elements`.
* Fix texture binding metadata.

Gets Flutter GPU working on Windows!
![image](https://github.com/user-attachments/assets/9eecb67f-a980-4556-8060-b0c947713534)
![image](https://github.com/user-attachments/assets/c8e2071f-e7c0-411c-8f37-e1f3037916f4)
2024-10-09 00:04:39 +00:00
Jonah Williams
1cd141f1a1 [Impeller] Reland: add interface for submitting multiple command buffers at once. (flutter/engine#50180)
Reland of:  https://github.com/flutter/engine/pull/50139

Metal does not seem to like it when we collect 50+ command buffers at once. Adjust the aiks context logic to regularly flush the cmd buffers.
2024-01-30 21:21:48 +00:00
auto-submit[bot]
f3e4437823 Reverts "[Impeller] Add interface for submitting multiple command buffers at once." (flutter/engine#50174)
Reverts flutter/engine#50139
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
The Impeller Vulkan backend benefits from batching submission to the vk graphics queue. Managing this automatically is non-trivial and adds surprising/fragile thread based behavior, see: https://github.com/flutter/engine/pull/49870

Instead, introduce an impeller::CommandQueue object that command buffers must be submitted to in lieu of CommandBuffer->Submit, which has been made private.

TLDR

old
```c++
buffer->Submit();
```

new
```c++
context.GetQueue()->Submit({buffer});
```

The Metal and GLES implementations internally just call the private CommandBuffer->Submit, though there may be future opportunities to simplify here. The Vulkan implementation is where the meat is.

Aiks takes advantage of this by storing all command buffers on the aiks context while rendering a frame, and then performing one submit in aiks_context render. I don't think this will introduce any thread safety problems, as we don't guarantee much about aiks context - nor do we use it in a multithreaded context as far as I know.

Other tasks such as image upload still just directly submit their command buffers via the queue.

Fixes https://github.com/flutter/flutter/issues/141123
2024-01-30 17:13:17 +00:00
Jonah Williams
6b613131d1 [Impeller] Add interface for submitting multiple command buffers at once. (flutter/engine#50139)
The Impeller Vulkan backend benefits from batching submission to the vk graphics queue. Managing this automatically is non-trivial and adds surprising/fragile thread based behavior, see: https://github.com/flutter/engine/pull/49870

Instead, introduce an impeller::CommandQueue object that command buffers must be submitted to in lieu of CommandBuffer->Submit, which has been made private.

TLDR

old
```c++
buffer->Submit();
```

new
```c++
context.GetQueue()->Submit({buffer});
```

The Metal and GLES implementations internally just call the private CommandBuffer->Submit, though there may be future opportunities to simplify here. The Vulkan implementation is where the meat is.

Aiks takes advantage of this by storing all command buffers on the aiks context while rendering a frame, and then performing one submit in aiks_context render. I don't think this will introduce any thread safety problems, as we don't guarantee much about aiks context - nor do we use it in a multithreaded context as far as I know.

Other tasks such as image upload still just directly submit their command buffers via the queue.

Fixes https://github.com/flutter/flutter/issues/141123
2024-01-30 07:48:35 +00:00
Matan Lurey
3aae0411b7 Automatically fix header guards in the rest of the flutter/engine repo. (flutter/engine#49059) 2023-12-15 04:11:06 +00:00
Brandon DeRosier
05f43a96aa [Flutter GPU] Raster encoding. First triangle! (flutter/engine#48314)
First triangle, in the framework! 🎉 

Adds shader libraries, pipelines, command buffers, render passes, etc.

* Light pipelines/shader objects. No optimization yet, pipeline warming
to come.
* "Dynamic" command style. Don't re-send bindings if you don't need to.
Essentially: https://github.com/flutter/flutter/issues/133179
* No need to explicitly encode passes.
* Minimal descriptor usage.
* Nothing is async, except for the optional command buffer completion
callback.

It took a bunch of experimenting to get here, but I think things are
starting to look pretty neat. :)

Todo:
* Land the shader bundle format/remove the testing hacks & fixtures that
piggyback off of the runtime effect system.
* Add remaining calls for blend config, clearing bindings, etc.
* Inconsistent error handling patterns that need cleanup.
* Maybe: Surface exceptions for validation errors.
* Handle the texture usage bitmask more elegantly.
2023-11-24 19:02:58 -08:00