Skip to content

Commit 20e9377

Browse files
stu-skurbeco
authored andcommitted
Add sample for VK_AMDX_dense_geometry_format
1 parent 0cfdd95 commit 20e9377

File tree

18 files changed

+1400
-11
lines changed

18 files changed

+1400
-11
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@
5353
[submodule "third_party/opencl"]
5454
path = third_party/opencl
5555
url = https://github.com/KhronosGroup/OpenCL-Headers.git
56+
[submodule "third_party/DGF-SDK"]
57+
path = third_party/DGF-SDK
58+
url = https://github.com/GPUOpen-LibrariesAndSDKs/DGF-SDK.git

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ Navigate to the following paths to learn more:
3838
- [shaders/gpu_dispatch](./shaders/gpu_dispatch)
3939
- [shaders/gpu_draw_dispatch](./shaders/gpu_draw_dispatch)
4040

41+
# Vulkan Dense Geometry Format sample <!-- omit in toc -->
42+
43+
This branch adds a sample application for the `VK_AMDX_dense_geometry_format` extension that enables
44+
the use of pre-compressed Dense Geometry Format data to build acceleration structures.
45+
46+
To build the sample, follow the standard build instructions.
47+
48+
To run sample, execute with the arguments `sample dense_geometry_format`.
49+
50+
Navigate to the following path to learn more:
51+
- Source code
52+
- [samples/extensions/dense_geometry_format](./samples/extensions/dense_geometry_format)
53+
4154
# Vulkan Samples <!-- omit in toc -->
4255

4356
![Vulkan Samples banner](banner.jpg)

assets_local/teapot.dgf

61.4 KB
Binary file not shown.

framework/core/buffer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* Copyright (c) 2019-2021, Arm Limited and Contributors
2-
*
2+
* Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
3+
*
34
* SPDX-License-Identifier: Apache-2.0
45
*
56
* Licensed under the Apache License, Version 2.0 the "License";
@@ -23,7 +24,7 @@ namespace vkb
2324
{
2425
namespace core
2526
{
26-
Buffer::Buffer(Device const &device, VkDeviceSize size, VkBufferUsageFlags buffer_usage, VmaMemoryUsage memory_usage, VmaAllocationCreateFlags flags, const std::vector<uint32_t> &queue_family_indices) :
27+
Buffer::Buffer(Device const &device, VkDeviceSize size, VkBufferUsageFlags buffer_usage, VmaMemoryUsage memory_usage, VmaAllocationCreateFlags flags, const std::vector<uint32_t> &queue_family_indices, const void *pNext) :
2728
VulkanResource{VK_NULL_HANDLE, &device},
2829
size{size}
2930
{
@@ -36,6 +37,7 @@ Buffer::Buffer(Device const &device, VkDeviceSize size, VkBufferUsageFlags buffe
3637
persistent = (flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
3738

3839
VkBufferCreateInfo buffer_info{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
40+
buffer_info.pNext = pNext;
3941
buffer_info.usage = buffer_usage;
4042
buffer_info.size = size;
4143
if (queue_family_indices.size() >= 2)

framework/core/buffer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2019-2021, Arm Limited and Contributors
2+
* Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
23
*
34
* SPDX-License-Identifier: Apache-2.0
45
*
@@ -44,7 +45,8 @@ class Buffer : public VulkanResource<VkBuffer, VK_OBJECT_TYPE_BUFFER, const Devi
4445
VkBufferUsageFlags buffer_usage,
4546
VmaMemoryUsage memory_usage,
4647
VmaAllocationCreateFlags flags = VMA_ALLOCATION_CREATE_MAPPED_BIT,
47-
const std::vector<uint32_t> &queue_family_indices = {});
48+
const std::vector<uint32_t> &queue_family_indices = {},
49+
const void *pNext = 0);
4850

4951
Buffer(const Buffer &) = delete;
5052

samples/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2019-2023, Arm Limited and Contributors
2+
# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
23
#
34
# SPDX-License-Identifier: Apache-2.0
45
#
@@ -83,6 +84,7 @@ set(ORDER_LIST
8384
"fragment_shader_barycentric"
8485
"gpu_dispatch"
8586
"gpu_draw_dispatch"
87+
"dense_geometry_format"
8688

8789
#Performance Samples
8890
"swapchain_images"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2019-2021, Sascha Willems
2+
# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 the "License";
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
20+
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_LIST_DIR} PATH)
21+
get_filename_component(CATEGORY_NAME ${PARENT_DIR} NAME)
22+
23+
add_sample_with_tags(
24+
ID ${FOLDER_NAME}
25+
CATEGORY ${CATEGORY_NAME}
26+
AUTHOR "Advanced Micro Devices, Inc."
27+
NAME "Dense Geometry Format"
28+
DESCRIPTION "Basic example for using dense geometry format data in ray tracing"
29+
LIBS DGFLib
30+
SHADER_FILES_GLSL
31+
"dense_geometry_format/raygen.rgen"
32+
"dense_geometry_format/miss.rmiss"
33+
"dense_geometry_format/closesthit.rchit")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
- Copyright (c) 2020-2023, The Khronos Group
3+
-
4+
- SPDX-License-Identifier: Apache-2.0
5+
-
6+
- Licensed under the Apache License, Version 2.0 the "License";
7+
- you may not use this file except in compliance with the License.
8+
- You may obtain a copy of the License at
9+
-
10+
- http://www.apache.org/licenses/LICENSE-2.0
11+
-
12+
- Unless required by applicable law or agreed to in writing, software
13+
- distributed under the License is distributed on an "AS IS" BASIS,
14+
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
- See the License for the specific language governing permissions and
16+
- limitations under the License.
17+
-
18+
-->
19+
### Basic hardware accelerated ray tracing
20+
21+
**Extensions**: [```VK_KHR_ray_tracing_pipeline```](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_tracing_pipeline), [```VK_KHR_acceleration_structure```](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_acceleration_structure)
22+
23+
Render a basic scene using the official cross-vendor ray tracing extension. Shows how to setup all data structures required for ray tracing, including the bottom and top level acceleration structures for the geometry, the shader binding table and the ray tracing pipelines with shader groups for ray generation, ray hits, and ray misses. After dispatching the rays, the final result is copied to the swapchain image.

0 commit comments

Comments
 (0)