Skip to content

Commit 3dbe382

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 65fe5e9 commit 3dbe382

File tree

10 files changed

+43
-18
lines changed

10 files changed

+43
-18
lines changed

taichi/program/texture.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ void Texture::from_ndarray(Ndarray *ndarray) {
7474
params.image_extent.z = depth_;
7575

7676
cmdlist->buffer_barrier(ndarray->ndarray_alloc_);
77-
cmdlist->image_transition(texture_alloc_, ImageLayout::undefined, ImageLayout::transfer_dst);
77+
cmdlist->image_transition(texture_alloc_, ImageLayout::undefined,
78+
ImageLayout::transfer_dst);
7879
cmdlist->buffer_to_image(texture_alloc_, ndarray->ndarray_alloc_.get_ptr(0),
7980
ImageLayout::transfer_dst, params);
8081

@@ -125,7 +126,8 @@ void Texture::from_snode(SNode *snode) {
125126
params.image_extent.z = depth_;
126127

127128
cmdlist->buffer_barrier(devptr);
128-
cmdlist->image_transition(texture_alloc_, ImageLayout::undefined, ImageLayout::transfer_dst);
129+
cmdlist->image_transition(texture_alloc_, ImageLayout::undefined,
130+
ImageLayout::transfer_dst);
129131
cmdlist->buffer_to_image(texture_alloc_, devptr, ImageLayout::transfer_dst,
130132
params);
131133

taichi/rhi/device.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ class CommandList {
330330
uint32_t start_instance = 0) {
331331
TI_NOT_IMPLEMENTED
332332
}
333-
virtual void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) {
333+
virtual void image_transition(DeviceAllocation img,
334+
ImageLayout old_layout,
335+
ImageLayout new_layout) {
334336
TI_NOT_IMPLEMENTED
335337
}
336338
virtual void buffer_to_image(DeviceAllocation dst_img,
@@ -617,7 +619,9 @@ class TI_DLL_EXPORT GraphicsDevice : public Device {
617619
virtual DeviceAllocation create_image(const ImageParams &params) = 0;
618620
virtual void destroy_image(DeviceAllocation handle) = 0;
619621

620-
virtual void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout);
622+
virtual void image_transition(DeviceAllocation img,
623+
ImageLayout old_layout,
624+
ImageLayout new_layout);
621625
virtual void buffer_to_image(DeviceAllocation dst_img,
622626
DevicePtr src_buf,
623627
ImageLayout img_layout,

taichi/rhi/dx/dx_device.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ class Dx11CommandList : public CommandList {
144144
void draw_indexed(uint32_t num_indicies,
145145
uint32_t start_vertex = 0,
146146
uint32_t start_index = 0) override;
147-
void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) override;
147+
void image_transition(DeviceAllocation img,
148+
ImageLayout old_layout,
149+
ImageLayout new_layout) override;
148150
void buffer_to_image(DeviceAllocation dst_img,
149151
DevicePtr src_buf,
150152
ImageLayout img_layout,
@@ -193,7 +195,9 @@ class Dx11Device : public GraphicsDevice {
193195
DeviceAllocation create_image(const ImageParams &params) override;
194196
void destroy_image(DeviceAllocation handle) override;
195197

196-
void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) override;
198+
void image_transition(DeviceAllocation img,
199+
ImageLayout old_layout,
200+
ImageLayout new_layout) override;
197201
void buffer_to_image(DeviceAllocation dst_img,
198202
DevicePtr src_buf,
199203
ImageLayout img_layout,

taichi/rhi/opengl/opengl_device.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,9 @@ void GLDevice::destroy_image(DeviceAllocation handle) {
674674
image_to_int_format_.erase(handle.alloc_id);
675675
}
676676

677-
void GLDevice::image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) {
677+
void GLDevice::image_transition(DeviceAllocation img,
678+
ImageLayout old_layout,
679+
ImageLayout new_layout) {
678680
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT |
679681
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
680682
GL_FRAMEBUFFER_BARRIER_BIT);

taichi/rhi/opengl/opengl_device.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ class GLCommandList : public CommandList {
126126
void draw_indexed(uint32_t num_indicies,
127127
uint32_t start_vertex = 0,
128128
uint32_t start_index = 0) override;
129-
void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) override;
129+
void image_transition(DeviceAllocation img,
130+
ImageLayout old_layout,
131+
ImageLayout new_layout) override;
130132
void buffer_to_image(DeviceAllocation dst_img,
131133
DevicePtr src_buf,
132134
ImageLayout img_layout,
@@ -276,7 +278,9 @@ class GLDevice : public GraphicsDevice {
276278
DeviceAllocation create_image(const ImageParams &params) override;
277279
void destroy_image(DeviceAllocation handle) override;
278280

279-
void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) override;
281+
void image_transition(DeviceAllocation img,
282+
ImageLayout old_layout,
283+
ImageLayout new_layout) override;
280284
void buffer_to_image(DeviceAllocation dst_img,
281285
DevicePtr src_buf,
282286
ImageLayout img_layout,

taichi/rhi/vulkan/vulkan_device.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,8 @@ void VulkanSurface::present_image(
24942494
const std::vector<StreamSemaphore> &wait_semaphores) {
24952495
std::vector<VkSemaphore> vk_wait_semaphores;
24962496

2497-
device_->image_transition(get_target_image(), ImageLayout::color_attachment, ImageLayout::present_src);
2497+
device_->image_transition(get_target_image(), ImageLayout::color_attachment,
2498+
ImageLayout::present_src);
24982499

24992500
for (const StreamSemaphore &sema_ : wait_semaphores) {
25002501
auto sema = std::static_pointer_cast<VulkanStreamSemaphoreObject>(sema_);
@@ -2535,7 +2536,8 @@ DeviceAllocation VulkanSurface::get_depth_data(DeviceAllocation &depth_alloc) {
25352536
copy_params.image_extent.y = h;
25362537
copy_params.image_aspect_flag = VK_IMAGE_ASPECT_DEPTH_BIT;
25372538
cmd_list = stream->new_command_list();
2538-
cmd_list->image_transition(depth_alloc, ImageLayout::depth_attachment, ImageLayout::transfer_src);
2539+
cmd_list->image_transition(depth_alloc, ImageLayout::depth_attachment,
2540+
ImageLayout::transfer_src);
25392541
cmd_list->image_to_buffer(depth_buffer_.get_ptr(), depth_alloc,
25402542
ImageLayout::transfer_src, copy_params);
25412543
stream->submit_synced(cmd_list.get());
@@ -2569,7 +2571,8 @@ DeviceAllocation VulkanSurface::get_image_data() {
25692571
screenshot_buffer_ = device_->allocate_memory(params);
25702572
}
25712573

2572-
device_->image_transition(img_alloc, ImageLayout::color_attachment, ImageLayout::transfer_src);
2574+
device_->image_transition(img_alloc, ImageLayout::color_attachment,
2575+
ImageLayout::transfer_src);
25732576

25742577
std::unique_ptr<CommandList> cmd_list{nullptr};
25752578

taichi/rhi/vulkan/vulkan_device.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ class VulkanCommandList : public CommandList {
401401
uint32_t start_index = 0,
402402
uint32_t start_instance = 0) override;
403403
void set_line_width(float width) override;
404-
void image_transition(DeviceAllocation img, ImageLayout old_layout, ImageLayout new_layout) override;
404+
void image_transition(DeviceAllocation img,
405+
ImageLayout old_layout,
406+
ImageLayout new_layout) override;
405407
void buffer_to_image(DeviceAllocation dst_img,
406408
DevicePtr src_buf,
407409
ImageLayout img_layout,

taichi/runtime/gfx/runtime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ void GfxRuntime::copy_image(DeviceAllocation dst,
570570
submit_current_cmdlist_if_timeout();
571571
}
572572
void GfxRuntime::transition_image(DeviceAllocation image, ImageLayout layout) {
573-
ImageLayout& last_layout = last_image_layouts_[image.alloc_id];
573+
ImageLayout &last_layout = last_image_layouts_[image.alloc_id];
574574
ensure_current_cmdlist();
575575
current_cmdlist_->image_transition(image, last_layout, layout);
576576
submit_current_cmdlist_if_timeout();

taichi/ui/backends/vulkan/renderables/set_image.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ void SetImage::update_data(const SetImageInfo &info) {
6161

6262
int pixels = width * height;
6363

64-
app_context_->device().image_transition(texture_, ImageLayout::undefined, ImageLayout::transfer_dst);
64+
app_context_->device().image_transition(texture_, ImageLayout::undefined,
65+
ImageLayout::transfer_dst);
6566

6667
uint64_t img_size = pixels * data_type_size(texture_dtype_) * 4;
6768

@@ -91,10 +92,12 @@ void SetImage::update_data(const SetImageInfo &info) {
9192

9293
auto stream = app_context_->device().get_graphics_stream();
9394
auto cmd_list = stream->new_command_list();
94-
cmd_list->image_transition(texture_, ImageLayout::transfer_src, ImageLayout::transfer_dst);
95+
cmd_list->image_transition(texture_, ImageLayout::transfer_src,
96+
ImageLayout::transfer_dst);
9597
cmd_list->buffer_to_image(texture_, gpu_staging_buffer_.get_ptr(0),
9698
ImageLayout::transfer_dst, copy_params);
97-
cmd_list->image_transition(texture_, ImageLayout::transfer_dst, ImageLayout::shader_read);
99+
cmd_list->image_transition(texture_, ImageLayout::transfer_dst,
100+
ImageLayout::shader_read);
98101
if (data_ready_sema) {
99102
stream->submit(cmd_list.get(), {data_ready_sema});
100103
} else {

taichi/ui/backends/vulkan/swap_chain.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ bool SwapChain::copy_depth_buffer_to_ndarray(
6363

6464
auto depth_staging_buffer = device.allocate_memory(params);
6565

66-
device.image_transition(depth_allocation_, ImageLayout::depth_attachment, ImageLayout::transfer_src);
66+
device.image_transition(depth_allocation_, ImageLayout::depth_attachment,
67+
ImageLayout::transfer_src);
6768

6869
BufferImageCopyParams copy_params;
6970
copy_params.image_extent.x = w;

0 commit comments

Comments
 (0)