Program Listing for File d3d12-indirect-common.h

Return to documentation for file (include\d3d12-indirect-patching\d3d12-indirect-common.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once
#include "utility/directx-utilities.h"
#include "gpu-utility/directx-memory.h"
#include <d3d12.h>

using MemoryPoolT = gpa::gpu_utility::directx::MemoryPool<gpa::gpu_utility::directx::Buffer>;
using MemoryAllocationPtrT = std::shared_ptr<gpa::gpu_utility::directx::MemoryRange<gpa::gpu_utility::directx::Buffer>>;

struct ExecuteIndirectAguments
{
    ID3D12CommandSignature* pCommandSignature = nullptr;
    UINT MaxCommandCount = 0;
    ID3D12Resource* pArgumentBuffer = nullptr;
    UINT64 ArgumentBufferOffset = 0;
    ID3D12Resource* pCountBuffer = nullptr;
    UINT64 CountBufferOffset = 0;
};

namespace gpa {
namespace indirect_patching {
namespace directx {

class __declspec(uuid("84ECFF16-4C69-4690-94CB-359083633138"))
    CommandSignatureData : public gpa::utility::directx::D3DPrivateDataInterface
{
private:
    uint64_t mCommandSize = 0;
    uint64_t mByteStride = 0;
    std::vector<std::pair<uint64_t, D3D12_INDIRECT_ARGUMENT_TYPE>> mArguments;
    bool mRequiresPatching = false;
    bool mContainsDispatchRays = false;

public:
    CommandSignatureData(ID3D12CommandSignature* commandSignature);

    uint64_t GetCommandSize();

    uint64_t GetByteStride();

    std::vector<std::pair<uint64_t, D3D12_INDIRECT_ARGUMENT_TYPE>> const& GetArgumentReflection();

    bool RequiresPatching();

    bool ContainsDispatchRays();

private:
    void ParseCommandSigDesc(D3D12_COMMAND_SIGNATURE_DESC const* commandSignatureDesc);
};

}  // namespace directx
}  // namespace indirect_patching
}  // namespace gpa