Skip to content

Commit

Permalink
Update gpurt from commit 5fa9a2c2
Browse files Browse the repository at this point in the history
Add RayQuery entry functions
Fix bug with calculating update scratch size
Set default value for header.compactedSizeInBytes
Fix update scratch size allocation for force rebuilds
Fix remapping scratchBuffer issues
Use _AmdIsLlpc() helper
Add PAL interface number to compiler definition
Disable shader include validation
Enhance triangle pairing heuristic
  • Loading branch information
qiaojbao committed Aug 28, 2024
1 parent c5b1079 commit cf31636
Show file tree
Hide file tree
Showing 35 changed files with 592 additions and 281 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ if (DEFINED GPURT_CLIENT_INTERFACE_MAJOR_VERSION)
gpurt_add_compile_definitions(GPURT_CLIENT_INTERFACE_MAJOR_VERSION=${GPURT_CLIENT_INTERFACE_MAJOR_VERSION})
endif()

if (DEFINED PAL_CLIENT_INTERFACE_MAJOR_VERSION)
gpurt_add_compile_definitions(PAL_CLIENT_INTERFACE_MAJOR_VERSION=${PAL_CLIENT_INTERFACE_MAJOR_VERSION})
endif()

### Add Source Directories
target_include_directories(gpurt PUBLIC .)
target_include_directories(gpurt_internal PUBLIC .)
Expand Down
13 changes: 3 additions & 10 deletions cmake/GpuRtGenerateShaders.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ list(APPEND gpurtSharedDependencies
${gpurtCompileScript}
)

set(RT_SHADER_VALIDATION_COMMAND "")

# Create custom command that outputs the generated BVH shaders
# The generated shaders depend on all the above mentioned files
if(GPURT_CLIENT_API STREQUAL "VULKAN")
Expand Down Expand Up @@ -130,16 +132,7 @@ if(GPURT_CLIENT_API STREQUAL "VULKAN")
${gpurtStripWhitelist}
${gpurtDxcCompiler}
${gpurtSpirvRemap}

COMMAND Python3::Interpreter "${gpurtCompileScript}"
--outputDir "${gpurtOutputDir}"
--validateShadersClean
${COMPILER_ARGUMENT}
--defines "\"${gpurtDefines}\""
--includePaths "\"${gpurtIncludeDirectories}\""
"${gpurtDxilBvhShader}"
"${gpurtShadersSourceDir}"
"${gpurtSscStrict}"
COMMAND ${RT_SHADER_VALIDATION_COMMAND}

COMMAND Python3::Interpreter "${gpurtCompileScript}"
--vulkan
Expand Down
1 change: 1 addition & 0 deletions cmake/GpurtOptionsCodegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ add_custom_target(generate_gpurtOptions_h
)

target_include_directories(gpurt PUBLIC ${OUTDIR})
target_sources(gpurt INTERFACE ${GPURTOPTIONS_OUTPUT})

7 changes: 6 additions & 1 deletion gpurt/gpurtAccelStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct AccelStructMetadataHeader
// numTasksDone can be reset in one 64 bit CP write.
uint32 numTasksDone; // Number of tasks done
uint32 reserved0[16]; // Reserved
uint32 reserved1[3]; // Reserved
uint32 reserved2[3]; // Reserved
};

#define ACCEL_STRUCT_METADATA_VA_LO_OFFSET 0
Expand All @@ -102,14 +104,17 @@ struct AccelStructMetadataHeader
#define ACCEL_STRUCT_METADATA_TASK_COUNTER_OFFSET 12
#define ACCEL_STRUCT_METADATA_NUM_TASKS_DONE_OFFSET 16
#define ACCEL_STRUCT_METADATA_RESERVED_0 20
#define ACCEL_STRUCT_METADATA_HEADER_SIZE 84
#define ACCEL_STRUCT_METADATA_RESERVED_1 84
#define ACCEL_STRUCT_METADATA_RESERVED_2 96
#define ACCEL_STRUCT_METADATA_HEADER_SIZE 108

GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_HEADER_SIZE == sizeof(AccelStructMetadataHeader), "Acceleration structure header mismatch");
#ifdef __cplusplus
GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_VA_LO_OFFSET == offsetof(AccelStructMetadataHeader, addressLo), "");
GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_VA_HI_OFFSET == offsetof(AccelStructMetadataHeader, addressHi), "");
GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_SIZE_OFFSET == offsetof(AccelStructMetadataHeader, sizeInBytes), "");
GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_TASK_COUNTER_OFFSET == offsetof(AccelStructMetadataHeader, taskCounter), "");
GPURT_STATIC_ASSERT(ACCEL_STRUCT_METADATA_NUM_TASKS_DONE_OFFSET == offsetof(AccelStructMetadataHeader, numTasksDone), "");
#endif

#ifdef __cplusplus
Expand Down
2 changes: 2 additions & 0 deletions gpurt/gpurtBuildSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct CompileTimeBuildSettings
uint32 unused11;
uint32 unused12;
uint32 unused13;
uint32 rebuildAccelStruct;
};

#define BUILD_SETTINGS_DATA_TOP_LEVEL_BUILD_ID 0
Expand Down Expand Up @@ -134,6 +135,7 @@ struct CompileTimeBuildSettings
#define BUILD_SETTINGS_DATA_ENCODE_ARRAY_OF_POINTERS_ID 41
#define BUILD_SETTINGS_DATA_SCENE_BOUNDS_CALCULATION_TYPE_ID 42
#define BUILD_SETTINGS_DATA_REBRAID_QUALITY_HEURISTIC_ID 43
#define BUILD_SETTINGS_DATA_REBUILD_ACCELERATION_STRUCTURE_ID 47

#ifdef __cplusplus
} // namespace GpuRt
Expand Down
2 changes: 2 additions & 0 deletions src/gpurtBvhBatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
**********************************************************************************************************************/

#include "palCmdBuffer.h"
#include "palHashMapImpl.h"
#include "palMetroHash.h"
#include "palVectorImpl.h"

#include "gpurt/gpurt.h"
#include "gpurt/gpurtLib.h"
#include "gpurt/gpurtAccelStruct.h"
#include "gpurt/gpurtInlineFuncs.h"
#include "gpurtInternal.h"
#include "gpurtInternalShaderBindings.h"
#include "gpurtBvhBatcher.h"
Expand Down
Loading

0 comments on commit cf31636

Please sign in to comment.