-
Notifications
You must be signed in to change notification settings - Fork 781
Add a new sample - subgroups operations #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Patryk-Jastrzebski-Mobica
wants to merge
90
commits into
KhronosGroup:main
Choose a base branch
from
Mobica:subgroups_operations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
e275c44
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica 00fe99c
Add ocean fft
Patryk-Jastrzebski-Mobica fe0326f
Fix grid generation algorithm
Patryk-Jastrzebski-Mobica 0cd32b8
Add compute pipeline and compute queue
Patryk-Jastrzebski-Mobica 44aa375
Add ability to resize the grid in the UI and a few small changes
Patryk-Jastrzebski-Mobica 3ea91d5
Animated grid using the sine and cosine functions
Patryk-Jastrzebski-Mobica fc9009f
Add a new compute pipeline
Patryk-Jastrzebski-Mobica 8026831
Fixed a descriptor set, the function generating random numbers has be…
Patryk-Jastrzebski-Mobica b62b93f
Transfer of philips spectrum calculation from GPU to CPU.
Patryk-Jastrzebski-Mobica db0b8b2
Refactoring and changes in graphic pipeline
Patryk-Jastrzebski-Mobica b3dce47
Add the FBAttachment type
Krzysztof-Dmitruk-Mobica 063784f
Add butterfly precomp shader and texture
Krzysztof-Dmitruk-Mobica b2b74ac
Add tilde textures and pipeline
Patryk-Jastrzebski-Mobica d5f02b8
Refactor and add butterfly and tild texture generation
Patryk-Jastrzebski-Mobica ea1ec9a
Some fixes
Patryk-Jastrzebski-Mobica afd5394
Fix access to input buffers
Patryk-Jastrzebski-Mobica 833f876
Add fft pipeline for rows
Patryk-Jastrzebski-Mobica 069325f
Add vertical fft calculation
Patryk-Jastrzebski-Mobica e2f56c3
Add invert fft and clean-up
Patryk-Jastrzebski-Mobica bdf453c
Fix validation layer errors and fix tessellation shaders
Patryk-Jastrzebski-Mobica 0cdb18f
some fixes
Patryk-Jastrzebski-Mobica 7616cb0
Fix tilde_h_0 indexation
kdmitruk 1a77ac4
Fix log_2_N rounding
Krzysztof-Dmitruk-Mobica b5851d4
Some fixes, add tessellation
Patryk-Jastrzebski-Mobica 085e026
Fix a buttlefly pipeline
Patryk-Jastrzebski-Mobica f6396bb
Add tilde_h_0 shader
Krzysztof-Dmitruk-Mobica 74371bd
Split fft steps into separate calls
Krzysztof-Dmitruk-Mobica 7070474
Fix input data randomization
Krzysztof-Dmitruk-Mobica 20dd48b
Code cleanup
Krzysztof-Dmitruk-Mobica a318c32
rewrite the grid generation
Patryk-Jastrzebski-Mobica 9db394f
fixed validation layers issues and add changes to ocean pipeline
Patryk-Jastrzebski-Mobica 5595c3e
animation fix
Patryk-Jastrzebski-Mobica 263aed9
add normal map
Patryk-Jastrzebski-Mobica 3a1820b
Fix interpolation of a tessellated grid
Krzysztof-Dmitruk-Mobica 418b72a
some fixes and new ui params
Patryk-Jastrzebski-Mobica 8c6d419
ui update
Patryk-Jastrzebski-Mobica d10c00b
Add wind coordinate conversion
Krzysztof-Dmitruk-Mobica 364b71a
refactor
Patryk-Jastrzebski-Mobica c95ec21
shader clean-up
Patryk-Jastrzebski-Mobica 2da30e5
add skybox
Patryk-Jastrzebski-Mobica a159bf4
rebase
Patryk-Jastrzebski-Mobica cd0835c
update ui
Patryk-Jastrzebski-Mobica 732a961
fix normal map
Patryk-Jastrzebski-Mobica 6ec6f78
add a new ui elements
Patryk-Jastrzebski-Mobica 651489c
Fix skybox cliping issue
Patryk-Jastrzebski-Mobica 680532d
Add (broken) reflection
Krzysztof-Dmitruk-Mobica e3d04bd
A rebase fix
Patryk-Jastrzebski-Mobica 33ab6f1
use initialisation functions to initialise objects
Patryk-Jastrzebski-Mobica 00a1ba2
[WIP] reflections experiments
Patryk-Jastrzebski-Mobica ba96ffa
Convert a README.md file to a README.adoc file
Patryk-Jastrzebski-Mobica b430bc4
[WIP] Add BRDF reflection
Patryk-Jastrzebski-Mobica 9e57d20
Add pipeline barriers, update README file
Patryk-Jastrzebski-Mobica cec852f
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica 570de4b
Fix build issues after merging main and remove VL errors
Seweryn-Zielas-Mobica 60d9f9b
Fixing synchronization in barriers - still in progress
Seweryn-Zielas-Mobica 9f5540f
Removed write/read hazards
Seweryn-Zielas-Mobica acdaaf1
Add image memory barriers
Piotr-Plebanski-Mobica e415e0d
Rebase and update
Piotr-Plebanski-Mobica 8756cb3
Fix tesselation shaders
Piotr-Plebanski-Mobica 163099e
WIP optimize barriers
Piotr-Plebanski-Mobica c37fdaf
[WIP3] subgroups -Rebase and compilation fix
Patryk-Jastrzebski-Mobica 85d4bab
shaders update
Patryk-Jastrzebski-Mobica 3968ef7
WIP subgroups - fixed normal map generation, fixed reflections
Patryk-Jastrzebski-Mobica 52a231f
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica 269d664
Add ocean fft
Patryk-Jastrzebski-Mobica 68fc42b
Add compute pipeline and compute queue
Patryk-Jastrzebski-Mobica 827d8c4
Add ability to resize the grid in the UI and a few small changes
Patryk-Jastrzebski-Mobica 8af8b9c
Animated grid using the sine and cosine functions
Patryk-Jastrzebski-Mobica 88aa8a4
Add a new compute pipeline
Patryk-Jastrzebski-Mobica d3fd571
Fixed a descriptor set, the function generating random numbers has be…
Patryk-Jastrzebski-Mobica 81233dd
Transfer of philips spectrum calculation from GPU to CPU.
Patryk-Jastrzebski-Mobica 112c260
Refactoring and changes in graphic pipeline
Patryk-Jastrzebski-Mobica 0972161
Add the FBAttachment type
Krzysztof-Dmitruk-Mobica e92e60a
Add butterfly precomp shader and texture
Krzysztof-Dmitruk-Mobica 33691ae
Add tilde textures and pipeline
Patryk-Jastrzebski-Mobica 259a74d
Refactor and add butterfly and tild texture generation
Patryk-Jastrzebski-Mobica 7501909
Add invert fft and clean-up
Patryk-Jastrzebski-Mobica 64f366d
Some fixes, add tessellation
Patryk-Jastrzebski-Mobica b7b7798
add skybox
Patryk-Jastrzebski-Mobica ec7b26c
Convert a README.md file to a README.adoc file
Patryk-Jastrzebski-Mobica 204bfb4
Add pipeline barriers, update README file
Patryk-Jastrzebski-Mobica c0065a5
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica 4d94890
[WIP3] subgroups -Rebase and compilation fix
Patryk-Jastrzebski-Mobica 213059b
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica 5fa5527
A rebase fix
Patryk-Jastrzebski-Mobica acbbaac
[WIP] reflections experiments
Patryk-Jastrzebski-Mobica f1936a7
Add a new sample - subgroups operation
Patryk-Jastrzebski-Mobica dae01a0
[WIP] Remove skybox to make sample simpler. Update copyright data and…
Patryk-Jastrzebski-Mobica 8340fc9
[WIP] Add missing description, enable subgroup basic feature in fft_t…
Patryk-Jastrzebski-Mobica 1f26700
Update README and add option to disable/enable subgroups
Patryk-Jastrzebski-Mobica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright (c) 2024, Mobica Limited | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 the "License"; | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) | ||
| get_filename_component(PARENT_DIR ${CMAKE_CURRENT_LIST_DIR} PATH) | ||
| get_filename_component(CATEGORY_NAME ${PARENT_DIR} NAME) | ||
|
|
||
| add_sample( | ||
| ID ${FOLDER_NAME} | ||
| CATEGORY ${CATEGORY_NAME} | ||
| AUTHOR "Mobica" | ||
| NAME "subgroups_operations" | ||
| DESCRIPTION "Demonstrates the use of a subgroups operations feature" | ||
| SHADER_FILES_GLSL | ||
| "subgroups_operations/ocean.vert" | ||
| "subgroups_operations/ocean.frag" | ||
| "subgroups_operations/ocean.tesc" | ||
| "subgroups_operations/ocean.tese" | ||
| "subgroups_operations/fft_invert.comp" | ||
| "subgroups_operations/butterfly_precomp.comp" | ||
| "subgroups_operations/fft_tilde_h.comp" | ||
| "subgroups_operations/fft_tilde_h0.comp" | ||
| "subgroups_operations/fft_normal_map.comp" | ||
| "subgroups_operations/fft.comp" | ||
| "subgroups_operations/fft_invert_subgroups_off.comp" | ||
| "subgroups_operations/butterfly_precomp_subgroups_off.comp" | ||
| "subgroups_operations/fft_tilde_h_subgroups_off.comp" | ||
| "subgroups_operations/fft_tilde_h0_subgroups_off.comp" | ||
| "subgroups_operations/fft_normal_map_subgroups_off.comp" | ||
| "subgroups_operations/fft_subgroups_off.comp") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| //// | ||
| Copyright (c) 2024, Mobica Limited | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| Licensed under the Apache License, Version 2.0 the "License"; | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| //// | ||
| = Subgroups Operations | ||
| == Overview | ||
| The example demonstrates the use of the feature subgroups operations. An ocean animation based on the FFT is implemented to demonstrate this feature (Fast Fourier Transform https://en.wikipedia.org/wiki/Fast_Fourier_transform). | ||
| image:image/image.png[] | ||
| Subgroups operation feature introduces a mechanism to share data between the invocations that run in parallel on a single compute unit. | ||
| == GLSL Shaders | ||
| To make full use of the feature subgroups operation, one of the following extensions must be enabled: | ||
| * `#extension GL_KHR_shader_subgroup_basic` | ||
| * `#extension GL_KHR_shader_subgroup_vote` | ||
| * `#extension GL_KHR_shader_subgroup_ballot` | ||
| * `#extension GL_KHR_shader_subgroup_arithmetic` | ||
| * `#extension GL_KHR_shader_subgroup_shuffle` | ||
| * `#extension GL_KHR_shader_subgroup_shuffle_relative` | ||
| * `#extension GL_KHR_shader_subgroup_clustered` | ||
| * `#extension GL_KHR_shader_subgroup_quad` | ||
| This sample focuse on `GL_KHR_shader_subgroup_basic` extension. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: focuse -> focuses |
||
| More about subgroups you can read in this article https://www.khronos.org/blog/vulkan-subgroup-tutorial. | ||
| == Enabling the Feature | ||
| In order to use subgroups operations, the required extensions must be enabled, an instance of the Vulkan API must be created with a minimum of version 1.1 and SPIR-V 1.4 must be used. | ||
| VkDevice must be created with this `VK_EXT_subgroup_size_control` extension. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo |
||
| It is also required to enable `VK_KHR_spirv_1_4` and `VK_KHR_shader_float_controls` in addition (`VK_KHR_spirv_1_4` requires this). | ||
| To get the properties of the supported subgroups, the following should be taken: | ||
| [,cpp] | ||
| ---- | ||
| VkPhysicalDeviceSubgroupProperties subgroups_properties; | ||
| subgroups_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; | ||
| subgroups_properties.pNext = VK_NULL_HANDLE; | ||
| VkPhysicalDeviceProperties2 device_properties2 = {}; | ||
| device_properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; | ||
| device_properties2.pNext = &subgroups_properties; | ||
| vkGetPhysicalDeviceProperties2(gpu.get_handle(), &device_properties2); | ||
| ---- | ||
| == Documentation | ||
| * https://docs.vulkan.org/guide/latest/subgroups.html | ||
| * https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceSubgroupProperties.html | ||
| * https://www.khronos.org/blog/vulkan-subgroup-tutorial | ||
| == Sources | ||
| The implementation was based on the following sources: | ||
| * https://tore.tuhh.de/entities/publication/1cd390d3-732b-41c1-aa2b-07b71a64edd2 | ||
| * https://people.computing.clemson.edu/~jtessen/reports/papers_files/coursenotes2004.pdf | ||
| * https://github.com/achalpandeyy/OceanFFT | ||
| * https://github.com/deiss/fftocean | ||
| * https://github.com/iamyoukou/fftWater | ||
| == Authors | ||
| * Patryk Jastrzębski | ||
| * Krzysztof Dmitruk | ||
| * Seweryn Zielas | ||
| * Piotr Plenański | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems, you've removed a couple of samples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mobica#9 <-- hopefully they are not removed after the merge.