예제 #1
0
//-----------------------------------------------------------------------------
/// Get the map used to associate queue with its command lists.
/// \param inQueue Input queue.
/// \returns The CommandQueueToCommandListMap used to associate a Queue with the CommandLists it utilizes.
//-----------------------------------------------------------------------------
D3D12_COMMAND_LIST_TYPE DX12FrameProfilerLayer::GetCommandListTypeFromCommandQueue(Wrapped_ID3D12CommandQueue* inQueue)
{
    // Use the metadata object to retrieve the cached CreateInfo, and then pull the type out. Start with "Direct".
    D3D12_COMMAND_LIST_TYPE commandListType = D3D12_COMMAND_LIST_TYPE_DIRECT;

    PsAssert(inQueue != nullptr);

    if (inQueue != nullptr)
    {
        DX12ObjectDatabaseProcessor* databaseProcessor = DX12ObjectDatabaseProcessor::Instance();
        DX12WrappedObjectDatabase* objectDatabase = static_cast<DX12WrappedObjectDatabase*>(databaseProcessor->GetObjectDatabase());

        IDX12InstanceBase* queueMetadata = objectDatabase->GetMetadataObject((IUnknown*)inQueue);
        Wrapped_ID3D12CommandQueueCreateInfo* queueCreateInfo = static_cast<Wrapped_ID3D12CommandQueueCreateInfo*>(queueMetadata->GetCreateInfoStruct());
        D3D12_COMMAND_QUEUE_DESC* queueDesc = queueCreateInfo->GetDescription();
        commandListType = queueDesc->Type;
    }

    return commandListType;
}
예제 #2
0
//-----------------------------------------------------------------------------
/// Write a DX12-specific APITrace response line into the incoming string stream.
/// \param out The stringstream instance that each trace response line is written to.
/// \param inStartTime The start time for the API call.
/// \param inEndTime The end time for the API call.
//-----------------------------------------------------------------------------
void DX12APIEntry::AppendAPITraceLine(gtASCIIString& out, double inStartTime, double inEndTime) const
{
    gtASCIIString returnValueString;
    PrintReturnValue(mReturnValue, mReturnValueFlags, returnValueString);

    // Use the database processor to get a pointer to the object database.
    DX12ObjectDatabaseProcessor* databaseProcessor = DX12ObjectDatabaseProcessor::Instance();
    DX12WrappedObjectDatabase* objectDatabase = static_cast<DX12WrappedObjectDatabase*>(databaseProcessor->GetObjectDatabase());

    // Use the object database to retrieve wrapper info for the given interface.
    IDX12InstanceBase* wrapperInfo = objectDatabase->GetMetadataObject(mWrapperInterface);

    // APIType APIFunctionId InterfacePtr D3D12Interface_FunctionName(Parameters) = ReturnValue StartMillisecond EndMillisecond SampleId
    void* handle = nullptr;
    const char* type = "\0";
    const char* parameters = GetParameterString();

    if (wrapperInfo)
    {
        handle = wrapperInfo->GetApplicationHandle();
        type = wrapperInfo->GetTypeAsString();
    }
    else
    {
        // if there's no wrapper, it's a Present call.
        // Assume type is a swap chain until the Present call is wrapped properly
        type = "IDXGISwapChain";
    }

    out += IntToString(DX12TraceAnalyzerLayer::Instance()->GetAPIGroupFromAPI(mFunctionId));
    out += " ";

    out += IntToString(mFunctionId);
    out += " ";

    out += "0x";
    out += UINT64ToHexString((UINT64)handle);
    out += " ";

    out += type;
    out += "_";

    out += GetAPIName();

    out += "(";
    out += parameters;
    out += ") = ";

    out += returnValueString.asCharArray();

    out += " ";
    out += DoubleToString(inStartTime);

    out += " ";
    out += DoubleToString(inEndTime);

    out += " ";
    out += UINT64ToString(mSampleId);

    out += "\n";
}