Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions impeller/renderer/compute_subgroup_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <future>
#include <numeric>

#include "compute_tessellator.h"
Expand Down Expand Up @@ -77,23 +78,25 @@ TEST_P(ComputeSubgroupTest, PathPlayground) {

SkPath sk_path;
if (SkParsePath::FromSVGString(svg_path_data, &sk_path)) {
std::promise<bool> promise;
auto future = promise.get_future();

auto path = skia_conversions::ToPath(sk_path);
auto status =
ComputeTessellator{}
.SetStrokeWidth(stroke_width)
.Tessellate(
path, context, vertex_buffer->AsBufferView(),
vertex_buffer_count->AsBufferView(),
[vertex_buffer_count,
&vertex_count](CommandBuffer::Status status) {
[vertex_buffer_count, &vertex_count,
&promise](CommandBuffer::Status status) {
vertex_count =
reinterpret_cast<SS::VertexBufferCount*>(
vertex_buffer_count->AsBufferView().contents)
->count;
promise.set_value(status ==
CommandBuffer::Status::kCompleted);
});
if (vertex_count > 0) {
ImGui::Text("Vertex count: %zu", vertex_count);
}
switch (status) {
case ComputeTessellator::Status::kCommandInvalid:
ImGui::Text("Failed to submit compute job (invalid command)");
Expand All @@ -104,6 +107,13 @@ TEST_P(ComputeSubgroupTest, PathPlayground) {
case ComputeTessellator::Status::kOk:
break;
}
if (!future.get()) {
ImGui::Text("Failed to submit compute job.");
return false;
}
if (vertex_count > 0) {
ImGui::Text("Vertex count: %zu", vertex_count);
}
} else {
ImGui::Text("Failed to parse path data");
}
Expand Down