Class CopyContext

Synopsis

#include <Source/Falcor/Core/API/CopyContext.h>

class dlldecl CopyContext

Description

No description yet.

Inheritance

Decsendents: ComputeContext, RtVarsContext

Classes

ReadTextureTask

Methods

CopyContext
~CopyContext
apiSubresourceBarrier
asyncReadTextureSubresourceRead texture data Asynchronously
bindDescriptorHeapsBind the descriptor heaps from the device into the command list.
bufferBarrier
copyBufferRegionCopy part of a buffer
copyResourceCopy an entire resource
copySubresourceCopy a subresource
copySubresourceRegionCopy a region of a subresource from one texture to another srcOffset, dstOffset and size describe the source and destination regions
createCreate a copy context.
flushFlush the command list
getLowLevelDataGet the low-level context data
hasPendingCommandsCheck if we have pending commands
readTextureSubresourceRead texture data synchronously
resourceBarrierInsert a resource barrier if pViewInfo is nullptr, will transition the entire resource
setLowLevelContextDataOverride the low-level context data with a user provided object
setPendingCommandsSignal the context that we have pending commands
subresourceBarriers
textureBarrier
uavBarrierInsert a UAV barrier
updateBufferUpdate a buffer
updateSubresourceDataUpdate a texture's subresource data offset and size describe a region to update
updateTextureDataUpdate an entire texture
updateTextureSubresources

Source

Lines 36-155 in Source/Falcor/Core/API/CopyContext.h.

class dlldecl CopyContext
{
public:
    using SharedPtr = std::shared_ptr<CopyContext>;
    using SharedConstPtr = std::shared_ptr<const CopyContext>;
    class ReadTextureTask
    {
    public:
        using SharedPtr = std::shared_ptr<ReadTextureTask>;
        static SharedPtr create(CopyContext* pCtx, const Texture* pTexture, uint32_t subresourceIndex);
        std::vector<uint8_t> getData();
    private:
        ReadTextureTask() = default;
        GpuFence::SharedPtr mpFence;
        Buffer::SharedPtr mpBuffer;
        CopyContext* mpContext;
ef FALCOR_D3D12
        uint32_t mRowCount;
        ResourceFormat mTextureFormat;
        D3D12_PLACED_SUBRESOURCE_FOOTPRINT mFootprint;
f defined(FALCOR_VK)
        size_t mDataSize;
if
    };
    virtual ~CopyContext();
    /** Create a copy context.
        \param[in] queue Command queue handle.
        \return A new object, or throws an exception if creation failed.
    */
    static SharedPtr create(CommandQueueHandle queue);
    /** Flush the command list. This doesn't reset the command allocator, just submits the commands
        \param[in] wait If true, will block execution until the GPU finished processing the commands
    */
    virtual void flush(bool wait = false);
    /** Check if we have pending commands
    */
    bool hasPendingCommands() const { return mCommandsPending; }
    /** Signal the context that we have pending commands. Useful in case you make raw API calls
    */
    void setPendingCommands(bool commandsPending) { mCommandsPending = commandsPending; }
    /** Insert a resource barrier
        if pViewInfo is nullptr, will transition the entire resource. Otherwise, it will only transition the subresource in the view
        \return true if a barrier commands were recorded for the entire resource-view, otherwise false (for example, when the current resource state is the same as the new state or when only some subresources were transitioned)
    */
    virtual bool resourceBarrier(const Resource* pResource, Resource::State newState, const ResourceViewInfo* pViewInfo = nullptr);
    /** Insert a UAV barrier
    */
    virtual void uavBarrier(const Resource* pResource);
    /** Copy an entire resource
    */
    void copyResource(const Resource* pDst, const Resource* pSrc);
    /** Copy a subresource
    */
    void copySubresource(const Texture* pDst, uint32_t dstSubresourceIdx, const Texture* pSrc, uint32_t srcSubresourceIdx);
    /** Copy part of a buffer
    */
    void copyBufferRegion(const Buffer* pDst, uint64_t dstOffset, const Buffer* pSrc, uint64_t srcOffset, uint64_t numBytes);
    /** Copy a region of a subresource from one texture to another
        `srcOffset`, `dstOffset` and `size` describe the source and destination regions. For any channel of `extent` that is -1, the source texture dimension will be used
    */
    void copySubresourceRegion(const Texture* pDst, uint32_t dstSubresource, const Texture* pSrc, uint32_t srcSubresource, const uint3& dstOffset = uint3(0), const uint3& srcOffset = uint3(0), const uint3& size = uint3(-1));
    /** Update a texture's subresource data
        `offset` and `size` describe a region to update. For any channel of `extent` that is -1, the texture dimension will be used.
        pData can't be null. The size of the pointed buffer must be equal to a single texel size times the size of the region we are updating
    */
    void updateSubresourceData(const Texture* pDst, uint32_t subresource, const void* pData, const uint3& offset = uint3(0), const uint3& size = uint3(-1));
    /** Update an entire texture
    */
    void updateTextureData(const Texture* pTexture, const void* pData);
    /** Update a buffer
    */
    void updateBuffer(const Buffer* pBuffer, const void* pData, size_t offset = 0, size_t numBytes = 0);
    /** Read texture data synchronously. Calling this command will flush the pipeline and wait for the GPU to finish execution
    */
    std::vector<uint8_t> readTextureSubresource(const Texture* pTexture, uint32_t subresourceIndex);
    /** Read texture data Asynchronously
    */
    ReadTextureTask::SharedPtr asyncReadTextureSubresource(const Texture* pTexture, uint32_t subresourceIndex);
    /** Get the low-level context data
    */
    virtual const LowLevelContextData::SharedPtr& getLowLevelData() const { return mpLowLevelData; }
    /** Override the low-level context data with a user provided object
    */
    void setLowLevelContextData(LowLevelContextData::SharedPtr pLowLevelData) { mpLowLevelData = pLowLevelData; }
    /** Bind the descriptor heaps from the device into the command list.
    */
    void bindDescriptorHeaps();
protected:
    CopyContext(LowLevelContextData::CommandQueueType type, CommandQueueHandle queue);
    bool textureBarrier(const Texture* pTexture, Resource::State newState);
    bool bufferBarrier(const Buffer* pBuffer, Resource::State newState);
    bool subresourceBarriers(const Texture* pTexture, Resource::State newState, const ResourceViewInfo* pViewInfo);
    void apiSubresourceBarrier(const Texture* pTexture, Resource::State newState, Resource::State oldState, uint32_t arraySlice, uint32_t mipLevel);
    void updateTextureSubresources(const Texture* pTexture, uint32_t firstSubresource, uint32_t subresourceCount, const void* pData, const uint3& offset = uint3(0), const uint3& size = uint3(-1));
    bool mCommandsPending = false;
    LowLevelContextData::SharedPtr mpLowLevelData;
};





Add Discussion as Guest

Log in