Commit graph

83 commits

Author SHA1 Message Date
b88f3e9f4c Cleanup unused code
More cleanup of unused code.
2024-04-12 13:24:53 +09:00
4dbae98e8f Cleanup unused code
More cleanup of unused code.
2024-04-12 13:08:05 +09:00
e35a7e8720 Cleanup unused code
Remove unused code and do some cleanup.
2024-04-12 13:03:07 +09:00
997f72ca42 Impl. combine get_filter and minmax in Vk cmd buf
Includes fixes from bugs in previous commit.

Doesn't seem to improve the runtime much, so there may be more room for
optimization...
2024-04-11 13:38:06 +09:00
dfc78540db WIP combine Vulkan filter and min_max to cmd buf
This commit does some preparation for a new Vulkan compute shader
"blue_noise_filter.glsl". Note that every call of "filter" is followed
by a call to "min_max". The goal is to combine a single invocation of
Vulkan "filter" and log(n) invocations of Vulkan "min_max" in the same
command buffer, which may help with performance. This will be achieved
by passing the "max_in_buf" to the new "filter" compute shader, which
will hold the results of applying the precomputed-gaussian. This buffer
will then be copied to "min_in_buf", and then all is set to call the
Vulkan "min_max" compute shader log(n) times.

Note that log(n) comes from the fact that the Vulkan "min_max" compute
shader does a "reduce" on the input buffers where each SIMD invocation
compares two values and reduces it to 1. Doing this approximately log(n)
(log base 2) times will reduce the input gradually into a single minimum
and single maximum. This works due to having two separate "layouts" for
the same "min_max" shader where the "in" and "out" buffers are swapped
per "layout", and so by calling the other layout each time ensures that
the proper buffers are reduced. (This work has already been done. What's
left is to combine the "filter" and "min_max" Vulkan compute shaders
into the same Vulkan command buffer. But first, the actual setup for the
new Vulkan "filter" compute shader still has some work to do.)
2024-04-10 17:43:24 +09:00
728d872af4 Vulkan compute: move buffer init to before fn call 2024-04-03 18:23:46 +09:00
2e6f414baf Vulkan compute: resize max/min out buffers
Change max/min out buffers to have same size as max/min in buffers.
2024-04-03 18:22:14 +09:00
97cfcddfb3 Vulkan compute: minor refactoring 2024-04-03 18:22:14 +09:00
06115a7a2d Vulkan compute: combine all minmax calls
This commit combines the minmax execution via Vulkan compute. The
previous implementation executed compute in vulkan_minmax with a new
command buffer each time. This implementation combines all required
executions of compute in vulkan_minmax in a single command buffer and
uses a pipeline to ensure the enqueued compute calls stay in order.
2024-04-03 18:22:13 +09:00
52e6a09abd Do "minmax" on Vulkan compute
Was an attempt to speed up blue-noise-generation with Vulkan compute,
but this implementation seems to slow it down instead.
2024-04-03 18:20:22 +09:00
ef7f623fb3 Optimize buffer writes in vulkan_get_filter calls
When only a single item in pbp buffer is changed, only update the single
item in the staging buffer and the device buffer prior to Vulkan compute
execution on buffers.
2024-04-03 17:55:37 +09:00
ff36314092 Update README.md 2024-04-01 11:30:42 +09:00
2854aa5104 Make OpenCL default backend
Order of backends to use:
OpenCL -> Vulkan -> CPU threads

Unless I figure out a way to make Vulkan faster, OpenCL will be the
default backend used, or at least it will have higher priority than
Vulkan if both OpenCL and Vulkan is available.
2024-04-01 11:19:55 +09:00
f3d1ad425c Vulkan compute: Minor refactoring 2024-03-27 11:27:43 +09:00
7fb458dad5 Vulkan compute: Minor refactoring 2024-03-26 14:00:46 +09:00
5913b7669b Vulkan compute: Refactor pbp integer setting loop 2024-03-26 13:57:13 +09:00
d137dc44ff inline get_filter in vulkan compute impl. 2024-03-26 13:49:37 +09:00
045d3ef18d Use "invalidate", not "flush" for buffer read 2024-03-26 13:37:51 +09:00
3a97f14199 Use "cached", not "coherent" for staging buffers 2024-03-26 12:21:40 +09:00
2d47b7f892 Attempt to optimize vulkan compute 2024-03-25 16:53:42 +09:00
47ba03337b Impl. Vulkan compute
Tests indicate Vulkan compute runs 2x slower than OpenCL, so there
probably is room for optimization.
2024-03-25 13:27:06 +09:00
d4661996d2 WIP Vulkan compute: descriptor set and command buf
Some more Vulkan initialization code to set up Vulkan compute.
2024-03-25 11:39:50 +09:00
ea66a44238 QueueFamilyIndices struct: fn definitions in .cpp
Instead of defining struct functions in header file, only declare them
in the header file and define them in the source file.
2024-03-22 17:03:56 +09:00
16f0e0e865 Define vulkan specific helper fns in header 2024-03-22 16:59:23 +09:00
03b3c90e9a Minor fix
Fix debug messenger initialization check.
2024-03-21 12:31:38 +09:00
6ed76af210 Restructure vulkan init code
Vulkan init code was resturctured so that "temporary" structs (e.g.
vulkan "info create" structs) are discarded after they are used.
2024-03-21 12:07:46 +09:00
3b11564a4a Addendum note to previous commit
It was assumed in the previous commit's message that the shader data was
stored on the stack. In actuality, the usage of std::vector<char> uses
dynamically allocated memory, which means the data should be on the heap
not the stack.
2024-03-21 11:56:12 +09:00
020993fb19 Refactor: Move shader loading code to inner scope
This prevents the loaded shader data from persisting on the stack even
when it is no longer needed.
2024-03-20 19:25:22 +09:00
d29d2434ab utility::Cleanup: Replace "Nop"
A default constructor suffices where "Nop" was used, so it was removed.
2024-03-20 19:18:37 +09:00
d5d722022c CMakeLists.txt: Debug flag "-Og" instead of "-O0" 2024-03-20 16:20:13 +09:00
3b0a5ab7dd WIP Vulkan compute: Fix buffer data
"filter_size" integer must be odd. This is how it is defined for the
OpenCL implementation.
2024-03-20 16:12:23 +09:00
5cee471f1f WIP Vulkan compute: create buffers 2024-03-20 16:00:47 +09:00
7cca2bfbff WIP vulkan compute: create command pool 2024-03-20 14:29:48 +09:00
a7dc666082 Refactor: code where neither Vulkan/OpenCL is used 2024-03-20 14:29:03 +09:00
bc02b924e2 WIP vulkan compute: create compute pipeline, fixes
Fix Cleanup class.

Implement setting up compute pipeline.
2024-03-20 11:54:38 +09:00
8c1190d923 Refactor glslc usage 2024-03-20 11:11:22 +09:00
bd5cfaebd3 Fix minor typo 2024-03-19 16:24:08 +09:00
6cefcc5f94 Compile glsl with glslc, fixes
Fix incorrectly set "bindings" for descriptors.

Fix blue_gen.glsl .

Program now attempts to compile blue_gen.glsl using "glslc".
2024-03-19 16:13:10 +09:00
b73c6fb94b WIP Vulkan compute: compute descriptors, glsl 2024-03-19 14:58:35 +09:00
a0de033d34 WIP Vulkan compute: initialize VkDevice 2024-03-08 13:48:42 +09:00
38f7248f49 Minor refactoring
Use `const std::array<...>` instead of `const std::vector<...>`.
2024-03-07 16:47:37 +09:00
d0f14585b6 WIP vulkan compute: query physical devices 2024-03-07 12:13:32 +09:00
aaa986b0eb Remove erronous Vulkan init. property
TODO: Vulkan compute
2024-03-06 17:56:30 +09:00
c823f90c14 Update LICENSE year 2024-03-06 17:38:53 +09:00
4e4ee7f558 Begin work on Vulkan compute (WIP)
Some Vulkan initialization stuff WIP.
2024-03-06 17:04:08 +09:00
0da27b59be Fix CMakeLists.txt 2023-07-23 17:34:38 +09:00
834cae6ca5 Rename project/binary-name 2023-04-01 21:48:19 +09:00
d60e9497ff Fix not using OpenCL header on disabled OpenCL 2023-03-31 19:04:25 +09:00
7041f732a9 Fixes/Refactorings to CMakeLists.txt 2023-03-31 18:55:36 +09:00
ecd65fc42b clang-format --style=google 2023-03-31 18:47:33 +09:00