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

Commit b80cffe

Browse files
committed
fix linter issues
1 parent 7a55c06 commit b80cffe

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

impeller/renderer/backend/vulkan/descriptor_pool_vk.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace impeller {
1212

13-
DescriptorPoolVK::DescriptorPoolVK(vk::Device device) {
13+
DescriptorPoolVK::DescriptorPoolVK(vk::Device device) : device_(device) {
1414
constexpr size_t kPoolSize = 1024;
1515

1616
std::vector<vk::DescriptorPoolSize> pool_sizes = {
@@ -34,20 +34,24 @@ DescriptorPoolVK::DescriptorPoolVK(vk::Device device) {
3434
pool_sizes.data() // pool sizes
3535
};
3636

37-
auto res = device.createDescriptorPoolUnique(pool_info);
37+
auto res = device.createDescriptorPool(pool_info);
3838
if (res.result != vk::Result::eSuccess) {
3939
VALIDATION_LOG << "Unable to create a descriptor pool";
4040
return;
4141
}
4242

43-
pool_ = std::move(res.value);
43+
pool_ = res.value;
4444
is_valid_ = true;
4545
}
4646

4747
vk::DescriptorPool DescriptorPoolVK::GetPool() {
48-
return *pool_;
48+
return pool_;
4949
}
5050

51-
DescriptorPoolVK::~DescriptorPoolVK() = default;
51+
DescriptorPoolVK::~DescriptorPoolVK() {
52+
if (is_valid_) {
53+
device_.destroyDescriptorPool(pool_);
54+
}
55+
}
5256

5357
} // namespace impeller

impeller/renderer/backend/vulkan/descriptor_pool_vk.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class DescriptorPoolVK {
2222
vk::DescriptorPool GetPool();
2323

2424
private:
25-
vk::UniqueDescriptorPool pool_;
25+
vk::Device device_;
26+
vk::DescriptorPool pool_;
2627
bool is_valid_ = false;
2728

2829
FML_DISALLOW_COPY_AND_ASSIGN(DescriptorPoolVK);

impeller/renderer/backend/vulkan/render_pass_vk.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ static uint32_t color_flash = 0;
2727

2828
RenderPassVK::RenderPassVK(std::weak_ptr<const Context> context,
2929
vk::Device device,
30-
RenderTarget target,
30+
const RenderTarget& target,
3131
vk::UniqueCommandBuffer command_buffer,
3232
vk::UniqueRenderPass render_pass,
3333
SurfaceProducerVK* surface_producer)
34-
: RenderPass(context, target),
34+
: RenderPass(std::move(context), target),
3535
device_(device),
3636
command_buffer_(std::move(command_buffer)),
3737
render_pass_(std::move(render_pass)),
@@ -91,10 +91,6 @@ bool RenderPassVK::OnEncodeCommands(const Context& context) const {
9191
clear_value.color =
9292
vk::ClearColorValue(std::array<float, 4>{0.0f, 0.0f, 0.0, 0.0f});
9393

94-
std::array<vk::ImageView, 1> fbo_attachments = {
95-
tex_info.swapchain_image->GetImageView(),
96-
};
97-
9894
const auto& size = tex_info.swapchain_image->GetSize();
9995
vk::Rect2D render_area =
10096
vk::Rect2D()
@@ -377,7 +373,7 @@ vk::Framebuffer RenderPassVK::CreateFrameBuffer(
377373
.setLayers(1);
378374
auto res = device_.createFramebuffer(fb_create_info);
379375
FML_CHECK(res.result == vk::Result::eSuccess);
380-
return std::move(res.value);
376+
return res.value;
381377
}
382378

383379
bool RenderPassVK::TransitionImageLayout(uint32_t frame_num,
@@ -401,6 +397,11 @@ bool RenderPassVK::TransitionImageLayout(uint32_t frame_num,
401397
vk::CommandBufferBeginInfo begin_info;
402398
auto res = transition_cmd->begin(begin_info);
403399

400+
if (res != vk::Result::eSuccess) {
401+
VALIDATION_LOG << "Failed to begin command buffer: " << vk::to_string(res);
402+
return false;
403+
}
404+
404405
vk::ImageMemoryBarrier barrier =
405406
vk::ImageMemoryBarrier()
406407
.setSrcAccessMask(vk::AccessFlagBits::eColorAttachmentRead)

impeller/renderer/backend/vulkan/render_pass_vk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RenderPassVK final : public RenderPass {
2121
public:
2222
RenderPassVK(std::weak_ptr<const Context> context,
2323
vk::Device device,
24-
RenderTarget target,
24+
const RenderTarget& target,
2525
vk::UniqueCommandBuffer command_buffer,
2626
vk::UniqueRenderPass render_pass,
2727
SurfaceProducerVK* surface_producer);

impeller/renderer/backend/vulkan/texture_vk.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ bool TextureVK::OnSetContents(const uint8_t* contents,
4646

4747
// currently we are only supporting 2d textures, no cube textures etc.
4848
auto mapping = texture_info_->allocated_texture.allocation_info.pMappedData;
49-
memcpy(mapping, contents, length);
5049

51-
return true;
50+
if (mapping) {
51+
memcpy(mapping, contents, length);
52+
return true;
53+
} else {
54+
return false;
55+
}
5256
}
5357

5458
bool TextureVK::OnSetContents(std::shared_ptr<const fml::Mapping> mapping,

0 commit comments

Comments
 (0)