-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Compute shader support #35750
Conversation
|
I guess it's .. kind of wired to context already, but will have to test to make sure it's working. Need impellerc in line first. |
chinmaygarde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So exciting! Everything looks great. I don't think we should attempt compute for ES though.
|
|
||
| // |CommandBuffer| | ||
| std::shared_ptr<ComputePass> CommandBufferGLES::OnCreateComputePass() const { | ||
| if (!IsValid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put the validity checks in the base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| if (!IsValid()) { | ||
| return nullptr; | ||
| } | ||
| // TODO(dnfield): implement compute for GLES. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't possible in GLES (anything < 3.2). So I think its best to just return nullptr with a comment here saying that compute passes aren't supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea that >= 3.2 will just have Vulkan anyway?
I was assuming we could use extension methods to check if it's available and if so, use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Have a clear separation between a modern and legacy renderer with little effort made to update the legacy one.
impeller/renderer/command.cc
Outdated
| fragment_bindings.buffers[slot.binding] = {&metadata, view}; | ||
| return true; | ||
| case ShaderStage::kCompute: | ||
| FML_DCHECK(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FML_UNREACHABLE for WIP stuff so we don't miss it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Vulkan is broken, I'll fix that up after I fix impellerc. |
chinmaygarde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Can wait to tinker on this.
| } | ||
|
|
||
| // TODO(dnfield): Support non-serial dispatch type on higher iOS versions. | ||
| auto compute_command_encoder = [buffer_ computeCommandEncoder]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to support this use cases using just creating multiple compute passes. This, instead of relying on the Metal API feature. I think we can get rid of this TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption is that Vulkan would have similar API for collecting compute information, using whatever necessary barriers, whether for use in a subsequent vertex shader or back on the host.
| auto_pop_debug_marker.Release(); | ||
| } | ||
|
|
||
| // TODO(dnfield): update the compute pipeline descriptor so that it can set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File issues (in a later patch is fine) for these and cross reference them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere.
| [encoder dispatchThreadgroups:MTLSizeMake(32, 32, 1) | ||
| threadsPerThreadgroup:MTLSizeMake(32, 32, 1)]; | ||
|
|
||
| // TODO(dnfield): add some kind of completion handling logic for reading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this would need the addition of fences/events as a separate API that allows for resource synchronization between not only compute passes but compute and render passes as well.
impeller/renderer/command.cc
Outdated
| fragment_bindings.buffers[slot.binding] = {&metadata, view}; | ||
| return true; | ||
| case ShaderStage::kCompute: | ||
| FML_UNREACHABLE(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just a validation log that returns false?
impeller/renderer/compute_command.cc
Outdated
| const ShaderUniformSlot& slot, | ||
| const ShaderMetadata& metadata, | ||
| BufferView view) { | ||
| FML_DCHECK(stage == ShaderStage::kCompute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a DCHECK that is all but useless for non-engine developers, just return false?
|
@dnfield Per your comment in the chat thread, marking this as a non-draft. |
|
…110727) * 5a1a855b2 Roll Clang from 41d4067d0b7c to 039b969b32b6 (flutter/engine#35840) * 3a1d6a9b0 Roll Skia from e0b87738eca7 to 45fe3b5a6710 (9 revisions) (flutter/engine#35841) * fb067eab7 [Impeller] Compute shader support (flutter/engine#35750) * a53384841 Roll Dart SDK from 5a2737b71877 to fec63626f078 (2 revisions) (flutter/engine#35844) * 3dc4e4971 roll CanvasKit to 0.36.1 (attempt 2) (flutter/engine#35839) * 9b14b25eb Reland: Adds a reusable FragmentShader (flutter/engine#35846) * ac34d3e63 [fuchsia] Workflow scripts. (flutter/engine#35822) * f0f8d10b8 Revert "Roll Dart SDK from 5a2737b71877 to fec63626f078 (2 revisions) (#35844)" (flutter/engine#35849)
Fixes flutter/flutter#109346
This doesn't really do anything yet.
still left:
Context.