diff --git a/renderdoc/driver/ihv/amd/AMD.vcxproj b/renderdoc/driver/ihv/amd/AMD.vcxproj index ee0e59a0e..b75e714f8 100644 --- a/renderdoc/driver/ihv/amd/AMD.vcxproj +++ b/renderdoc/driver/ihv/amd/AMD.vcxproj @@ -115,13 +115,13 @@ - - + + diff --git a/renderdoc/driver/ihv/amd/AMD.vcxproj.filters b/renderdoc/driver/ihv/amd/AMD.vcxproj.filters index 0730a15b2..85b339dde 100644 --- a/renderdoc/driver/ihv/amd/AMD.vcxproj.filters +++ b/renderdoc/driver/ihv/amd/AMD.vcxproj.filters @@ -92,12 +92,6 @@ official\GPUPerfAPI - - official\GPUPerfAPI - - - official\GPUPerfAPI - official\GPUPerfAPI @@ -114,5 +108,11 @@ official\GPUPerfAPI + + official\GPUPerfAPI + + + official\GPUPerfAPI + \ No newline at end of file diff --git a/renderdoc/driver/ihv/amd/amd_counters.cpp b/renderdoc/driver/ihv/amd/amd_counters.cpp index faa0b182a..ad400da28 100644 --- a/renderdoc/driver/ihv/amd/amd_counters.cpp +++ b/renderdoc/driver/ihv/amd/amd_counters.cpp @@ -328,6 +328,7 @@ CounterDescription AMDCounters::InternalGetCounterDescription(uint32_t internalI desc.unit = CounterUnit::Cycles; break; case GPA_USAGE_TYPE_MILLISECONDS: ///< Result is in milliseconds + case GPA_USAGE_TYPE_NANOSECONDS: ///< Result is in nanoseconds desc.unit = CounterUnit::Seconds; break; case GPA_USAGE_TYPE_KILOBYTES: ///< Result is in kilobytes @@ -622,6 +623,10 @@ std::vector AMDCounters::GetCounterData(uint32_t sessionID, uint3 { value /= 1000.0; } + else if(usageType == GPA_USAGE_TYPE_NANOSECONDS) + { + value /= 1.0e+9; + } ret.push_back(CounterResult(eventIDs[s], counters[c], value)); } diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPACounterGenerator.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPACounterGenerator.h index 6957fe750..0a90d0f26 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPACounterGenerator.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPACounterGenerator.h @@ -1,5 +1,5 @@ //============================================================================== -// Copyright (c) 2012-2017 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2012-2018 Advanced Micro Devices, Inc. All rights reserved. /// \author AMD Developer Tools Team /// \file /// \brief GPUPerfAPI Counter Generator function @@ -19,6 +19,7 @@ /// \param[in] vendorId The vendor id to generate counters for /// \param[in] deviceId The device id to generate counters for /// \param[in] revisionId The revision id to generate counters for +/// \param[in] flags Flags used to initialize the context. Should be a combination of GPA_OpenContext_Bits /// \param[in] generateAsicSpecificCounters Flag that indicates whether the counters should be ASIC specific, if available. /// \param[inout] ppCounterAccessorOut Address of a GPA_ICounterAccessor pointer which will be set to the necessary counter accessor /// \param[inout] ppCounterSchedulerOut Address of a GPA_ICounterScheduler pointer which will be set to the necessary counter scheduler @@ -32,6 +33,7 @@ GPA_Status GenerateCounters( gpa_uint32 vendorId, gpa_uint32 deviceId, gpa_uint32 revisionId, + GPA_OpenContextFlags flags, gpa_uint8 generateAsicSpecificCounters, IGPACounterAccessor** ppCounterAccessorOut, IGPACounterScheduler** ppCounterSchedulerOut); diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAFunctions.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAFunctions.h index 0ac14c4e5..0aeb843b9 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAFunctions.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAFunctions.h @@ -80,6 +80,12 @@ GPA_FUNCTION_PREFIX(GPA_GetSampleResult) // Status / Error Query GPA_FUNCTION_PREFIX(GPA_GetStatusAsStr) +// Sample Handling +GPA_FUNCTION_PREFIX(GPA_GetSampleId) + +// GPA API Version +GPA_FUNCTION_PREFIX(GPA_GetVersion) + #ifdef NEED_TO_UNDEFINE_GPA_FUNCTION_PREFIX #undef GPA_FUNCTION_PREFIX #undef NEED_TO_UNDEFINE_GPA_FUNCTION_PREFIX diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI-VK.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI-VK.h index 1e97ce836..18f89e72f 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI-VK.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI-VK.h @@ -14,13 +14,17 @@ /// Define the AMD GPA extension name #define VK_AMD_GPA_INTERFACE_EXTENSION_NAME "VK_AMD_gpa_interface" +/// Define the AMD shader core properties extension name +#define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" + /// Define a macro to help developers include all instance-level extensions required to support the AMD GPA Interface. #define AMD_GPA_REQUIRED_INSTANCE_EXTENSION_NAME_LIST \ VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME /// Define a macro to help developers include all device-level extensions required to support the AMD GPA Interface. #define AMD_GPA_REQUIRED_DEVICE_EXTENSION_NAME_LIST \ - VK_AMD_GPA_INTERFACE_EXTENSION_NAME + VK_AMD_GPA_INTERFACE_EXTENSION_NAME, \ + VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME /// The struct that should be supplied to GPA_OpenContext(). /// The instance, physicalDevice, and device should be set prior to diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI.h index b57721865..ca21aa0bb 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPI.h @@ -27,9 +27,9 @@ #endif #if DISABLE_GPA - #define USE_GPA 0 ///< Macro used to determine if GPA fucntions should be stubbed out + #define USE_GPA 0 ///< Macro used to determine if GPA functions should be stubbed out #else - #define USE_GPA 1 ///< Macro used to determine if GPA fucntions should be stubbed out + #define USE_GPA 1 ///< Macro used to determine if GPA functions should be stubbed out #endif #include "GPUPerfAPITypes.h" @@ -44,7 +44,7 @@ typedef struct _GPAFunctionTable gpa_uint32 m_majorVer; ///< API major version gpa_uint32 m_minorVer; ///< API minor version -#define GPA_FUNCTION_PREFIX(func) func##PtrType func; +#define GPA_FUNCTION_PREFIX(func) func##PtrType func; ///< Macro used by GPAFunctions.h #include "GPAFunctions.h" #undef GPA_FUNCTION_PREFIX @@ -54,7 +54,7 @@ typedef struct _GPAFunctionTable { m_majorVer = GPA_FUNCTION_TABLE_MAJOR_VERSION_NUMBER; m_minorVer = GPA_FUNCTION_TABLE_MINOR_VERSION_NUMBER; -#define GPA_FUNCTION_PREFIX(func) func = nullptr; +#define GPA_FUNCTION_PREFIX(func) func = nullptr; ///< Macro used by GPAFunctions.h #include "GPAFunctions.h" #undef GPA_FUNCTION_PREFIX } @@ -64,6 +64,21 @@ typedef struct _GPAFunctionTable #if USE_GPA +// GPA API Version + +/// \brief Gets the GPA version +/// +/// \param[out] pMajorVersion The value that will hold the major version of GPA upon successful execution. +/// \param[out] pMinorVersion The value that will hold the minor version of GPA upon successful execution. +/// \param[out] pBuild The value that will hold the build number of GPA upon successful execution. +/// \param[out] pUpdateVersion The value that will hold the update version of GPA upon successful execution. +/// \return The GPA result status of the operation. GPA_STATUS_OK is returned if the operation is successful. +GPALIB_DECL GPA_Status GPA_GetVersion( + gpa_uint32* pMajorVersion, + gpa_uint32* pMinorVersion, + gpa_uint32* pBuild, + gpa_uint32* pUpdateVersion); + // GPA API Table /// \brief Gets the GPA API function table. @@ -524,13 +539,25 @@ GPALIB_DECL GPA_Status GPA_CopySecondarySamples( /// \brief Gets the number of samples created for the specified session. /// /// This is useful if samples are conditionally created and a count is not kept. -/// \param[in] sessionId pass Id to get the number of samples for. +/// \param[in] sessionId Unique identifier of the GPA Session Object. /// \param[out] pSampleCount The value which will hold the number of samples contained within the session upon successful execution. /// \return The GPA result status of the operation. GPA_STATUS_OK is returned if the operation is successful. GPALIB_DECL GPA_Status GPA_GetSampleCount( GPA_SessionId sessionId, gpa_uint32* pSampleCount); +/// \brief Gets the sample id by index +/// +/// This is useful if sample ids are either not zero-based or not consecutive. +/// \param[in] sessionId Unique identifier of the GPA Session Object. +/// \param[in] index The index of the sample. Must lie between 0 and (GPA_GetSampleCount result - 1). +/// \param[out] pSampleId The value that will hold the id of the sample upon successful execution. +/// \return The GPA result status of the operation. GPA_STATUS_OK is returned if the operation is successful. +GPALIB_DECL GPA_Status GPA_GetSampleId( + GPA_SessionId sessionId, + gpa_uint32 index, + gpa_uint32* pSampleId); + // Query Results /// \brief Checks whether or not a pass has finished. @@ -539,7 +566,7 @@ GPALIB_DECL GPA_Status GPA_GetSampleCount( /// This function allows you to determine when the pass has finished and associated resources are no longer needed in the application. /// The function does not block, permitting periodic polling. /// The application must not free its resources until this function returns GPA_STATUS_OK. -/// \param[in] sessionId session id. +/// \param[in] sessionId Unique identifier of the GPA Session Object. /// \param[in] passIndex 0-based index of the pass. /// \return GPA_STATUS_OK if pass is complete else GPA_STATUS_RESULT_NOT_READY. GPALIB_DECL GPA_Status GPA_IsPassComplete( @@ -563,12 +590,12 @@ GPALIB_DECL GPA_Status GPA_IsSessionComplete( /// result size for one sample and use that when retrieving results for all samples. /// \param[in] sessionId Unique identifier of the GPA Session Object. /// \param[in] sampleId The identifier of the sample to get the result size for. -/// \param[out] sampleResultSizeInBytes The value that will be set to the result size upon successful execution - this value needs to be passed to GetSampleResult. +/// \param[out] pSampleResultSizeInBytes The value that will be set to the result size upon successful execution - this value needs to be passed to GetSampleResult. /// \return The GPA result status of the operation. GPA_STATUS_OK is returned if the operation is successful. GPALIB_DECL GPA_Status GPA_GetSampleResultSize( GPA_SessionId sessionId, gpa_uint32 sampleId, - size_t* sampleResultSizeInBytes); + size_t* pSampleResultSizeInBytes); /// \brief Gets the result data for a given sample. /// diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPIFunctionTypes.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPIFunctionTypes.h index b935e5adf..3d15d2f2e 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPIFunctionTypes.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPIFunctionTypes.h @@ -13,8 +13,11 @@ #include "GPUPerfAPITypes.h" +// GPA API Version +typedef GPA_Status(*GPA_GetVersionPtrType)(gpa_uint32*, gpa_uint32*, gpa_uint32*, gpa_uint32*); ///< Typedef for a function pointer for GPA_GetVersion + // GPA API Table -typedef GPA_Status(*GPA_GetFuncTablePtrType)(void*); ///< Typedef for a function pointer for GPA_GetFuncTablePtrType +typedef GPA_Status(*GPA_GetFuncTablePtrType)(void*); ///< Typedef for a function pointer for GPA_GetFuncTable // Logging typedef void(*GPA_LoggingCallbackPtrType)(GPA_Logging_Type, const char*); ///< Typedef for a function pointer for a logging callback function @@ -75,6 +78,7 @@ typedef GPA_Status(*GPA_EndSamplePtrType)(GPA_CommandListId); ///< Typedef for typedef GPA_Status(*GPA_ContinueSampleOnCommandListPtrType)(gpa_uint32, GPA_CommandListId); ///< Typedef for a function pointer for GPA_ContinueSampleOnCommandList typedef GPA_Status(*GPA_CopySecondarySamplesPtrType)(GPA_CommandListId, GPA_CommandListId, gpa_uint32, gpa_uint32*); ///< Typedef for a function pointer for GPA_CopySecondarySamples typedef GPA_Status(*GPA_GetSampleCountPtrType)(GPA_SessionId, gpa_uint32*); ///< Typedef for a function pointer for GPA_GetSampleCount +typedef GPA_Status(*GPA_GetSampleIdPtrType)(GPA_SessionId, gpa_uint32, gpa_uint32*); ///< Typedef for a function pointer for GPA_GetSampleId // Query Results typedef GPA_Status(*GPA_IsSessionCompletePtrType)(GPA_SessionId); ///< Typedef for a function pointer for GPA_IsSessionComplete diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPITypes.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPITypes.h index da03d6388..cdb52a8b9 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPITypes.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPUPerfAPITypes.h @@ -76,7 +76,9 @@ typedef unsigned int gpa_uint32; ///< GPA specific type for 32-bit unsigned typedef unsigned int UINT; ///< GPA specific type to define UINT on Linux typedef unsigned long long gpa_uint64; ///< GPA specific type for 64-bit unsigned integer - #define UNREFERENCED_PARAMETER(x) +#ifndef UNREFERENCED_PARAMETER + #define UNREFERENCED_PARAMETER(x) (void)(x) +#endif #define _strcmpi(a, b) strcasecmp(a, b) #define _stricmp(a, b) strcasecmp(a, b) @@ -85,6 +87,8 @@ typedef unsigned int gpa_uint32; ///< GPA specific type for 32-bit unsigned #define strcpy_s(dst, ndst, src) strcpy(dst, src) #define strcat_s(dst, ndst, src) strcat(dst, src) #define strtok_s(a, b, c) strtok(a, b) + #define strnlen_s(a, b) strlen(a) + #define strncpy_s(a, b, c, d) strncpy(a, c, d) #ifndef TRUE #define TRUE 1 @@ -162,7 +166,13 @@ typedef enum GPA_STATUS_ERROR_SESSION_ALREADY_STARTED = -35, GPA_STATUS_ERROR_SESSION_NOT_STARTED = -36, GPA_STATUS_ERROR_SESSION_NOT_ENDED = -37, - GPA_STATUS_MIN = GPA_STATUS_ERROR_SESSION_NOT_ENDED, + GPA_STATUS_ERROR_INVALID_DATATYPE = -38, + GPA_STATUS_ERROR_INVALID_COUNTER_EQUATION = -39, + GPA_STATUS_ERROR_TIMEOUT = -40, + GPA_STATUS_ERROR_LIB_ALREADY_LOADED = -41, + GPA_STATUS_ERROR_OTHER_SESSION_ACTIVE = -42, + GPA_STATUS_ERROR_EXCEPTION = -43, + GPA_STATUS_MIN = GPA_STATUS_ERROR_EXCEPTION, // following are status codes used internally within GPUPerfAPI GPA_STATUS_INTERNAL = 256, } GPA_Status; @@ -213,6 +223,7 @@ typedef enum GPA_USAGE_TYPE_BYTES, ///< Result is in bytes GPA_USAGE_TYPE_ITEMS, ///< Result is a count of items or objects (ie, vertices, triangles, threads, pixels, texels, etc) GPA_USAGE_TYPE_KILOBYTES, ///< Result is in kilobytes + GPA_USAGE_TYPE_NANOSECONDS, ///< Result is in nanoseconds GPA_USAGE_TYPE__LAST ///< Marker indicating last element } GPA_Usage_Type; @@ -233,6 +244,7 @@ typedef enum GPA_LOGGING_DEBUG_MESSAGE = 0x0200, ///< Log debugging messages GPA_LOGGING_DEBUG_TRACE = 0x0400, ///< Log debugging traces GPA_LOGGING_DEBUG_COUNTERDEFS = 0x0800, ///< Log debugging counter defs + GPA_LOGGING_INTERNAL = 0x1000, ///< Log internal GPA GPA_LOGGING_DEBUG_ALL = 0xFF00 ///< Log all debugging } GPA_Logging_Type; @@ -244,7 +256,8 @@ typedef enum GPA_API_DIRECTX_12, ///< DirectX 12 API GPA_API_OPENGL, ///< OpenGL API GPA_API_OPENCL, ///< OpenCL API - GPA_API_HSA, ///< HSA API + GPA_API_ROCM, ///< ROCm API + GPA_API_HSA = GPA_API_ROCM, ///< HSA API -- maps to ROCm API, enum value left here for backwards compatibility GPA_API_VULKAN, ///< Vulkan API GPA_API_NO_SUPPORT, ///< APIs which are not yet supported or for which support has been removed GPA_API__LAST ///< Marker indicating last element diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterAccessor.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterAccessor.h similarity index 59% rename from renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterAccessor.h rename to renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterAccessor.h index 39733da91..422f2a1af 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterAccessor.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterAccessor.h @@ -1,5 +1,5 @@ //============================================================================== -// Copyright (c) 2012-2016 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2012-2018 Advanced Micro Devices, Inc. All rights reserved. /// \author AMD Developer Tools Team /// \file /// \brief An accessor interface for the GPA_CounterGeneratorBase class @@ -9,35 +9,44 @@ #ifndef _GPA_I_COUNTER_ACCESSOR_H_ #define _GPA_I_COUNTER_ACCESSOR_H_ +#include #include #include "GPUPerfAPITypes.h" struct GPA_HardwareCounterDescExt; class GPA_HWInfo; -class GPA_PublicCounter; +class GPA_HardwareCounters; +class GPA_SoftwareCounters; +class GPA_DerivedCounter; class GPA_CounterResultLocation; -/// Types of counter -enum GPACounterType { PUBLIC_COUNTER, HARDWARE_COUNTER, SOFTWARE_COUNTER, UNKNOWN_COUNTER }; - -/// Stores the type of counter and its local index into that family of counters -struct GPACounterTypeInfo +/// Indicates the source or origin of a counter +enum class GPACounterSource : uint32_t { - gpa_uint32 m_localIndex; ///< the local index of the counter - GPACounterType m_counterType; ///< the type of the counter + UNKNOWN, /// Invalid or unknown counter + PUBLIC, /// Counter is defined by GPA using other Hardware counters or hardware info + HARDWARE, /// Counter comes from the hardware + SOFTWARE, /// Counter comes from software (ie, an API-level query) +}; + +/// Stores the source of the counter and its local index into that family of counters +struct GPACounterSourceInfo +{ + gpa_uint32 m_localIndex; ///< The local index of the counter + GPACounterSource m_counterSource; ///< The source of the counter /// Sets the data for /// \param localIndex the local index to set - /// \param type the type to set - void Set(gpa_uint32 localIndex, GPACounterType type) + /// \param source the type to set + void Set(gpa_uint32 localIndex, GPACounterSource source) { m_localIndex = localIndex; - m_counterType = type; + m_counterSource = source; } }; /// An accessor interface for the GPA_CounterGeneratorBase class -class GPA_ICounterAccessor +class IGPACounterAccessor { public: @@ -59,7 +68,7 @@ public: /// Gets the category of the specified counter /// \param index The index of the counter whose category is needed /// \return The category of the specified counter - virtual const char* GetCounterCategory(gpa_uint32 index) const = 0; + virtual const char* GetCounterGroup(gpa_uint32 index) const = 0; /// Gets a counter's description /// \param index The index of a counter, must be between 0 and the value returned from GetNumPublicCounters() @@ -69,17 +78,27 @@ public: /// Gets the data type of a public counter /// \param index The index of a counter /// \return The data type of the the desired counter - virtual GPA_Type GetCounterDataType(gpa_uint32 index) const = 0; + virtual GPA_Data_Type GetCounterDataType(gpa_uint32 index) const = 0; /// Gets the usage type of a public counter /// \param index The index of a counter /// \return The usage of the the desired counter virtual GPA_Usage_Type GetCounterUsageType(gpa_uint32 index) const = 0; + /// Gets a counter's GPA_UUID + /// \param index The index of a counter, must be between 0 and the value returned from GetNumPublicCounters() + /// \return The counter UUID + virtual GPA_UUID GetCounterUuid(gpa_uint32 index) const = 0; + + /// Gets the supported sample type of a counter + /// \param index The index of a counter + /// \return the counter's supported sample type + virtual GPA_Counter_Sample_Type GetCounterSampleType(gpa_uint32 index) const = 0; + /// Gets a public counter /// \param index The index of the public counter to return /// \return A public counter - virtual const GPA_PublicCounter* GetPublicCounter(gpa_uint32 index) const = 0; + virtual const GPA_DerivedCounter* GetPublicCounter(gpa_uint32 index) const = 0; /// Gets a hardware counter /// \param index The index of a hardware counter to return @@ -101,12 +120,20 @@ public: /// \param[in] internalCounterTypes A vector of counter types /// \param[inout] pResult The computed counter result /// \param[in] pHwInfo Information about the hardware on which the result was generated - virtual void ComputePublicCounterValue(gpa_uint32 counterIndex, std::vector& results, std::vector& internalCounterTypes, void* pResult, GPA_HWInfo* pHwInfo) = 0; + /// \return GPA_STATUS_OK on success, otherwise an error code + virtual GPA_Status ComputePublicCounterValue(gpa_uint32 counterIndex, std::vector& results, std::vector& internalCounterTypes, void* pResult, const GPA_HWInfo* pHwInfo) const = 0; + + /// Compute a software counter value + /// \param softwareCounterIndex the index of the counter (within the range of software counters) whose value is needed + /// \param value the value of the counter + /// \param[out] pResult the resulting value + /// \param pHwInfo the hardware info + virtual void ComputeSWCounterValue(gpa_uint32 softwareCounterIndex, gpa_uint64 value, void* pResult, const GPA_HWInfo* pHwInfo) const = 0; /// Gets the counter type information based on the global counter index /// \param globalIndex The index into the main list of counters /// \return The info about the counter - virtual GPACounterTypeInfo GetCounterTypeInfo(gpa_uint32 globalIndex) const = 0; + virtual GPACounterSourceInfo GetCounterSourceInfo(gpa_uint32 globalIndex) const = 0; /// Gets a counter's index /// \param pName The name of a counter @@ -114,8 +141,16 @@ public: /// \return true if the counter is found, false otherwise virtual bool GetCounterIndex(const char* pName, gpa_uint32* pIndex) const = 0; + /// Get the hardware counters + /// \return the hardware counters + virtual const GPA_HardwareCounters* GetHardwareCounters() const = 0; + + /// Get the software counters + /// \return the software counters + virtual const GPA_SoftwareCounters* GetSoftwareCounters() const = 0; + /// Virtual Destructor - virtual ~GPA_ICounterAccessor() = default; + virtual ~IGPACounterAccessor() = default; }; #endif //_GPA_I_COUNTER_ACCESSOR_H_ diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterScheduler.h b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterScheduler.h similarity index 77% rename from renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterScheduler.h rename to renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterScheduler.h index 0d617e4d4..27821eb4b 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/GPAICounterScheduler.h +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/Include/IGPACounterScheduler.h @@ -1,5 +1,5 @@ //============================================================================== -// Copyright (c) 2012-2016 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2012-2018 Advanced Micro Devices, Inc. All rights reserved. /// \author AMD Developer Tools Team /// \file /// \brief An interface for scheduling counters in terms of enabling, disabling, and @@ -9,18 +9,23 @@ #ifndef _GPA_I_COUNTER_SCHEDULER_H_ #define _GPA_I_COUNTER_SCHEDULER_H_ -#include "GPAICounterAccessor.h" -#include "GPUPerfAPITypes.h" #include #include +#include "IGPACounterAccessor.h" +#include "GPUPerfAPITypes.h" -typedef std::map CounterResultLocationMap; ///< typedef for map of Counter Result Locations +using HardwareCounterIndex = unsigned int; ///< type alias for internal hardware counter +using DerivedCounterIndex = unsigned int; ///< type alias for derived counter +using HardwareCounterResultLocationPair = std::pair; +using CounterResultLocationMap = std::map ; ///< type alias for map of Counter Result Locations /// An interface for enabling and disabling counters and getting the resulting number of necessary passes -class GPA_ICounterScheduler +class IGPACounterScheduler { public: + /// Destructor + virtual ~IGPACounterScheduler() = default; /// Reset the counter scheduler virtual void Reset() = 0; @@ -30,9 +35,8 @@ public: /// \param vendorId the vendor id of the GPU hardware /// \param deviceId the device id of the GPU hardware /// \param revisionId the revision id of the GPU hardware - /// \return GPA_STATUS_ERROR_NULL_POINTER If pCounterAccessor is nullptr - /// \return GPA_STATUS_OK - virtual GPA_Status SetCounterAccessor(GPA_ICounterAccessor* pCounterAccessor, gpa_uint32 vendorId, gpa_uint32 deviceId, gpa_uint32 revisionId) = 0; + /// \return GPA_STATUS_ERROR_NULL_POINTER If pCounterAccessor is nullptr otherwise GPA_STATUS_OK + virtual GPA_Status SetCounterAccessor(IGPACounterAccessor* pCounterAccessor, gpa_uint32 vendorId, gpa_uint32 deviceId, gpa_uint32 revisionId) = 0; /// Enables a counter /// \param index The index of a counter to enable @@ -48,18 +52,19 @@ public: virtual void DisableAllCounters() = 0; /// Get the number of enabled counters - virtual gpa_uint32 GetNumEnabledCounters() = 0; + /// \return the number of enabled counters + virtual gpa_uint32 GetNumEnabledCounters() const = 0; /// Gets the counter index of the specified enabled counter /// \param enabledIndex the enabled counter whose counter index is needed /// \param[out] pCounterAtIndex the counter index of the specified enabled counter /// \return GPA_STATUS_OK on success - virtual GPA_Status GetEnabledIndex(gpa_uint32 enabledIndex, gpa_uint32* pCounterAtIndex) = 0; + virtual GPA_Status GetEnabledIndex(gpa_uint32 enabledIndex, gpa_uint32* pCounterAtIndex) const = 0; /// Checks if the specified counter is enabled /// \param counterIndex the index of the counter to check /// \return GPA_STATUS_OK if the counter is enabled - virtual GPA_Status IsCounterEnabled(gpa_uint32 counterIndex) = 0; + virtual GPA_Status IsCounterEnabled(gpa_uint32 counterIndex) const = 0; /// Obtains the number of passes required to collect the enabled counters /// \param[inout] pNumRequiredPassesOut Will contain the number of passes needed to collect the set of enabled counters @@ -68,7 +73,7 @@ public: /// Get a flag indicating if the counter selection has changed /// \return true if the counter selection has changed, false otherwise - virtual bool GetCounterSelectionChanged() = 0; + virtual bool GetCounterSelectionChanged() const = 0; /// Begin profiling -- sets pass index to zero /// \return GPA_STATUS_OK on success @@ -96,7 +101,7 @@ public: /// Set draw call counts (internal support) /// \param iCounts the count of draw calls - virtual void SetDrawCallCounts(const int iCounts) = 0; + virtual void SetDrawCallCounts(int iCounts) = 0; }; #endif //_GPA_I_COUNTER_SCHEDULER_H_ diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/LICENSE b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/LICENSE index 80c45f1ec..ae26969d5 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/LICENSE +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/LICENSE @@ -1,15 +1,15 @@ -Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. - +Copyright (c) 2016-2018 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"), 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 diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/thirdpartylicenses.txt b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/thirdpartylicenses.txt index 7419e2db2..dc4b5d93c 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/thirdpartylicenses.txt +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/thirdpartylicenses.txt @@ -13,30 +13,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials. THE MATERIALS ARE 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 MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - -OpenGLES (3 entries from 3 different header files) --------- - -Copyright (c) 2013-2014 The Khronos Group Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject tothe following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials. - -THE MATERIALS ARE 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 MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - --------- - -This document is licensed under the SGI Free Software B License Version 2.0. For details, see http://oss.sgi.com/projects/FreeB/ - --------- - -License Applicability. Except to the extent portions of this file are made subject to an alternative license as permitted in the SGI Free Software License B, Version 1.0 (the "License"), the contents of this file are subject only to the provisions of the License. You may not use this file except in compliance with the License. You may obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - -http://oss.sgi.com/projects/FreeB - -Note that, as provided in the License, the Software is distributed on an "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - -Original Code. The Original Code is: OpenGL Sample Implementation, Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. Copyright in any portions created by third parties is as indicated elsewhere herein. All Rights Reserved. - -Additional Notice Provisions: The application programming interfaces established by SGI in conjunction with the Original Code are The OpenGL(R) Graphics System: A Specification (Version 1.2.1), released April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version1.3), released November 4, 1998; and OpenGL(R) Graphics with the XWindow System(R) (Version 1.3), released October 19, 1998. This software was created using the OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has not been independently verified as being compliant with the OpenGL(R) version 1.2.1 Specification. \ No newline at end of file diff --git a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/version.txt b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/version.txt index 4a663086b..b3efd03bb 100644 --- a/renderdoc/driver/ihv/amd/official/GPUPerfAPI/version.txt +++ b/renderdoc/driver/ihv/amd/official/GPUPerfAPI/version.txt @@ -1 +1,3 @@ -Release: GPUPerfAPI 2.22.1 \ No newline at end of file +Release: GPUPerfAPI 3.3 + +https://github.com/GPUOpen-Tools/GPA @ 1eaee4a094925bd30624defd1377c5a7efc92591