forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 2
[Impeller] Use the IO context for OpenGL program setup #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xiaowei-guan
wants to merge
24
commits into
flutter-tizen:flutter-3.44.1
Choose a base branch
from
xiaowei-guan:flutter-3.44.1
base: flutter-3.44.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
10410a2
Add io task runner to pipeline library gles.
xiaowei-guan 6650c7a
Implement pipeline compile queue for gles
xiaowei-guan 4c3a105
Fix build error
xiaowei-guan 6539904
Add pipeline_compile_queue_vulkan.h
xiaowei-guan b7f9f28
Update GetPipeline method when sync == true
xiaowei-guan 59c6773
Make link program after schedule frame on IO thread
xiaowei-guan fc6e3a6
Fix codereview issues
xiaowei-guan 15f3251
Execute the compile job one by one; do not push all the tasks into th…
xiaowei-guan 5434e6f
When executing an OpenGL job, you must wait for the previous job to f…
xiaowei-guan fa3cdc2
Remove empty line
xiaowei-guan 751c330
Add a robust mutex-based synchronization pattern
xiaowei-guan 6a1d9c7
Fix code review issues
xiaowei-guan 2a8d812
Fix code review issues
xiaowei-guan 4465367
Fix code review issues
xiaowei-guan c026698
Add check when creating PipelineCompileQueueGLES
xiaowei-guan fa86d60
Fix format issue
xiaowei-guan 64d533d
Add UT test
xiaowei-guan dcf6915
Fix unit test issue
xiaowei-guan 312d9d6
Add android part
xiaowei-guan 20fd5fa
io task runner maybe null when call ContextGLES::Create
xiaowei-guan cd35071
Remove not used comments
xiaowei-guan 226b234
Make PipelineCompileQueueVulkan PipelineCompileQueueGles constructor
xiaowei-guan 54ddd8f
Fix build error
xiaowei-guan 3f0cf4e
Remove redundant code
xiaowei-guan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
engine/src/flutter/impeller/renderer/backend/gles/pipeline_compile_queue_gles.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "impeller/renderer/backend/gles/pipeline_compile_queue_gles.h" | ||
|
|
||
| #include "flutter/fml/logging.h" | ||
| #include "flutter/fml/trace_event.h" | ||
| #include "impeller/base/validation.h" | ||
|
|
||
| namespace impeller { | ||
|
|
||
| std::shared_ptr<PipelineCompileQueueGLES> PipelineCompileQueueGLES::Create( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner) { | ||
| if (!worker_task_runner) { | ||
| return nullptr; | ||
| } | ||
| return std::shared_ptr<PipelineCompileQueueGLES>( | ||
| new PipelineCompileQueueGLES(std::move(worker_task_runner))); | ||
| } | ||
|
|
||
| PipelineCompileQueueGLES::PipelineCompileQueueGLES( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner) | ||
| : worker_task_runner_(std::move(worker_task_runner)) {} | ||
|
|
||
| PipelineCompileQueueGLES::~PipelineCompileQueueGLES() = default; | ||
|
|
||
| void PipelineCompileQueueGLES::OnJobAdded() { | ||
| Lock lock(processing_mutex_); | ||
| if (!is_processing_) { | ||
| is_processing_ = true; | ||
| DrainPendingJobs(); | ||
| } | ||
| } | ||
|
|
||
| void PipelineCompileQueueGLES::PostJob(const fml::closure& job) { | ||
| if (!job) { | ||
| return; | ||
| } | ||
|
|
||
| worker_task_runner_->PostTask(job); | ||
| } | ||
|
|
||
| void PipelineCompileQueueGLES::DrainPendingJobs() { | ||
| PostJob([weak_queue = weak_from_this()]() { | ||
| if (auto queue = std::static_pointer_cast<PipelineCompileQueueGLES>( | ||
| weak_queue.lock())) { | ||
| queue->DoOneJob(); | ||
| { | ||
| Lock lock(queue->processing_mutex_); | ||
| if (!queue->HasPendingJobs()) { | ||
| queue->is_processing_ = false; | ||
| return; | ||
| } | ||
| } | ||
| queue->DrainPendingJobs(); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| } // namespace impeller | ||
42 changes: 42 additions & 0 deletions
42
engine/src/flutter/impeller/renderer/backend/gles/pipeline_compile_queue_gles.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ | ||
| #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ | ||
|
|
||
| #include "flutter/fml/closure.h" | ||
| #include "flutter/fml/task_runner.h" | ||
| #include "impeller/base/thread.h" | ||
| #include "impeller/renderer/pipeline_compile_queue.h" | ||
|
|
||
| namespace impeller { | ||
|
|
||
| class PipelineCompileQueueGLES : public PipelineCompileQueue { | ||
| public: | ||
| static std::shared_ptr<PipelineCompileQueueGLES> Create( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner); | ||
|
|
||
| ~PipelineCompileQueueGLES() override; | ||
|
|
||
| PipelineCompileQueueGLES(const PipelineCompileQueueGLES&) = delete; | ||
|
|
||
| PipelineCompileQueueGLES& operator=(const PipelineCompileQueueGLES&) = delete; | ||
|
|
||
| void PostJob(const fml::closure& job) override; | ||
|
|
||
| void OnJobAdded() override; | ||
|
|
||
| private: | ||
| explicit PipelineCompileQueueGLES( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner); | ||
| void DrainPendingJobs(); | ||
|
|
||
| fml::RefPtr<fml::TaskRunner> worker_task_runner_; | ||
| Mutex processing_mutex_; | ||
| bool is_processing_ IPLR_GUARDED_BY(processing_mutex_) = false; | ||
| }; | ||
|
|
||
| } // namespace impeller | ||
|
|
||
| #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.