Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option(WISDOM_BUILD_STATIC "Build the static lib." ON)
option(WISDOM_BUILD_SHARED "Build the dynamic lib." ON)
option(WISDOM_BUILD_PLATFORM "Build unified platform extension library." ON)
option(WISDOM_BUILD_DOCS "Build the documentation." OFF)
option(WISDOM_USE_AGILITY_SDK "Download and use DirectX 12 Agility SDK." OFF)
option(WISDOM_USE_AGILITY_SDK "Download and use DirectX 12 Agility SDK." ON)
option(WISDOM_USE_CONAN "Use Conan to manage dependencies. Only for library builds." OFF)

# DXC deployment options
Expand Down
46 changes: 46 additions & 0 deletions agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Implicit actions:

- If the you need to create or update structure/enum/variant that is located in generated/ directories:
- 1. Update the structure in .xml file that is named the same as extension folder: example video/generated/c_api -> video.xml
- 2. Run the generator target with xml name as argument: example: video.xml -> generator video

If the change is from core API, (under include folder) use generator without argument: include/generated/c_api -> generator

Set of rules to the code:

- Don't use STL containers. Only usage of wis::span and wis::unique_ptr is allowed. Occasional use of std::string_view is allowed.
- Don't use C++ exceptions.
- Don't use C++ RTTI (typeid, dynamic_cast, etc.).
- No virtual functions.
- API is C compatible, so all API facing functions must have C linkage WIS_EXTERN_C.
- Internal functions are allowed to use C++20 features, but not in header files.
- If several allocations are required, use a single allocation and place all data in it. This is to minimize the number of allocations and deallocations, which can be expensive.
- If allocation is required, try assuming the reasonable size of the buffer and use stack allocation.
- If the buffer size is unknown, use a two-pass approach: first call the function with a null buffer to get the required size, then allocate the buffer and call the function again to fill it.
- If the allocation is absolutely required in command list api, use provided bump allocator, but try to avoid it as much as possible.
- If the allocation is required in class handle, use unique_ptr + release().
- If the class has allocation, fill in destroy function that will free the memory.

<!-- ============================================================ -->
<!-- Session: Wed, Jun 28 — H.265 parameter wiring -->
<!-- ============================================================ -->

## Goal
- Wire real parsed H.265 VPS/SPS/PPS data from `h265nal::H265BitstreamParserState` through the example into `WisVideoDecodeH265Desc` so `CreateParameters` injects actual parameter sets

## Summary
- Updated `Graphics::Create` signature: added `const wis::VideoDecodeH265Desc* h265_params = nullptr` parameter; when non-null, uses provided max-counts and parameter-set arrays instead of hardcoded empty ones
- Added conversion code in `app.cpp`:
- `ConvertedH265Params` struct holds converted wisdom arrays + aux storage for `ProfileTierLevel`
- `ConvertVps()` — maps all VPS flat fields + `pProfileTierLevel` from `H265VpsParser::VpsState`
- `ConvertSps()` — maps all SPS flat fields + range extension/SCC extension flags + `pProfileTierLevel`; leaves sub-structure pointers (`pDecPicBufMgr`, `pScalingLists`, etc.) as `nullptr`
- `ConvertPps()` — maps all PPS flat fields + SCC extension flags + tile arrays (padded/truncated to wisdom fixed-size); derives `sps_video_parameter_set_id` via SPS→VPS lookup table
- `ConvertH265Params()` — orchestrates iteration over maps, builds `sps_to_vps` id mapping, populates `VideoDecodeH265Desc` with pointers into the owned vectors
- `App::Start()` now calls `ConvertH265Params(parser_state)` and passes `&converted.desc` to `Graphics::Create`
- Fixed incorrect SCC extension flag mapping in PPS (`cross_component_prediction`, `chroma_qp_offset_list` — these are from 3D/range extensions, not SCC)
- Builds successfully under MSVC for both `video-vk-cpp` and `video-dx12-cpp` targets

## Next Steps
- Run the example with a real H.265 file (`video-vk-cpp <file.mp4>`) to validate end-to-end parameter creation
- If Vulkan validation errors surface (e.g., missing `pDecPicBufMgr`), populate the corresponding sub-structures from h265nal parsed data
- Add `pProfileTierLevel` population guard for cases where `general` pointer is null (currently left as default-constructed PTL)
34 changes: 19 additions & 15 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function(_ww_load_latest_dxc)
FetchContent_Declare(
dxc
URL "${DXC_LINK}"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
FetchContent_MakeAvailable(dxc)
set(dxc_SOURCE_DIR ${dxc_SOURCE_DIR} CACHE INTERNAL "")
Expand Down Expand Up @@ -515,15 +516,15 @@ function(wis_load_agility_sdk)
endfunction()

# Function for patching executable to export DX12 Agility symbols on Windows
function(wis_patch_agility_executable TARGET)
function(wis_patch_agility_executable TARGET EXPORT_PATH)
if (NOT WISDOM_WINDOWS)
return()
endif()

get_target_property(target_type ${TARGET_NAME} TYPE)
get_target_property(target_type ${TARGET} TYPE)

if(target_type NOT STREQUAL "EXECUTABLE")
message(FATAL_ERROR "Target ${TARGET_NAME} is not an executable. DX12 Agility patching can only be applied to executables.")
if(NOT target_type STREQUAL "EXECUTABLE")
message(FATAL_ERROR "Target ${TARGET} is not an executable. DX12 Agility patching can only be applied to executables.")
endif()

# Check if the DX12Agility target is available
Expand All @@ -536,10 +537,10 @@ function(wis_patch_agility_executable TARGET)
set(EXPORT_AGILITY "_declspec(dllexport) const unsigned D3D12SDKVersion = ${DX12SDKVER};
_declspec(dllexport) const char* D3D12SDKPath = \".\\\\D3D12\\\\\";"
)
file(WRITE ${wis_export_agility_file_PATH} "${EXPORT_AGILITY}")
file(WRITE ${EXPORT_PATH} "${EXPORT_AGILITY}")

# Add the generated file to the target sources to ensure it's compiled and linked into the executable
target_sources(${TARGET} PRIVATE ${wis_export_agility_file_PATH})
target_sources(${TARGET} PRIVATE ${EXPORT_PATH})
endfunction()

# Function for installing DirectX SDK
Expand All @@ -552,21 +553,21 @@ function(wis_install_agility_win32)

# Check if project is an executable
if (NOT TARGET ${wis_install_agility_win32_TARGET})
message(FATAL_ERROR "Target ${PROJECT} not found")
message(FATAL_ERROR "Target ${wis_install_agility_win32_TARGET} not found")
endif()

get_target_property(target_type ${TARGET_NAME} TYPE)
get_target_property(target_type ${wis_install_agility_win32_TARGET} TYPE)

if(target_type NOT STREQUAL "EXECUTABLE")
message(FATAL_ERROR "Target ${TARGET_NAME} is not an executable. DX12 Agility patching can only be applied to executables.")
if(NOT target_type STREQUAL "EXECUTABLE")
message(FATAL_ERROR "Target ${wis_install_agility_win32_TARGET} is not an executable. DX12 Agility patching can only be applied to executables.")
endif()

message("Installing DirectX Agility SDK Dependency")
if (EXISTS ${DXAGILITY_DLL})
message("DX12 Agility Core found: ${DXAGILITY_DLL}")
get_filename_component(DXAGILITY_DLL_NAME ${DXAGILITY_DLL} NAME)
add_custom_command(TARGET ${PROJECT} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DXAGILITY_DLL} $<TARGET_FILE_DIR:${PROJECT}>/D3D12/${DXAGILITY_DLL_NAME}
add_custom_command(TARGET ${wis_install_agility_win32_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DXAGILITY_DLL} $<TARGET_FILE_DIR:${wis_install_agility_win32_TARGET}>/D3D12/${DXAGILITY_DLL_NAME}
COMMAND_EXPAND_LISTS
COMMENT "Copying DX12 Agility Core..."
)
Expand All @@ -575,15 +576,18 @@ function(wis_install_agility_win32)
if (EXISTS ${DXAGILITY_DEBUG_DLL})
message("DX12 Agility SDKLayers found: ${DXAGILITY_DEBUG_DLL}")
get_filename_component(DXAGILITY_DEBUG_DLL_NAME ${DXAGILITY_DEBUG_DLL} NAME)
add_custom_command(TARGET ${PROJECT} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${DXAGILITY_DEBUG_DLL} $<TARGET_FILE_DIR:${PROJECT}>/D3D12/${DXAGILITY_DEBUG_DLL_NAME}
add_custom_command(TARGET ${wis_install_agility_win32_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${DXAGILITY_DEBUG_DLL} $<TARGET_FILE_DIR:${wis_install_agility_win32_TARGET}>/D3D12/${DXAGILITY_DEBUG_DLL_NAME}
COMMAND_EXPAND_LISTS
COMMENT "Copying DX12 Agility SDKLayers..."
)
endif()

if (wis_install_agility_win32_PATCH_EXE)
wis_patch_agility_executable(${wis_install_agility_win32_TARGET})
wis_patch_agility_executable(
${wis_install_agility_win32_TARGET}
${CMAKE_CURRENT_BINARY_DIR}/export_agility.c
)
endif()
endfunction()

8 changes: 4 additions & 4 deletions docs/platform/func/destroy_u_w_p_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisDestroyUWPExtension(WisUWPExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
*
* // Provided by Wisdom 0.7.0.
*
* // Provided by Wisdom 0.7.0.
* void wisDX12DestroyUWPExtension(WisDX12UWPExtension* self);
* ```
* </details>
*
*
* \endcond
*
* @section wisDestroyUWPExtension_memb Parameters
Expand Down
8 changes: 4 additions & 4 deletions docs/platform/func/destroy_wayland_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisDestroyWaylandExtension(WisWaylandExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisVKDestroyWaylandExtension(WisVKWaylandExtension* self);
*
*
* ```
* </details>
*
*
* \endcond
*
* @section wisDestroyWaylandExtension_memb Parameters
Expand Down
10 changes: 5 additions & 5 deletions docs/platform/func/destroy_win32_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisDestroyWin32Extension(WisWin32Extension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisVKDestroyWin32Extension(WisVKWin32Extension* self);
*
* // Provided by Wisdom 0.7.0.
*
* // Provided by Wisdom 0.7.0.
* void wisDX12DestroyWin32Extension(WisDX12Win32Extension* self);
* ```
* </details>
*
*
* \endcond
*
* @section wisDestroyWin32Extension_memb Parameters
Expand Down
8 changes: 4 additions & 4 deletions docs/platform/func/destroy_x_c_b_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisDestroyXCBExtension(WisXCBExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisVKDestroyXCBExtension(WisVKXCBExtension* self);
*
*
* ```
* </details>
*
*
* \endcond
*
* @section wisDestroyXCBExtension_memb Parameters
Expand Down
8 changes: 4 additions & 4 deletions docs/platform/func/destroy_xlib_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisDestroyXlibExtension(WisXlibExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisVKDestroyXlibExtension(WisVKXlibExtension* self);
*
*
* ```
* </details>
*
*
* \endcond
*
* @section wisDestroyXlibExtension_memb Parameters
Expand Down
15 changes: 8 additions & 7 deletions docs/platform/func/init_u_w_p_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,32 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisInitUWPExtension(WisUWPExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
*
* // Provided by Wisdom 0.7.0.
*
* // Provided by Wisdom 0.7.0.
* void wisDX12InitUWPExtension(WisDX12UWPExtension* self);
* ```
* </details>
*
*
* C++ Version:
* ```cpp
* namespace wis{
* // Provided by Wisdom 0.7.0.
* void DX12UWPExtension::InitUWPExtension() noexcept;
* // Provided by Wisdom 0.7.0.
* DX12UWPExtension::DX12UWPExtension() noexcept;
* }
* ```
* \endcond
*
* @section wisInitUWPExtension_memb Parameters
* <hr>
* \cond WIS_GEN_DESC
* - **this** `self` is a pointer to uninitialized WisUWPExtension instance memory. It will be initialized by this function.
* - **this** `self` is a pointer to uninitialized WisUWPExtension instance memory. It will be initialized by this
* function.
* **note** The corresponding destroy function is `wisDestroyUWPExtension`.
* \endcond
*
Expand Down
15 changes: 8 additions & 7 deletions docs/platform/func/init_wayland_extension_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,32 @@
* \cond WIS_GEN_CODE
* C Version:
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisInitWaylandExtension(WisWaylandExtension* self);
* ```
* <details>
* <summary>C Implementation Specific Version:</summary>
* ```c
* // Provided by Wisdom 0.7.0.
* // Provided by Wisdom 0.7.0.
* void wisVKInitWaylandExtension(WisVKWaylandExtension* self);
*
*
* ```
* </details>
*
*
* C++ Version:
* ```cpp
* namespace wis{
* // Provided by Wisdom 0.7.0.
* void VKWaylandExtension::InitWaylandExtension() noexcept;
* // Provided by Wisdom 0.7.0.
* VKWaylandExtension::VKWaylandExtension() noexcept;
* }
* ```
* \endcond
*
* @section wisInitWaylandExtension_memb Parameters
* <hr>
* \cond WIS_GEN_DESC
* - **this** `self` is a pointer to uninitialized WisWaylandExtension instance memory. It will be initialized by this function.
* - **this** `self` is a pointer to uninitialized WisWaylandExtension instance memory. It will be initialized by this
* function.
* **note** The corresponding destroy function is `wisDestroyWaylandExtension`.
* \endcond
*
Expand Down
Loading
Loading