Refactor ImBuf buffer access #107609

Merged
Sergey Sharybin merged 8 commits from Sergey/blender:imbuf_buffer_data_refactor into main 2023-05-18 10:19:10 +02:00

8 Commits

Author SHA1 Message Date
Sergey Sharybin e1bfaf2ce8 Merge branch 'main' into imbuf_buffer_data_refactor
buildbot/vexp-code-patch-coordinator Build done. Details
2023-05-18 09:41:45 +02:00
Sergey Sharybin e50a539065 Merge branch 'main' into imbuf_buffer_data_refactor 2023-05-08 11:12:32 +02:00
Sergey Sharybin b7a57cd599 Cleanup: Fix typo ImBug -> ImBuf 2023-05-08 11:07:40 +02:00
Sergey Sharybin 2d3a3d7f50 sizeof(int) -> 4 * sizeof(uint8_t)
In the cases spotted by Brecht.
2023-05-05 21:31:36 +02:00
Sergey Sharybin 679cbe1c2a Fix control reaches end of non-void function
buildbot/vexp-code-patch-coordinator Build done. Details
2023-05-05 19:01:16 +02:00
Sergey Sharybin 3d274bcf30 Fix old API used on Windows GHOST
buildbot/vexp-code-patch-coordinator Build done. Details
2023-05-05 18:51:39 +02:00
Sergey Sharybin 5c3f684000 Merge branch 'main' into imbuf_buffer_data_refactor
buildbot/vexp-code-patch-coordinator Build done. Details
2023-05-05 18:46:09 +02:00
Sergey Sharybin 617f483e5b Refactor ImBuf buffer access
The goal is to make it more explicit and centralized operation to
assign and steal buffer data, with proper ownership tracking.

The buffers and ownership flags are wrapped into their dedicated
structures now.

There should be no functional changes currently, it is a preparation
for allowing implicit sharing of the ImBuf buffers. Additionally, in
the future it is possible to more buffer-specific information (such
as color space) next to the buffer data itself.

The most dangerous part of this change is the change of byte buffer
data from `int*` to `uint8_t*`. In a lot of cases the byte buffer was
cast to `uchar*`, so those casts are now gone. But some code is
operating on `int*` so now there are casts in there. In practice this
should be fine, since we only support 64bit platforms, so allocations
are aligned. The real things to watch out for here is the fact that
allocation and offsetting from the byte buffer now need an explicit 4
channel multiplier.

Once everything is C++ it will be possible to simplify public
functions even further.
2023-05-04 10:38:38 +02:00