Skip to content

Commit 420e115

Browse files
committed
Add source code for RRA V1.1 release
1 parent edcc115 commit 420e115

File tree

167 files changed

+6219
-2906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+6219
-2906
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ __pycache__/
55
build/linux
66
build/mac
77
build/win
8+
cmake-build*/
9+
.idea/
810
documentation/build
911
documentation/source/_build
12+
source/frontend/version.h
13+
Buildinfo.properties
1014
external
1115
.vscode
1216
*.aps

Buildinfo.properties.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUILD_NUMBER=@RRA_BUILD_NUMBER@
2+
VERSION_NUMBER=@RRA_MAJOR_VERSION@.@RRA_MINOR_VERSION@

CMakeLists.txt

+56-35
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/source/renderer/
55
## Specify the top level name of the project - this will define the solution name for Visual Studio
66
project(RRA)
77

8+
# Define version information
9+
set(RRA_MAJOR_VERSION 1)
10+
set(RRA_MINOR_VERSION 1)
11+
if (NOT RRA_BUGFIX_NUMBER)
12+
set(RRA_BUGFIX_NUMBER 0)
13+
endif ()
14+
if (NOT RRA_BUILD_NUMBER)
15+
set(RRA_BUILD_NUMBER 0)
16+
endif ()
17+
string(TIMESTAMP DATE "\"%m/%d/%Y\"")
18+
string(TIMESTAMP YEAR "%Y")
19+
string(TIMESTAMP YEAR_STRING "\"%Y\"")
20+
21+
configure_file("${CMAKE_SOURCE_DIR}/Buildinfo.properties.in" "${CMAKE_SOURCE_DIR}/Buildinfo.properties")
22+
configure_file("${CMAKE_SOURCE_DIR}/source/frontend/version.h.in" "${CMAKE_SOURCE_DIR}/source/frontend/version.h")
23+
824
option(RDF_ENABLE_CXX_BINDINGS "Allow usage of C++ interface for RDF library" ON)
925
option(RDF_STATIC "Build RDF as a static library" OFF)
1026

@@ -19,7 +35,7 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
1935
ENDIF()
2036

2137
set (CMAKE_DEBUG_POSTFIX -d)
22-
set (CMAKE_RELEASE_POSTFIX )
38+
set (CMAKE_RELEASE_POSTFIX)
2339

2440
IF(WIN32)
2541
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../release)
@@ -50,7 +66,7 @@ IF(WIN32)
5066
add_link_options(/STACK:16777216)
5167
ELSEIF(UNIX)
5268
# Use -Wno-missing-field-initializers for CentOS compiler warning
53-
add_compile_options(-D_LINUX -Wno-missing-field-initializers -Wno-ignored-qualifiers)
69+
add_compile_options(-D_LINUX -Wno-missing-field-initializers -Wno-ignored-qualifiers -mno-avx2)
5470
# Allow executable to be double clicked.
5571
add_link_options(-no-pie)
5672
# Use _DEBUG on Unix for Debug Builds (defined automatically on Windows)
@@ -121,18 +137,13 @@ ENDIF(WIN32)
121137
# This is evaluated at project build time - not at CMake generation time
122138
set(BUILD_ROOT $<$<CONFIG:debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<CONFIG:release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}>)
123139

124-
# Define the option to pass to the sphinx documentation job
125-
set(SPHINX_OPTION public)
126-
127-
find_program(SPHINX_EXECUTABLE sphinx-build)
128-
if(NOT SPHINX_EXECUTABLE)
129-
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
130-
endif()
140+
set(DOCS_OUTPUT_DIR ${BUILD_ROOT})
131141

132142
# group sphinx source files into a sphinx folder
133143
file(GLOB SPHINX_DOC_FILES ${SPHINX_DOC_FILES} ${CMAKE_SOURCE_DIR}/documentation/source/*.rst)
134144
set (SPHINX_DOC_MAIN ${CMAKE_SOURCE_DIR}/documentation/source/conf.py)
135-
source_group("sphinx" FILES ${SPHINX_DOC_FILES} ${SPHINX_DOC_MAIN})
145+
set (ALL_SPHINX_FILES ${SPHINX_DOC_FILES} ${SPHINX_DOC_MAIN})
146+
source_group("sphinx" FILES ${ALL_SPHINX_FILES})
136147

137148
# group release documents into a release_docs folder
138149
set (RELEASE_DOCS_IN_ROOT
@@ -144,33 +155,43 @@ set (RELEASE_DOCS_IN_ROOT
144155
set (RELEASE_DOCS ${RELEASE_DOCS_IN_ROOT})
145156
source_group("release_docs" FILES ${RELEASE_DOCS})
146157

147-
# hang the sphinx build on the conf.py file and specify a dummy output ("sphinx_output")
148-
# this ensures the sphinx docs are built everytime you ask to build the Documentation target
149-
# Sphinx has proper dependency checking, so this works as expected.
150-
# Once built, clean up any unneeded files.
151-
add_custom_target(Documentation SOURCES ${SPHINX_DOC_FILES} ${RELEASE_DOCS} DEPENDS sphinx_output)
152-
add_custom_command(MAIN_DEPENDENCY ${SPHINX_DOC_MAIN} OUTPUT sphinx_output
153-
COMMAND ${CMAKE_COMMAND} -E echo "building Sphinx documentation"
154-
COMMAND ${SPHINX_EXECUTABLE} ${CMAKE_SOURCE_DIR}/documentation/source ${BUILD_ROOT}/docs/help/rra/html/. -t ${SPHINX_OPTION}
155-
COMMAND ${CMAKE_COMMAND} -E remove_directory ${BUILD_ROOT}/docs/help/rra/html/.doctrees
156-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/blas_instance_list.html
157-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/blas_list.html
158-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/blas_properties.html
159-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/blas_viewer.html
160-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/capture.html
161-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/overview.html
162-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/settings.html
163-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/tlas_instance_list.html
164-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/tlas_properties.html
165-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/tlas_viewer.html
166-
COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_ROOT}/docs/help/rra/html/triangle_list.html
167-
)
158+
find_program(SPHINX_EXECUTABLE sphinx-build)
159+
if(SPHINX_EXECUTABLE)
160+
# Define the option to pass to the sphinx documentation job
161+
set(SPHINX_OPTION public)
162+
163+
# hang the sphinx build on the conf.py file and specify a dummy output ("sphinx_output")
164+
# this ensures the sphinx docs are built everytime you ask to build the Documentation target
165+
# Sphinx has proper dependency checking, so this works as expected.
166+
# Once built, clean up any unneeded files.
167+
add_custom_target(Documentation ALL SOURCES ${ALL_SPHINX_FILES} ${RELEASE_DOCS} DEPENDS sphinx_output)
168+
add_custom_command(MAIN_DEPENDENCY ${SPHINX_DOC_MAIN} OUTPUT sphinx_output
169+
COMMAND ${CMAKE_COMMAND} -E echo "building Sphinx documentation"
170+
COMMAND ${SPHINX_EXECUTABLE} ${CMAKE_SOURCE_DIR}/documentation/source ${DOCS_OUTPUT_DIR}/docs/help/rra/html/. -t ${SPHINX_OPTION}
171+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOCS_OUTPUT_DIR}/docs/help/rra/html/.doctrees
172+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/blas_instance_list.html
173+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/blas_list.html
174+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/blas_properties.html
175+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/blas_viewer.html
176+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/capture.html
177+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/overview.html
178+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/settings.html
179+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/tlas_instance_list.html
180+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/tlas_properties.html
181+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/tlas_viewer.html
182+
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/docs/help/rra/html/triangle_list.html
183+
)
184+
else()
185+
message(WARNING "SPHINX_EXECUTABLE (sphinx-build) is not found! Documentation will not be built!")
186+
# If the sphinx binary isn't found, then just create the Documentation project with only the release docs in it.
187+
add_custom_target(Documentation ALL SOURCES ${ALL_SPHINX_FILES} ${RELEASE_DOCS})
188+
endif()
168189

169190
add_custom_command(TARGET Documentation POST_BUILD
170191
COMMAND ${CMAKE_COMMAND} -E echo "copying Documentation to output directory"
171-
COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_ROOT}/docs
172-
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RELEASE_DOCS_IN_ROOT} ${BUILD_ROOT}/.
192+
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCS_OUTPUT_DIR}/docs
193+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RELEASE_DOCS_IN_ROOT} ${DOCS_OUTPUT_DIR}/.
173194
COMMAND ${CMAKE_COMMAND} -E echo "copying Samples to output directory"
174-
COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_ROOT}/samples
175-
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/samples/landscape.rra ${BUILD_ROOT}/samples/sample_trace.rra
195+
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCS_OUTPUT_DIR}/samples
196+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/samples/landscape.rra ${DOCS_OUTPUT_DIR}/samples/sample_trace.rra
176197
)
1.26 KB
Binary file not shown.
5.13 KB
Binary file not shown.
1.26 KB
Binary file not shown.
4.63 KB
Binary file not shown.
4.5 KB
Binary file not shown.
4.93 KB
Binary file not shown.
Loading

source/backend/api_info.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ namespace rra
4646
uint64_t payload_size = chunk_file.GetChunkDataSize(identifier);
4747

4848
std::vector<std::uint8_t> header(header_size);
49-
std::vector<std::uint8_t> payload(payload_size);
5049

5150
if (header_size > 0)
5251
{
@@ -55,7 +54,7 @@ namespace rra
5554

5655
if (payload_size > 0)
5756
{
58-
chunk_file.ReadChunkDataToBuffer(identifier, this);
57+
chunk_file.ReadChunkDataToBuffer(identifier, &chunk_data_);
5958
}
6059

6160
chunk_data_valid_ = true;

source/backend/asic_info.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ namespace rra
4646
uint64_t payload_size = chunk_file.GetChunkDataSize(identifier);
4747

4848
std::vector<std::uint8_t> header(header_size);
49-
std::vector<std::uint8_t> payload(payload_size);
5049

5150
if (header_size > 0)
5251
{
@@ -55,7 +54,7 @@ namespace rra
5554

5655
if (payload_size > 0)
5756
{
58-
chunk_file.ReadChunkDataToBuffer(identifier, this);
57+
chunk_file.ReadChunkDataToBuffer(identifier, &chunk_data_);
5958
}
6059

6160
chunk_data_valid_ = true;
@@ -210,4 +209,14 @@ namespace rra
210209
return kRraOk;
211210
}
212211

212+
RraErrorCode AsicInfo::GetGfxIpLevelMajor(uint16_t* out_gfx_ip_level)
213+
{
214+
if (!chunk_data_valid_)
215+
{
216+
return kRraErrorMalformedData;
217+
}
218+
*out_gfx_ip_level = chunk_data_.gfx_ip_level.major;
219+
return kRraOk;
220+
}
221+
213222
} // namespace rra

source/backend/asic_info.h

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ namespace rra
110110
/// @return kRraOk if successful or error code if not.
111111
RraErrorCode GetVideoMemoryBusWidth(int32_t* out_bus_width) const;
112112

113+
/// @brief Get the Gfx ip level major.
114+
///
115+
/// @param [out] A variable to receive the gfx ip level major.
116+
///
117+
/// @return kRraOk if successful or error code if not.
118+
RraErrorCode GetGfxIpLevelMajor(uint16_t* out_gfx_ip_level);
119+
113120
/// @brief enum of GPU types.
114121
enum class TraceGpuType : uint32_t
115122
{

source/backend/bvh/bvh_bundle.cpp

+29-14
Original file line numberDiff line numberDiff line change
@@ -132,25 +132,28 @@ namespace rta
132132
return empty_placeholder_;
133133
}
134134

135-
/// @brief Load a "RawAccelStruc" chunk.
135+
/// @brief Load a "RawAccelStruct" chunk.
136136
///
137-
/// @param [in] chunk_file The chunk file to load from.
138-
/// @param [in] chunk_index The chunk index in the chunk file.
139-
/// @param [in] chunk_header Reference to the chunk header data.
140-
/// @param [in] import_option Flag indicating which sections of the chunk to load/discard.
137+
/// @param [in] chunk_file The chunk file to load from.
138+
/// @param [in] chunk_index The chunk index in the chunk file.
139+
/// @param [in] chunk_header Reference to the chunk header data.
140+
/// @param [in] chunk_identifier The BVH chunk name.
141+
/// @param [in] import_option Flag indicating which sections of the chunk to load/discard.
142+
/// @param [out] bvh The loaded BVH data.
141143
///
142144
/// @return The BVH object loaded in if successful or nullptr if error.
143145
static std::unique_ptr<IBvh> LoadRtIp11RawAccelStrucAtChunkFileIndex(rdf::ChunkFile& chunk_file,
144146
const std::int32_t chunk_index,
145147
const RawAccelStructRdfChunkHeader& chunk_header,
148+
const char* const chunk_identifier,
146149
const BvhBundleReadOption import_option,
147150
std::unique_ptr<IEncodedRtIp11Bvh>&& bvh)
148151
{
149-
const std::uint32_t version = chunk_file.GetChunkVersion(IEncodedRtIp11Bvh::kChunkIdentifier, chunk_index);
152+
const std::uint32_t version = chunk_file.GetChunkVersion(chunk_identifier, chunk_index);
150153
std::uint32_t major_version = version >> 16;
151154
if (major_version <= GPURT_ACCEL_STRUCT_MAJOR_VERSION)
152155
{
153-
if (bvh->LoadRawAccelStrucFromFile(chunk_file, chunk_index, chunk_header, import_option) == true)
156+
if (bvh->LoadRawAccelStrucFromFile(chunk_file, chunk_index, chunk_header, chunk_identifier, import_option) == true)
154157
{
155158
return std::move(bvh);
156159
}
@@ -172,7 +175,11 @@ namespace rta
172175
{
173176
try
174177
{
175-
chunk_file.ContainsChunk(identifier);
178+
bool result = chunk_file.ContainsChunk(identifier);
179+
if (result == false)
180+
{
181+
return result;
182+
}
176183
}
177184
catch (...)
178185
{
@@ -195,7 +202,16 @@ namespace rta
195202
RraErrorCode* io_error_code)
196203
{
197204
// Check if all expected identifiers are contained in the chunk file
198-
if (!IdentifiersContainedInChunkFile({IEncodedRtIp11Bvh::kChunkIdentifier}, chunk_file))
205+
const char* bvh_identifier = nullptr;
206+
if (IdentifiersContainedInChunkFile({IEncodedRtIp11Bvh::kAccelChunkIdentifier1}, chunk_file))
207+
{
208+
bvh_identifier = IEncodedRtIp11Bvh::kAccelChunkIdentifier1;
209+
}
210+
else if (IdentifiersContainedInChunkFile({IEncodedRtIp11Bvh::kAccelChunkIdentifier2}, chunk_file))
211+
{
212+
bvh_identifier = IEncodedRtIp11Bvh::kAccelChunkIdentifier2;
213+
}
214+
else
199215
{
200216
*io_error_code = kRraErrorNoASChunks;
201217
return nullptr;
@@ -204,7 +220,6 @@ namespace rta
204220
std::vector<std::unique_ptr<IBvh>> top_level_bvhs;
205221
std::vector<std::unique_ptr<IBvh>> bottom_level_bvhs;
206222

207-
const auto bvh_identifier = IEncodedRtIp11Bvh::kChunkIdentifier;
208223
const auto bvh_chunk_count = chunk_file.GetChunkCount(bvh_identifier);
209224

210225
std::unordered_map<GpuVirtualAddress, std::uint64_t> tlas_map;
@@ -233,8 +248,8 @@ namespace rta
233248
// Call the load function here, passing in a reference to the header as a parameter.
234249
if (header.flags.blas == 1)
235250
{
236-
bottom_level_bvhs.emplace_back(
237-
LoadRtIp11RawAccelStrucAtChunkFileIndex(chunk_file, ci, header, import_option, std::make_unique<EncodedRtIp11BottomLevelBvh>()));
251+
bottom_level_bvhs.emplace_back(LoadRtIp11RawAccelStrucAtChunkFileIndex(
252+
chunk_file, ci, header, bvh_identifier, import_option, std::make_unique<EncodedRtIp11BottomLevelBvh>()));
238253
if (bottom_level_bvhs.back() == nullptr)
239254
{
240255
*io_error_code = kRraErrorMalformedData;
@@ -249,8 +264,8 @@ namespace rta
249264
}
250265
else
251266
{
252-
top_level_bvhs.emplace_back(
253-
LoadRtIp11RawAccelStrucAtChunkFileIndex(chunk_file, ci, header, import_option, std::make_unique<EncodedRtIp11TopLevelBvh>()));
267+
top_level_bvhs.emplace_back(LoadRtIp11RawAccelStrucAtChunkFileIndex(
268+
chunk_file, ci, header, bvh_identifier, import_option, std::make_unique<EncodedRtIp11TopLevelBvh>()));
254269
if (top_level_bvhs.back() == nullptr)
255270
{
256271
*io_error_code = kRraErrorMalformedData;

source/backend/bvh/dxr_definitions.h

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ namespace dxr
172172
constexpr std::uint32_t kInvalidNode = UINT32_MAX;
173173
constexpr std::uint32_t kInstanceNodeSize = 128;
174174
constexpr std::uint32_t kFp32BoxNodeSize = 128;
175-
constexpr std::uint32_t kFp32HalfBoxNodeSize = kFp32BoxNodeSize / 2;
176175
constexpr std::uint32_t kFp16BoxNodeSize = 64;
177176
constexpr std::uint32_t kLeafNodeSize = 64;
178177
constexpr std::uint32_t kInstanceExtraDataSize = 64;

source/backend/bvh/encoded_rt_ip_11_bottom_level_bvh.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ namespace rta
9696
bool EncodedRtIp11BottomLevelBvh::LoadRawAccelStrucFromFile(rdf::ChunkFile& chunk_file,
9797
const std::uint64_t chunk_index,
9898
const RawAccelStructRdfChunkHeader& chunk_header,
99+
const char* const chunk_identifier,
99100
const BvhBundleReadOption import_option)
100101
{
101-
const auto identifier = IEncodedRtIp11Bvh::kChunkIdentifier;
102+
const auto identifier = chunk_identifier;
102103
const auto data_size = chunk_file.GetChunkDataSize(identifier, static_cast<uint32_t>(chunk_index));
103104
const bool skip_meta_data = static_cast<std::uint8_t>(import_option) & static_cast<std::uint8_t>(BvhBundleReadOption::kNoMetaData);
104105

@@ -113,7 +114,7 @@ namespace rta
113114
memcpy(&meta_data_, buffer.data() + chunk_header.meta_header_offset, chunk_header.meta_header_size);
114115
}
115116

116-
if (buffer.size() < (dxr::amd::kAccelerationStructureHeaderSize + chunk_header.header_offset))
117+
if (buffer.size() < ((size_t)dxr::amd::kAccelerationStructureHeaderSize + chunk_header.header_offset))
117118
{
118119
return false;
119120
}

source/backend/bvh/encoded_rt_ip_11_bottom_level_bvh.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ namespace rta
5757

5858
/// @brief Load the BVH data from a file.
5959
///
60-
/// @param [in] chunk_file A Reference to a ChunkFile object which describes the file chunk being loaded.
61-
/// @param [in] chunk_index The index of the chunk in the file.
62-
/// @param [in] header The raw acceleration structure header.
63-
/// @param [in] import_option Flag indicating which sections of the chunk to load/discard.
60+
/// @param [in] chunk_file A Reference to a ChunkFile object which describes the file chunk being loaded.
61+
/// @param [in] chunk_index The index of the chunk in the file.
62+
/// @param [in] header The raw acceleration structure header.
63+
/// @param [in] chunk_identifier The BVH chunk name.
64+
/// @param [in] import_option Flag indicating which sections of the chunk to load/discard.
6465
///
6566
/// @return true if the BVH data loaded successfully, false if not.
6667
bool LoadRawAccelStrucFromFile(rdf::ChunkFile& chunk_file,
6768
const std::uint64_t chunk_index,
6869
const RawAccelStructRdfChunkHeader& header,
70+
const char* const chunk_identifier,
6971
const BvhBundleReadOption import_option) override;
7072

7173
/// @brief Do the post-load step.

0 commit comments

Comments
 (0)