Program Listing for File d3d12-extension.h

Return to documentation for file (include\d3d12-state-tracking\d3d12-extension.h)

/******************************************************************************
(c) 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 <d3d12.h>

namespace gpa {
namespace d3d12_state_tracker {

class D3D12ExtensionTracker
{
protected:
    enum ExtensionPatternState {
        STATE_IDLE,        // default entry/reset state
        STATE_CCR_SEEN,    // set after we see the CreateCommitteResource call
        STATE_MAP_SEEN,    // set after we see the Map call
        STATE_UNMAP_SEEN,  // set after we see the Unmap call
        STATE_CCPS_SEEN,   // set after we see the CreateComputePipelineState call -- if we made it to this state, the extension call pattern was matched
    };

    ExtensionPatternState mExtensionPatternState;
    ID3D12Resource* mCurrentCommittedResource;

public:
    static constexpr GUID GUID_ExtResourceGuid = {0x867d402, 0x872b, 0x4265, {0xbf, 0x7a, 0x4c, 0x9, 0xd8, 0x51, 0x7b, 0x75}};

public:
    D3D12ExtensionTracker();
    ~D3D12ExtensionTracker();

    virtual void OnMap();
    virtual void OnUnmap(ID3D12Resource* resource);
    virtual void OnCreateCommittedResource(ID3D12Resource* resource);
    virtual void OnCreateComputePipelineState();
    virtual void OnPostCreateComputePipelineState(ID3D12PipelineState& pipelineState);

    bool IsPatternMatched() const;
    void Reset();
};

}  // namespace d3d12_state_tracker
}  // namespace gpa