Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2d2f201

Browse files
committed
[Impeller] Cleanup unusued Vulkan APIs and enable more tests.
`CanRenderToTexture` was letting go of the command buffer and then adding to a pass which was tripping an assertion.
1 parent 86e4066 commit 2d2f201

File tree

7 files changed

+11
-56
lines changed

7 files changed

+11
-56
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,9 +1877,6 @@ TEST_P(AiksTest, SaveLayerFiltersScaleWithTransform) {
18771877
}
18781878

18791879
TEST_P(AiksTest, SceneColorSource) {
1880-
if (GetBackend() == PlaygroundBackend::kVulkan) {
1881-
GTEST_SKIP_("Temporarily disabled.");
1882-
}
18831880
// Load up the scene.
18841881
auto mapping =
18851882
flutter::testing::OpenFixtureAsMapping("flutter_logo_baked.glb.ipscene");

impeller/renderer/backend/vulkan/allocator_vk.cc

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -311,37 +311,6 @@ class AllocatedTextureSourceVK final : public TextureSourceVK {
311311
}
312312
}
313313

314-
bool SetContents(const TextureDescriptor& desc,
315-
const uint8_t* contents,
316-
size_t length,
317-
size_t slice) override {
318-
void* data = nullptr;
319-
if (::vmaMapMemory(allocator_, allocation_, &data) != VK_SUCCESS) {
320-
VALIDATION_LOG << "Could not map texture memory to write to.";
321-
return false;
322-
}
323-
324-
std::memcpy(static_cast<uint8_t*>(data) + (length * slice), //
325-
contents, //
326-
length //
327-
);
328-
329-
const auto flushed = ::vmaFlushAllocation(allocator_, // allocator
330-
allocation_, // allocation
331-
length * slice, // offset
332-
length // size
333-
) == VK_SUCCESS;
334-
335-
::vmaUnmapMemory(allocator_, allocation_);
336-
337-
if (!flushed) {
338-
VALIDATION_LOG << "Could not flush written mapped memory.";
339-
return false;
340-
}
341-
342-
return true;
343-
}
344-
345314
bool IsValid() const { return is_valid_; }
346315

347316
vk::Image GetImage() const override { return image_; }

impeller/renderer/backend/vulkan/context_vk.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ vk::Device ContextVK::GetDevice() const {
397397
}
398398

399399
std::unique_ptr<Surface> ContextVK::AcquireNextSurface() {
400+
TRACE_EVENT0("impeller", __FUNCTION__);
400401
auto surface = swapchain_ ? swapchain_->AcquireNextDrawable() : nullptr;
401402
if (surface && pipeline_library_) {
402403
pipeline_library_->DidAcquireSurfaceFrame();

impeller/renderer/backend/vulkan/swapchain_impl_vk.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct FrameSynchronizer {
2929
if (acquire_res.result != vk::Result::eSuccess ||
3030
render_res.result != vk::Result::eSuccess ||
3131
present_res.result != vk::Result::eSuccess) {
32-
VALIDATION_LOG << "Could not create synchornizer.";
32+
VALIDATION_LOG << "Could not create synchronizer.";
3333
return;
3434
}
3535
acquire = std::move(acquire_res.value);
@@ -41,14 +41,18 @@ struct FrameSynchronizer {
4141
~FrameSynchronizer() = default;
4242

4343
bool WaitForFence(const vk::Device& device) {
44-
if (device.waitForFences(
44+
if (auto result = device.waitForFences(
4545
*acquire, // fence
4646
true, // wait all
4747
std::numeric_limits<uint64_t>::max() // timeout (ns)
48-
) != vk::Result::eSuccess) {
48+
);
49+
result != vk::Result::eSuccess) {
50+
VALIDATION_LOG << "Fence wait failed: " << vk::to_string(result);
4951
return false;
5052
}
51-
if (device.resetFences(*acquire) != vk::Result::eSuccess) {
53+
if (auto result = device.resetFences(*acquire);
54+
result != vk::Result::eSuccess) {
55+
VALIDATION_LOG << "Could not reset fence: " << vk::to_string(result);
5256
return false;
5357
}
5458
return true;

impeller/renderer/backend/vulkan/texture_source_vk.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,4 @@ bool TextureSourceVK::SetLayout(const LayoutTransition& transition) const {
5858
return true;
5959
}
6060

61-
bool TextureSourceVK::SetContents(const TextureDescriptor& desc,
62-
const uint8_t* contents,
63-
size_t length,
64-
size_t slice) {
65-
return false;
66-
}
67-
6861
} // namespace impeller

impeller/renderer/backend/vulkan/texture_source_vk.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class TextureSourceVK {
1818

1919
const TextureDescriptor& GetTextureDescriptor() const;
2020

21-
virtual bool SetContents(const TextureDescriptor& desc,
22-
const uint8_t* contents,
23-
size_t length,
24-
size_t slice);
25-
2621
virtual vk::Image GetImage() const = 0;
2722

2823
virtual vk::ImageView GetImageView() const = 0;

impeller/renderer/renderer_unittests.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ TEST_P(RendererTest, CanRenderMultiplePrimitives) {
278278
}
279279

280280
TEST_P(RendererTest, CanRenderToTexture) {
281-
if (GetBackend() == PlaygroundBackend::kVulkan) {
282-
GTEST_SKIP_("Temporarily disabled.");
283-
}
284281
using VS = BoxFadeVertexShader;
285282
using FS = BoxFadeFragmentShader;
286283
auto context = GetContext();
@@ -312,9 +309,9 @@ TEST_P(RendererTest, CanRenderToTexture) {
312309
ASSERT_TRUE(bridge && boston);
313310
auto sampler = context->GetSamplerLibrary()->GetSampler({});
314311
ASSERT_TRUE(sampler);
315-
316312
std::shared_ptr<RenderPass> r2t_pass;
317-
313+
auto cmd_buffer = context->CreateCommandBuffer();
314+
ASSERT_TRUE(cmd_buffer);
318315
{
319316
ColorAttachment color0;
320317
color0.load_action = LoadAction::kClear;
@@ -352,7 +349,6 @@ TEST_P(RendererTest, CanRenderToTexture) {
352349
RenderTarget r2t_desc;
353350
r2t_desc.SetColorAttachment(color0, 0u);
354351
r2t_desc.SetStencilAttachment(stencil0);
355-
auto cmd_buffer = context->CreateCommandBuffer();
356352
r2t_pass = cmd_buffer->CreateRenderPass(r2t_desc);
357353
ASSERT_TRUE(r2t_pass && r2t_pass->IsValid());
358354
}

0 commit comments

Comments
 (0)