Skip to content

Commit

Permalink
Upgrade to Agility SDK 1.610.5 (#1324)
Browse files Browse the repository at this point in the history
Upgrade Agility SDK from 1.606.4 to 1.610.5, support new API calls and types.

* Upgrade to Agility SDK 1.610.5
* Add missing code paths for GetResourceAllocationInfo3
* Improve encode + decode for GetResourceAllocationInfo3
* Address static assert build failure
* Use code generation for GetResourceAllocationInfo3

---------

Co-authored-by: Rodrigo Urra <rodrigo.urra@amd.com>
  • Loading branch information
davidd-lunarg and rurra-amd authored Nov 1, 2023
1 parent 1b96116 commit fe11b59
Show file tree
Hide file tree
Showing 48 changed files with 13,209 additions and 8,968 deletions.
Binary file modified external/AgilitySDK/bin/arm64/D3D12Core.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/arm64/d3d12SDKLayers.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/arm64/d3dconfig.exe
Binary file not shown.
Binary file modified external/AgilitySDK/bin/win32/D3D12Core.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/win32/d3d12SDKLayers.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/win32/d3dconfig.exe
Binary file not shown.
Binary file modified external/AgilitySDK/bin/x64/D3D12Core.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/x64/d3d12SDKLayers.dll
Binary file not shown.
Binary file modified external/AgilitySDK/bin/x64/d3dconfig.exe
Binary file not shown.
18,310 changes: 10,249 additions & 8,061 deletions external/AgilitySDK/inc/d3d12.h

Large diffs are not rendered by default.

1,820 changes: 965 additions & 855 deletions external/AgilitySDK/inc/d3d12sdklayers.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions external/AgilitySDK/version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1.606.4
1.610.5

https://www.nuget.org/packages/Microsoft.Direct3D.D3D12/1.606.4
https://www.nuget.org/packages/Microsoft.Direct3D.D3D12/1.610.5
22 changes: 20 additions & 2 deletions framework/decode/custom_dx12_ascii_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ inline std::string PointerDecoderArrayToString(const CountType& countObj,
[&](size_t i) { return ToString(pObjs->GetPointer()[i], toStringFlags, tabCount + 1, tabSize); });
}

template <typename CountType, typename PointerDecoderType>
template <typename CountType, typename T>
inline std::string EnumPointerDecoderArrayToString(const CountType& countObj,
PointerDecoderType* pObjs,
PointerDecoder<T>* pObjs,
util::ToStringFlags toStringFlags = util::kToString_Default,
uint32_t tabCount = 0,
uint32_t tabSize = 4)
Expand All @@ -229,6 +229,24 @@ inline std::string EnumPointerDecoderArrayToString(const CountType& countObj,
[&](size_t i) { return util::Quote(ToString(pObjs->GetPointer()[i])); });
}

template <typename CountType, typename T>
inline std::string EnumPointerDecoderArrayToString(const CountType& countObj,
PointerDecoder<T*>* pObjs,
util::ToStringFlags toStringFlags = util::kToString_Default,
uint32_t tabCount = 0,
uint32_t tabSize = 4)
{
using namespace util;
return ArrayToString(
GetCount(countObj),
pObjs,
toStringFlags,
tabCount,
tabSize,
[&]() { return pObjs && !pObjs->IsNull(); },
[&](size_t i) { return util::Quote(ArrayToString(pObjs->GetInnerLength(i), pObjs->GetPointer()[i])); });
}

template <typename CountType, typename StructPointerDecoderType>
inline std::string StructPointerDecoderArrayToString(const CountType& countObj,
StructPointerDecoderType* pObjs,
Expand Down
33 changes: 27 additions & 6 deletions framework/decode/dx12_decoder_base.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
** Copyright (c) 2021 LunarG, Inc.
** Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -423,6 +424,10 @@ size_t Dx12DecoderBase::Decode_ID3D12Device_CheckFeatureSupport(format::HandleId
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS5>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_DISPLAYABLE:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_DISPLAYABLE>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS6:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS6>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
Expand All @@ -435,6 +440,15 @@ size_t Dx12DecoderBase::Decode_ID3D12Device_CheckFeatureSupport(format::HandleId
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS7>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT:
bytes_read +=
DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS8:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS8>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
Expand Down Expand Up @@ -467,13 +481,20 @@ size_t Dx12DecoderBase::Decode_ID3D12Device_CheckFeatureSupport(format::HandleId
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS15>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT:
bytes_read +=
DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
case D3D12_FEATURE_D3D12_OPTIONS16:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS16>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES>(
case D3D12_FEATURE_D3D12_OPTIONS17:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS17>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS18:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS18>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
case D3D12_FEATURE_D3D12_OPTIONS19:
bytes_read += DecodeCheckD3D12FeatureSupport<Decoded_D3D12_FEATURE_DATA_D3D12_OPTIONS19>(
object_id, feature, (parameter_buffer + bytes_read), (buffer_size - bytes_read));
break;
default:
Expand Down
16 changes: 12 additions & 4 deletions framework/decode/pointer_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,17 @@ template <typename T>
class PointerDecoder<T*> : public PointerDecoderBase
{
public:
PointerDecoder() : data_(nullptr) {}
PointerDecoder() : data_(nullptr), inner_lengths_(nullptr) {}

T** GetPointer() { return data_; }

const T** GetPointer() const { return data_; }

size_t GetInnerLength(size_t i) const
{
return ((i < GetLength()) && (inner_lengths_ != nullptr)) ? inner_lengths_[i] : 0;
}

// clang-format off
size_t DecodeInt32(const uint8_t* buffer, size_t buffer_size) { return DecodeFrom<int32_t>(buffer, buffer_size); }
size_t DecodeUInt32(const uint8_t* buffer, size_t buffer_size) { return DecodeFrom<uint32_t>(buffer, buffer_size); }
Expand Down Expand Up @@ -301,7 +306,8 @@ class PointerDecoder<T*> : public PointerDecoderBase
size_t bytes_read = 0;
size_t len = GetLength();

data_ = DecodeAllocator::Allocate<T*>(len, false);
data_ = DecodeAllocator::Allocate<T*>(len, false);
inner_lengths_ = DecodeAllocator::Allocate<size_t>(len);

for (size_t i = 0; i < len; ++i)
{
Expand Down Expand Up @@ -335,7 +341,8 @@ class PointerDecoder<T*> : public PointerDecoderBase
bytes_read += ValueDecoder::DecodeArrayFrom<SrcT>(
(buffer + bytes_read), (buffer_size - bytes_read), inner_data, inner_len);

data_[i] = inner_data;
data_[i] = inner_data;
inner_lengths_[i] = inner_len;
}
else
{
Expand All @@ -347,7 +354,8 @@ class PointerDecoder<T*> : public PointerDecoderBase
}

private:
T** data_; ///< Memory to hold decoded data
T** data_; ///< Memory to hold decoded data
size_t* inner_lengths_;
};

GFXRECON_END_NAMESPACE(decode)
Expand Down
1 change: 1 addition & 0 deletions framework/encode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ target_sources(gfxrecon_encode
${CMAKE_CURRENT_LIST_DIR}/custom_vulkan_struct_encoders.cpp
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_api_call_encoders.h>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_api_call_encoders.cpp>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_array_size_2d.h>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_wrapper_commands.h>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_struct_encoders.h>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_CURRENT_LIST_DIR}/custom_dx12_struct_encoders.cpp>
Expand Down
66 changes: 66 additions & 0 deletions framework/encode/custom_dx12_array_size_2d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
** Copyright (c) 2023 LunarG, Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
** to deal in the Software without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Software, and to permit persons to whom the
** Software is furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
*/

#ifndef GFXRECON_ENCODE_CUSTOM_DX12_ARRAY_SIZE_2D_H
#define GFXRECON_ENCODE_CUSTOM_DX12_ARRAY_SIZE_2D_H

#include "format/platform_types.h"
#include "util/defines.h"

#include <d3d12.h>

GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(encode)

template <typename... T>
class ArraySize2D
{};

template <>
class ArraySize2D<UINT,
UINT,
const D3D12_RESOURCE_DESC1*,
const UINT32*,
const DXGI_FORMAT* const*,
D3D12_RESOURCE_ALLOCATION_INFO1*>
{
public:
ArraySize2D(UINT visibleMask,
UINT numResourceDescs,
const D3D12_RESOURCE_DESC1* pResourceDescs,
const UINT32* pNumCastableFormats,
const DXGI_FORMAT* const* ppCastableFormats,
D3D12_RESOURCE_ALLOCATION_INFO1* pResourceAllocationInfo1) :
size_(numResourceDescs),
num_castable_formats_(pNumCastableFormats){};
size_t size() const { return size_; }
size_t operator[](size_t i) const { return (num_castable_formats_ != nullptr) ? num_castable_formats_[i] : 0; }

private:
const size_t size_;
const UINT32* num_castable_formats_;
};

GFXRECON_END_NAMESPACE(encode)
GFXRECON_END_NAMESPACE(gfxrecon)

#endif // GFXRECON_ENCODE_CUSTOM_DX12_ARRAY_SIZE_2D_H
28 changes: 22 additions & 6 deletions framework/encode/custom_dx12_struct_encoders.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
** Copyright (c) 2021 LunarG, Inc.
** Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -659,6 +660,9 @@ void EncodeD3D12FeatureStruct(ParameterEncoder* encoder, void* feature_data, D3D
case D3D12_FEATURE_D3D12_OPTIONS5:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS5*>(feature_data));
break;
case D3D12_FEATURE_DISPLAYABLE:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_DISPLAYABLE*>(feature_data));
break;
case D3D12_FEATURE_D3D12_OPTIONS6:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS6*>(feature_data));
break;
Expand All @@ -668,6 +672,14 @@ void EncodeD3D12FeatureStruct(ParameterEncoder* encoder, void* feature_data, D3D
case D3D12_FEATURE_D3D12_OPTIONS7:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS7*>(feature_data));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT:
EncodeStructPtr(encoder,
reinterpret_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT*>(feature_data));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES:
EncodeStructPtr(encoder,
reinterpret_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES*>(feature_data));
break;
case D3D12_FEATURE_D3D12_OPTIONS8:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS8*>(feature_data));
break;
Expand All @@ -692,13 +704,17 @@ void EncodeD3D12FeatureStruct(ParameterEncoder* encoder, void* feature_data, D3D
case D3D12_FEATURE_D3D12_OPTIONS15:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS15*>(feature_data));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT:
EncodeStructPtr(encoder,
reinterpret_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT*>(feature_data));
case D3D12_FEATURE_D3D12_OPTIONS16:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS16*>(feature_data));
break;
case D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES:
EncodeStructPtr(encoder,
reinterpret_cast<D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES*>(feature_data));
case D3D12_FEATURE_D3D12_OPTIONS17:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS17*>(feature_data));
break;
case D3D12_FEATURE_D3D12_OPTIONS18:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS18*>(feature_data));
break;
case D3D12_FEATURE_D3D12_OPTIONS19:
EncodeStructPtr(encoder, reinterpret_cast<D3D12_FEATURE_DATA_D3D12_OPTIONS19*>(feature_data));
break;
default:
GFXRECON_LOG_WARNING("Failed to encode ID3D12Device::CheckFeatureSupport pFeatureData parameter with "
Expand Down
6 changes: 6 additions & 0 deletions framework/encode/dx12_object_wrapper_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ struct ID3D12DeviceFactoryInfo : public DxWrapperInfo
struct ID3D12DeviceConfigurationInfo : public DxWrapperInfo
{};

struct ID3D12DSRDeviceFactoryInfo : public DxWrapperInfo
{};

struct ID3D12ManualWriteTrackingResourceInfo : public DxWrapperInfo
{};

struct AgsContextInfo : public DxWrapperInfo
{};

Expand Down
19 changes: 19 additions & 0 deletions framework/encode/parameter_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class ParameterEncoder
// 2D Arrays
template<typename SizeT>
void EncodeUInt32Array2D(const uint32_t* const* arr, SizeT size_2d, bool omit_data = false, bool omit_addr = false) { EncodeArray2D(arr, size_2d, omit_data, omit_addr); }
template<typename T, typename SizeT>
void EncodeEnumArray2D(const T* const* arr, SizeT size_2d, bool omit_data = false, bool omit_addr = false) { EncodeArray2DConverted<format::EnumEncodeType>(arr, size_2d, omit_data, omit_addr); }

template <size_t N, size_t M>
void EncodeFloat2DMatrix(const float (&arr)[N][M], size_t n, size_t m, bool omit_data = false, bool omit_addr = false) { assert((N == n) && (M == m)); EncodeArray(reinterpret_cast<const float*>(arr), n * m, omit_data, omit_addr); }
Expand Down Expand Up @@ -556,6 +558,23 @@ class ParameterEncoder
}
}

template <typename DstT, typename SrcT, typename SizeT>
typename std::enable_if<sizeof(SrcT) != sizeof(DstT), void>::type
EncodeArray2DConverted(const SrcT* const* arr, SizeT size_2d, bool omit_data = false, bool omit_addr = false)
{
static_assert(sizeof(SrcT) == sizeof(DstT),
"Encoding 2D arrays that require type conversion is not implemented.");
}

// Overload for the case where the original type and the conversion type have matching sizes, where we can skip the
// type conversion.
template <typename DstT, typename SrcT, typename SizeT>
typename std::enable_if<sizeof(SrcT) == sizeof(DstT), void>::type
EncodeArray2DConverted(const SrcT* const* arr, SizeT size_2d, bool omit_data = false, bool omit_addr = false)
{
EncodeArray2D(arr, size_2d, omit_data, omit_addr);
}

template <typename CharT, typename EncodeT>
typename std::enable_if<sizeof(CharT) == sizeof(EncodeT), void>::type EncodeBasicStringConverted(const CharT* str,
size_t len)
Expand Down
7 changes: 7 additions & 0 deletions framework/format/api_call_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,13 @@ enum ApiCallId : uint32_t
ApiCall_ID3D12DebugCommandList3_AssertResourceAccess = MakeApiCallId(ApiFamily_D3D12, 0x1143),
ApiCall_ID3D12DebugCommandList3_AssertTextureLayout = MakeApiCallId(ApiFamily_D3D12, 0x1144),

// Agility SDK 1.610.5
ApiCall_ID3D12Device12_GetResourceAllocationInfo3 = MakeApiCallId(ApiFamily_D3D12, 0x1145),
ApiCall_ID3D12GraphicsCommandList9_RSSetDepthBias = MakeApiCallId(ApiFamily_D3D12, 0x1146),
ApiCall_ID3D12GraphicsCommandList9_IASetIndexBufferStripCutValue = MakeApiCallId(ApiFamily_D3D12, 0x1147),
ApiCall_ID3D12DSRDeviceFactory_CreateDSRDevice = MakeApiCallId(ApiFamily_D3D12, 0x1148),
ApiCall_ID3D12ManualWriteTrackingResource_TrackWrite = MakeApiCallId(ApiFamily_D3D12, 0x1149),

// AGS API
// amd_ags.h
ApiCall_Ags_agsInitialize_6_0_1 = MakeApiCallId(ApiFamily_AGS, 0x1000),
Expand Down
Loading

0 comments on commit fe11b59

Please sign in to comment.