Skip to content
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

Faster backend init, Agility SDK, other changes #68

Open
wants to merge 133 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
1c16e9b
Enable /WX in MSVC
jkunstwald Jun 12, 2021
f72b15e
Fix warnings
jkunstwald Jul 26, 2021
3d08ea1
Vulkan: Rename some SPIR-V utilities, add attempt to fake missing des…
jkunstwald Jul 28, 2021
53a1160
Vulkan: Remove includes, simplify scratch alloc mechanism, clean up
jkunstwald Jul 28, 2021
a22d24c
Vulkan: Rewrite layer/extension search, use scratch allocation, remov…
jkunstwald Jul 28, 2021
e908ba5
Improve buffer size display in debug names
jkunstwald Aug 16, 2021
9f8691e
Add D3D12 Agility SDK support
jkunstwald Aug 17, 2021
d5db3ad
Fix D3D12 shader table root const ordering
jkunstwald Aug 17, 2021
35c1840
Add missing DLL exports
jkunstwald Aug 17, 2021
2b22116
Add RT PSO debug names
jkunstwald Aug 17, 2021
ddbf5c5
Minor change
jkunstwald Aug 17, 2021
0a6a8ff
Fix root constant access in RT shader tables
jkunstwald Aug 17, 2021
ee35448
Add si_print, fix space in byte_print
jkunstwald Aug 19, 2021
ad44711
Add possibility to supply own scratch buffer for RT AS builds
jkunstwald Aug 20, 2021
13a95ec
Add parallel init option to D3D12 backend, minor changes
jkunstwald Sep 2, 2021
10d2f9c
Fix DLL copy destination on VS
jkunstwald Sep 3, 2021
20eb1fb
Minor change
jkunstwald Sep 5, 2021
fa77c75
Add D3D12 launch fastpath for 'first' gpu preference
jkunstwald Sep 7, 2021
8906d3a
Use buffer_address in more commands
jkunstwald Sep 9, 2021
3ee11a5
Add D3D12 PSO cache control options
jkunstwald Sep 9, 2021
27baafd
Add option to delay D3D12 queue init
jkunstwald Sep 10, 2021
41a6bf3
Add handles to fwd.hh
jkunstwald Sep 10, 2021
07b2b3d
Add option to set the global profiler scope of a command list
jkunstwald Sep 18, 2021
8486d55
D3D12: Add optick profile nesting
jkunstwald Sep 23, 2021
d99216c
Fix warnings
jkunstwald Oct 1, 2021
11be5d1
Adapt to rlog api
jkunstwald Oct 8, 2021
a9ebe3f
3D texture copies and smaller texture region copies
jkunstwald Oct 9, 2021
09f522e
Minor cleanup to thread association
jkunstwald Oct 28, 2021
793323e
Minor changes to static assert messages
jkunstwald Oct 30, 2021
be8630c
Add buffer address types to fwd
jkunstwald Nov 4, 2021
4cfd511
Improve DRED recovery messages, add custom out-of-bounds texture copy…
jkunstwald Nov 7, 2021
7869502
Add messages about unsupported GPUs on startup in d3d12
Nov 11, 2021
2489aae
Fix warnings
Nov 12, 2021
f01833d
D3D12: Return null pso handle instead of asserting on PSO compile errors
jkunstwald Nov 14, 2021
16e7177
Minor changes
jkunstwald Nov 21, 2021
8b53056
D3D12: remove indirect draw constraint
Nov 23, 2021
374f28f
Rewrite cmd::draw_indirect, add Draw ID Mode for D3D12
jkunstwald Nov 23, 2021
6fa4ed5
Use uint64 for page allocator
jkunstwald Nov 28, 2021
2039768
Add D3D11On12 optional native feature
Dec 7, 2021
0b43142
D3D12: Add getters for native D3D11On12 objects
Dec 7, 2021
6219168
D3D12: Provide latest versions of D3D11 device and immediate context
Dec 8, 2021
4f92b70
Byte reader: minor change
jkunstwald Dec 8, 2021
ed4d51f
Add return codes to backend init methods instead of asserting on miss…
Dec 13, 2021
4d4b685
Align framebuffer_config, add SSE hash for arbitrary data
jkunstwald Dec 14, 2021
3fcdedb
D3D12: Fix empty shader_view UAV writes
jkunstwald Dec 21, 2021
1d24953
Reformat
jkunstwald Jan 8, 2022
1ad4a17
Add memhashable config structs, add overlapped descriptor region supp…
jkunstwald Jan 16, 2022
e52479d
Add utility for texture uploads
jkunstwald Feb 12, 2022
b645b16
Add some comments about block compressed formats
jkunstwald Feb 22, 2022
897a223
Adapt to cc allocator location change
jkunstwald Mar 5, 2022
93b02f4
Fix CMake warnings
jkunstwald Mar 19, 2022
65730d9
Use uint32 over unsigned
jkunstwald Apr 6, 2022
6aee13d
Add format_to_string
jkunstwald Apr 10, 2022
a275e28
Remove asserts from block format size getters
jkunstwald Apr 11, 2022
71bf3d8
Add get_depth() method to texture description
jkunstwald Apr 11, 2022
af891c8
Add new texture size utilities, improve MIP size computation
jkunstwald Apr 11, 2022
37611ae
Vulkan: Fix concurrent buffer mapping/unmapping of the same resource
jkunstwald Apr 11, 2022
80f31d6
Add info getters to texture description
Apr 11, 2022
d47086d
Improve and clarify texture size utilities
Apr 11, 2022
83643db
Begin experimental live cmdlist API
Apr 11, 2022
8c9c1d5
Implevement live commandlist API for D3D12
jkunstwald Apr 11, 2022
6700ba8
Expand new live commandlist API, fix cubemap DSVs
jkunstwald Apr 12, 2022
344448d
D3D12: Use 11On12 device V1 instead of V2 for better compatiblity
jkunstwald Apr 13, 2022
8ade7f7
Fix clang compilation, improve vulkan sdk cmake message
jkunstwald Apr 23, 2022
6333c06
Vulkan: Fix behavior if device fails to initialize
jkunstwald Apr 23, 2022
6bd301e
Vulkan: Add output for VK_NV_ray_tracing init issue
jkunstwald Apr 23, 2022
4818147
Fix passthrough of compute shader PSO root const flag
jkunstwald Apr 23, 2022
a11d3af
Vulkan: Add unused prerequisites for live_command_list
jkunstwald Apr 23, 2022
4e63a39
Vulkan: Implement live command list API
jkunstwald Apr 24, 2022
d185bf7
Fix compilation of vk backend if Optick is present
Apr 25, 2022
10eb442
Adjust some comments, make all live_command_list calls pure virtual i…
Apr 25, 2022
1d0ddbb
Minor change
Apr 25, 2022
3c910ec
Minor change
Apr 26, 2022
0782134
D3D12: Report debug names of all leaked handle::pipeline_state on shu…
May 6, 2022
616243b
D3D12: Call IDXGIDebug ReportLiveObjects before killing the adapter
May 6, 2022
a1766d5
Update optick include path
May 6, 2022
e03f32e
Add explicit scissor field to cmd::begin_render_pass
May 6, 2022
ba10d46
Add clock synchronization info computation
jkunstwald May 7, 2022
83e3153
Add utilities to new clock info type
jkunstwald May 7, 2022
2f9d5dc
Minor improvement to PHI_CREATE_OPTICK_EVENT
jkunstwald May 8, 2022
9463932
Adapt to cc change
May 10, 2022
0525ffb
Make resource description types memhashable
jkunstwald May 21, 2022
d291120
D3D12: Add asserts for transitions on non-GPU heap resources
jkunstwald May 22, 2022
7e7a927
D3D12: Add improved asserts for incorrect descriptor table addressing
jkunstwald May 22, 2022
93fd5bb
Add depth biasing options to raster config
jkunstwald May 23, 2022
05410cc
Make resource_view memhashable, minor changes
jkunstwald Aug 7, 2022
1a9812b
Add debug names for Swapchains
Sep 8, 2022
80c4f05
Remove unused unique_buffer
Sep 21, 2022
5ce3a90
Remove cc::flags usage to reduce compile times
Sep 21, 2022
04ba52e
Minor change
Sep 22, 2022
70c9ac9
Allow default construction of window_handle
Oct 6, 2022
215fbdf
D3D12: Add warning when cmdlist allocators are forced to do blocking …
Oct 6, 2022
28a0caf
Make most format size helpers constexpr
jkunstwald Oct 6, 2022
becea02
D3D12: Fix false alerts on cmdlist allocator shutdown
jkunstwald Oct 6, 2022
101c8c9
Minor change
Oct 7, 2022
79d9e83
D3D12: Minor change to command allocators
jkunstwald Oct 7, 2022
cfd9c0d
Vulkan: Minor renames
jkunstwald Oct 8, 2022
cbb6b7c
D3D12: Simplify CommandAllocator management, add internal tls scratch…
jkunstwald Oct 8, 2022
1a5c8f4
D3D12: Remove unused parallel init
jkunstwald Oct 9, 2022
ebaef3f
D3D12: Add check for queue type switch
jkunstwald Oct 20, 2022
97aefdc
D3D12: Improve behavior when profile scopes are nested too deep
jkunstwald Oct 27, 2022
f28e228
D3D12: Fix copy queue command list translation
Oct 28, 2022
d9a6cac
Add swapchain_description, support for non-default backbuffer formats
Oct 31, 2022
c78fb48
Add full HDR support to D3D12 swapchains
Oct 31, 2022
a146687
Remove output if Rdoc/PIX support libraries succeed to load
Feb 8, 2023
6adcfef
Fix compatibility with new rlog
Feb 22, 2023
92242db
D3D12: Minor change
Apr 19, 2023
34371ef
D3D12: Add asserts to track down crash with translator globals
May 7, 2023
8380f69
Add BC5 support
May 9, 2023
ad7fcb2
Remove deprecated get_texture_size_bytes
May 12, 2023
d7ce699
Add staging Shader Views and descriptor copies
May 16, 2023
793e921
D3D12: Improve output on optick scopes not closed or nested too deeply
May 17, 2023
6778361
D3D12: Add asserts to cmdlist translator pool
jkunstwald Nov 15, 2023
dded597
GPU Stats: Fix temperature reporting after device loss
jkunstwald Dec 8, 2023
97dd273
D3D12: Zero init members of cmd list translators to suppress ASan war…
cetigo Jan 31, 2024
386144f
D3D12: Consolidate global state of cmdlist translators
cetigo Feb 2, 2024
5cd3720
D3D12: Fix GBV warning for non-GPU visible DescriptorPageAllocator
cetigo Feb 15, 2024
d715433
Minor comment change
cetigo Feb 19, 2024
626c8d1
D3D12: Fixed internally stored mipmap count if default amount is spec…
cetigo Feb 23, 2024
238845d
Add util is_integer_format
cetigo Feb 27, 2024
3466674
Add Backend method to query allocated vs total descriptor counts
cetigo Mar 25, 2024
a56f7f7
Allow specifying BLAS vertex stride and index format
cetigo Oct 31, 2024
100bd4b
D3D12: Minor change
cetigo Nov 2, 2024
454a350
D3D12: Add support for global raytracing root signatures
cetigo Nov 2, 2024
612e719
D3D12: Fix RT PSO compilation if no local rootsigs are supplied
cetigo Nov 2, 2024
d847380
D3D12: Add support for WARP adapter preference
cetigo Nov 2, 2024
baee1d5
Minor: Add allows_uav() getter to resource_description
cetigo Nov 6, 2024
6677bdf
Do not assert on RT being available in freeRange(accel_struct) if pro…
cetigo Nov 6, 2024
892ccdb
Add SNORM formats
cetigo Nov 6, 2024
16f2bcf
D3D12: Add support for SM 6.8 if agility SDK is present
cetigo Nov 6, 2024
6a88327
Add API for SM6.6 Resource/SamplerDescriptorHeaps
cetigo Nov 6, 2024
d973511
Fix errors in clang-format file
cetigo Nov 27, 2024
1644baf
Add experimental cmd::update_bottom_level_in_buffer
cetigo Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
#SpacesInSquareBrackets: false
UseTab: Never
Expand All @@ -57,6 +56,3 @@ CommentPragmas: '!Api.*'

# Includes
IncludeBlocks: Preserve

# Closing namespace comments
FixNamespaceComments: true
27 changes: 23 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(PhantasmHardwareInterface)


Expand All @@ -17,6 +17,12 @@ option(PHI_BACKEND_D3D12 "enable DirectX 12 backend" ON)
# this dll is included in extern/win32_pix_runtime/bin/ and is automatically copied if enabled
option(PHI_ENABLE_D3D12_PIX "enable DirectX 12 PIX integration" ON)

# Enables D3D12 Agility SDK (allowing use of newer D3D12 runtimes than the one shipped with the OS)
# if enabled, expects an include path visible to PHI with the Agility SDK headers, prefixed with D3D12AgilitySDK/
# meaning PHI will use #include <D3D12AgilitySDK/d3d12.h> instead of #include <d3d12.h>
# (exporting the required symbols and providing the DLLs and headers must be done by the user)
option(PHI_ENABLE_D3D12_AGILITY "enable DirectX 12 Agility SDK integration" OFF)

# Enables support for surface creation from SDL_Window*
option(PHI_ENABLE_SDL2 "enable SDL2 integration" ON)

Expand Down Expand Up @@ -47,7 +53,7 @@ if (PHI_BACKEND_VULKAN)
else()
set(phi_found_vulkan_sdk_version "")
_get_vulkan_sdk_version_number_from_folder(${Vulkan_INCLUDE_DIRS}, phi_found_vulkan_sdk_version)
message(STATUS "[phantasm hardware interface] found Vulkan SDK ${phi_found_vulkan_sdk_version}")
message(STATUS "[phantasm hardware interface] found Vulkan SDK '${phi_found_vulkan_sdk_version}' at ${Vulkan_INCLUDE_DIRS}")
endif()
endif()

Expand Down Expand Up @@ -84,7 +90,6 @@ arcana_add_library(PHI phantasm-hardware-interface SOURCES HEADERS)
target_include_directories(phantasm-hardware-interface
PUBLIC
src/
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/extern/renderdoc_app/include/"
)

Expand All @@ -109,6 +114,8 @@ if (NOT MSVC)
# Used in sse_hash.hh
# Could be made optional if necessary
target_compile_options(phantasm-hardware-interface PRIVATE -msse4.2)
else()
target_compile_options(phantasm-hardware-interface PRIVATE /WX)
endif()

# =========================================
Expand Down Expand Up @@ -138,15 +145,27 @@ if (PHI_BACKEND_D3D12)
target_compile_definitions(phantasm-hardware-interface PUBLIC PHI_HAS_PIX USE_PIX)

# copy the dll to the runtime output folder post-build
# we are on MSVC meaning CMAKE_RUNTIME_OUTPUT_DIRECTORY does not contain the /Debug or /Release ending, add it manually
set(PHI_D3D12_PIX_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/extern/win32_pix_runtime/bin/WinPixEventRuntime.dll")
add_custom_command(
TARGET phantasm-hardware-interface POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PHI_D3D12_PIX_DLL_PATH}"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>"
)
message(STATUS "[phantasm hardware interface] D3D12 PIX integration enabled")
endif()

# Agility SDK
if (PHI_ENABLE_D3D12_AGILITY)
# set defines
target_compile_definitions(phantasm-hardware-interface
PUBLIC
PHI_HAS_D3D12_AGILITY
)
message(STATUS "[phantasm hardware interface] D3D12 Agility SDK integration enabled")
endif()

else()
message(STATUS "[phantasm hardware interface] D3D12 backend disabled")
endif()
Expand Down
5 changes: 4 additions & 1 deletion cmake/FindPackageHandleStandardArgs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
unset(FOUND_COMPONENTS_MSG)
unset(MISSING_COMPONENTS_MSG)

set(COMPONENT_MSG "")

if(FPHSA_HANDLE_COMPONENTS)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(${_NAME}_${comp}_FOUND)
Expand Down Expand Up @@ -425,7 +427,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif ()

if(VERSION_OK)
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
# NOTE(Kunstwald): Commented out, these variables are always undefined for Vulkan
# string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
else()
set(${_NAME}_FOUND FALSE)
endif()
Expand Down
27 changes: 26 additions & 1 deletion src/phantasm-hardware-interface/Backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@

#include <phantasm-hardware-interface/arguments.hh>

phi::init_status phi::Backend::initializeParallel(backend_config const& /*config*/, uint32_t /*idx*/)
{
// do nothing by default
return init_status::success;
}

phi::init_status phi::Backend::initializeQueues(backend_config const& /*config*/)
{
// do nothing by default
return init_status::success;
}

phi::handle::resource phi::Backend::createTexture(
phi::format format, tg::isize2 size, uint32_t mips, texture_dimension dim, uint32_t depth_or_array_size, bool allow_uav, char const* debug_name)
{
Expand Down Expand Up @@ -79,4 +91,17 @@ phi::handle::resource phi::Backend::createResourceFromInfo(const phi::arg::resou
return handle::null_resource;
}
CC_UNREACHABLE("invalid type");
}
}

phi::handle::pipeline_state phi::Backend::createComputePipelineState(arg::shader_arg_shapes arg_shapes, arg::shader_binary shader, bool hasRootConsts)
{
arg::compute_pipeline_state_description desc = {};
for (auto const& arg : arg_shapes)
{
desc.root_signature.shader_arg_shapes.push_back(arg);
}
desc.root_signature.has_root_constants = hasRootConsts;
desc.shader = shader;

return createComputePipelineState(desc);
}
Loading