зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Expose performance counters via extension.
This CL rewrites the Vulkan perf counters test to work in the angle_end2end_test suite using the newly exposed AMD extension. Note that we implement only a subset of the extension. Instead of generating monitors and starting/stopping them we simply read back all performance counter data at once using the special montior value "0". The CL also enables these tests on SwiftShader. Bug: angleproject:4918 Change-Id: I5d8f6eecb1ccff448657cbdb65b51a225dfb90c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3497538 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
af2e0c01f0
Коммит
a956162cc0
|
@ -45,6 +45,70 @@ void SaveFileHelper::write(const uint8_t *data, size_t size)
|
|||
mOfs.write(reinterpret_cast<const char *>(data), size);
|
||||
}
|
||||
|
||||
// AMD_performance_monitor helpers.
|
||||
|
||||
PerfMonitorCounter::PerfMonitorCounter() = default;
|
||||
|
||||
PerfMonitorCounter::~PerfMonitorCounter() = default;
|
||||
|
||||
PerfMonitorCounterGroup::PerfMonitorCounterGroup() = default;
|
||||
|
||||
PerfMonitorCounterGroup::~PerfMonitorCounterGroup() = default;
|
||||
|
||||
uint32_t GetPerfMonitorCounterIndex(const PerfMonitorCounters &counters, const std::string &name)
|
||||
{
|
||||
for (uint32_t counterIndex = 0; counterIndex < static_cast<uint32_t>(counters.size());
|
||||
++counterIndex)
|
||||
{
|
||||
if (counters[counterIndex].name == name)
|
||||
{
|
||||
return counterIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
uint32_t GetPerfMonitorCounterGroupIndex(const PerfMonitorCounterGroups &groups,
|
||||
const std::string &name)
|
||||
{
|
||||
for (uint32_t groupIndex = 0; groupIndex < static_cast<uint32_t>(groups.size()); ++groupIndex)
|
||||
{
|
||||
if (groups[groupIndex].name == name)
|
||||
{
|
||||
return groupIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
const PerfMonitorCounter &GetPerfMonitorCounter(const PerfMonitorCounters &counters,
|
||||
const std::string &name)
|
||||
{
|
||||
return GetPerfMonitorCounter(const_cast<PerfMonitorCounters &>(counters), name);
|
||||
}
|
||||
|
||||
PerfMonitorCounter &GetPerfMonitorCounter(PerfMonitorCounters &counters, const std::string &name)
|
||||
{
|
||||
uint32_t counterIndex = GetPerfMonitorCounterIndex(counters, name);
|
||||
ASSERT(counterIndex < static_cast<uint32_t>(counters.size()));
|
||||
return counters[counterIndex];
|
||||
}
|
||||
|
||||
const PerfMonitorCounterGroup &GetPerfMonitorCounterGroup(const PerfMonitorCounterGroups &groups,
|
||||
const std::string &name)
|
||||
{
|
||||
return GetPerfMonitorCounterGroup(const_cast<PerfMonitorCounterGroups &>(groups), name);
|
||||
}
|
||||
|
||||
PerfMonitorCounterGroup &GetPerfMonitorCounterGroup(PerfMonitorCounterGroups &groups,
|
||||
const std::string &name)
|
||||
{
|
||||
uint32_t groupIndex = GetPerfMonitorCounterGroupIndex(groups, name);
|
||||
ASSERT(groupIndex < static_cast<uint32_t>(groups.size()));
|
||||
return groups[groupIndex];
|
||||
}
|
||||
} // namespace angle
|
||||
|
||||
std::string ArrayString(unsigned int i)
|
||||
|
|
|
@ -89,6 +89,89 @@ struct SaveFileHelper
|
|||
std::string mFilePath;
|
||||
};
|
||||
|
||||
// AMD_performance_monitor helpers.
|
||||
struct PerfMonitorCounter
|
||||
{
|
||||
PerfMonitorCounter();
|
||||
~PerfMonitorCounter();
|
||||
|
||||
std::string name;
|
||||
uint32_t value;
|
||||
};
|
||||
using PerfMonitorCounters = std::vector<PerfMonitorCounter>;
|
||||
|
||||
struct PerfMonitorCounterGroup
|
||||
{
|
||||
PerfMonitorCounterGroup();
|
||||
~PerfMonitorCounterGroup();
|
||||
|
||||
std::string name;
|
||||
PerfMonitorCounters counters;
|
||||
};
|
||||
using PerfMonitorCounterGroups = std::vector<PerfMonitorCounterGroup>;
|
||||
|
||||
uint32_t GetPerfMonitorCounterIndex(const PerfMonitorCounters &counters, const std::string &name);
|
||||
const PerfMonitorCounter &GetPerfMonitorCounter(const PerfMonitorCounters &counters,
|
||||
const std::string &name);
|
||||
PerfMonitorCounter &GetPerfMonitorCounter(PerfMonitorCounters &counters, const std::string &name);
|
||||
uint32_t GetPerfMonitorCounterGroupIndex(const PerfMonitorCounterGroups &groups,
|
||||
const std::string &name);
|
||||
const PerfMonitorCounterGroup &GetPerfMonitorCounterGroup(const PerfMonitorCounterGroups &groups,
|
||||
const std::string &name);
|
||||
PerfMonitorCounterGroup &GetPerfMonitorCounterGroup(PerfMonitorCounterGroups &groups,
|
||||
const std::string &name);
|
||||
|
||||
struct PerfMonitorTriplet
|
||||
{
|
||||
uint32_t group;
|
||||
uint32_t counter;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
#define ANGLE_VK_PERF_COUNTERS_X(FN) \
|
||||
FN(primaryBuffers) \
|
||||
FN(renderPasses) \
|
||||
FN(writeDescriptorSets) \
|
||||
FN(flushedOutsideRenderPassCommandBuffers) \
|
||||
FN(resolveImageCommands) \
|
||||
FN(depthClears) \
|
||||
FN(depthLoads) \
|
||||
FN(depthStores) \
|
||||
FN(stencilClears) \
|
||||
FN(stencilLoads) \
|
||||
FN(stencilStores) \
|
||||
FN(colorAttachmentUnresolves) \
|
||||
FN(depthAttachmentUnresolves) \
|
||||
FN(stencilAttachmentUnresolves) \
|
||||
FN(colorAttachmentResolves) \
|
||||
FN(depthAttachmentResolves) \
|
||||
FN(stencilAttachmentResolves) \
|
||||
FN(readOnlyDepthStencilRenderPasses) \
|
||||
FN(descriptorSetAllocations) \
|
||||
FN(descriptorSetCacheTotalSize) \
|
||||
FN(descriptorSetCacheKeySizeBytes) \
|
||||
FN(uniformsAndXfbDescriptorSetCacheHits) \
|
||||
FN(uniformsAndXfbDescriptorSetCacheMisses) \
|
||||
FN(uniformsAndXfbDescriptorSetCacheTotalSize) \
|
||||
FN(textureDescriptorSetCacheHits) \
|
||||
FN(textureDescriptorSetCacheMisses) \
|
||||
FN(textureDescriptorSetCacheTotalSize) \
|
||||
FN(shaderBuffersDescriptorSetCacheHits) \
|
||||
FN(shaderBuffersDescriptorSetCacheMisses) \
|
||||
FN(shaderBuffersDescriptorSetCacheTotalSize) \
|
||||
FN(buffersGhosted) \
|
||||
FN(vertexArraySyncStateCalls) \
|
||||
FN(allocateNewBufferBlockCalls)
|
||||
|
||||
#define ANGLE_DECLARE_PERF_COUNTER(COUNTER) uint32_t COUNTER;
|
||||
|
||||
struct VulkanPerfCounters
|
||||
{
|
||||
ANGLE_VK_PERF_COUNTERS_X(ANGLE_DECLARE_PERF_COUNTER)
|
||||
};
|
||||
|
||||
#undef ANGLE_DECLARE_PERF_COUNTER
|
||||
|
||||
} // namespace angle
|
||||
|
||||
template <typename T, size_t N>
|
||||
|
|
|
@ -331,6 +331,33 @@ bool GetSaveAndRestoreState(const egl::AttributeMap &attribs)
|
|||
{
|
||||
return (attribs.get(EGL_EXTERNAL_CONTEXT_SAVE_STATE_ANGLE, EGL_FALSE) == EGL_TRUE);
|
||||
}
|
||||
|
||||
void GetPerfMonitorString(const std::string &name,
|
||||
GLsizei bufSize,
|
||||
GLsizei *length,
|
||||
GLchar *stringOut)
|
||||
{
|
||||
GLsizei numCharsWritten = std::min(bufSize, static_cast<GLsizei>(name.size()));
|
||||
|
||||
if (length)
|
||||
{
|
||||
if (bufSize == 0)
|
||||
{
|
||||
*length = static_cast<GLsizei>(name.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Excludes null terminator.
|
||||
ASSERT(numCharsWritten > 0);
|
||||
*length = numCharsWritten - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (stringOut)
|
||||
{
|
||||
memcpy(stringOut, name.c_str(), numCharsWritten);
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
#if defined(ANGLE_PLATFORM_APPLE)
|
||||
|
@ -3717,6 +3744,9 @@ Extensions Context::generateSupportedExtensions() const
|
|||
// Always enabled. Will return a default string if capture is not enabled.
|
||||
supportedExtensions.getSerializedContextStringANGLE = true;
|
||||
|
||||
// Performance counter queries are always supported. Different groups exist on each back-end.
|
||||
supportedExtensions.performanceMonitorAMD = true;
|
||||
|
||||
return supportedExtensions;
|
||||
}
|
||||
|
||||
|
@ -9385,38 +9415,176 @@ void Context::deletePerfMonitors(GLsizei n, GLuint *monitors) {}
|
|||
|
||||
void Context::endPerfMonitor(GLuint monitor) {}
|
||||
|
||||
void Context::genPerfMonitors(GLsizei n, GLuint *monitors) {}
|
||||
void Context::genPerfMonitors(GLsizei n, GLuint *monitors)
|
||||
{
|
||||
for (GLsizei monitorIndex = 0; monitorIndex < n; ++monitorIndex)
|
||||
{
|
||||
monitors[n] = static_cast<GLuint>(monitorIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorCounterData(GLuint monitor,
|
||||
GLenum pname,
|
||||
GLsizei dataSize,
|
||||
GLuint *data,
|
||||
GLint *bytesWritten)
|
||||
{}
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
GLint byteCount = 0;
|
||||
switch (pname)
|
||||
{
|
||||
case GL_PERFMON_RESULT_AVAILABLE_AMD:
|
||||
{
|
||||
*data = GL_TRUE;
|
||||
byteCount += sizeof(GLuint);
|
||||
break;
|
||||
}
|
||||
case GL_PERFMON_RESULT_SIZE_AMD:
|
||||
{
|
||||
GLuint resultSize = 0;
|
||||
for (const PerfMonitorCounterGroup &group : perfMonitorGroups)
|
||||
{
|
||||
resultSize += sizeof(PerfMonitorTriplet) * group.counters.size();
|
||||
}
|
||||
*data = resultSize;
|
||||
byteCount += sizeof(GLuint);
|
||||
break;
|
||||
}
|
||||
case GL_PERFMON_RESULT_AMD:
|
||||
{
|
||||
PerfMonitorTriplet *resultsOut = reinterpret_cast<PerfMonitorTriplet *>(data);
|
||||
GLsizei maxResults = dataSize / (3 * sizeof(GLuint));
|
||||
GLsizei resultCount = 0;
|
||||
for (size_t groupIndex = 0;
|
||||
groupIndex < perfMonitorGroups.size() && resultCount < maxResults; ++groupIndex)
|
||||
{
|
||||
const PerfMonitorCounterGroup &group = perfMonitorGroups[groupIndex];
|
||||
for (size_t counterIndex = 0;
|
||||
counterIndex < group.counters.size() && resultCount < maxResults;
|
||||
++counterIndex)
|
||||
{
|
||||
const PerfMonitorCounter &counter = group.counters[counterIndex];
|
||||
PerfMonitorTriplet &triplet = resultsOut[resultCount++];
|
||||
triplet.counter = static_cast<GLuint>(counterIndex);
|
||||
triplet.group = static_cast<GLuint>(groupIndex);
|
||||
triplet.value = counter.value;
|
||||
}
|
||||
}
|
||||
byteCount += sizeof(PerfMonitorTriplet) * resultCount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorCounterInfo(GLuint group, GLuint counter, GLenum pname, void *data) {}
|
||||
if (bytesWritten)
|
||||
{
|
||||
*bytesWritten = byteCount;
|
||||
}
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorCounterInfo(GLuint group, GLuint counter, GLenum pname, void *data)
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
ASSERT(group < perfMonitorGroups.size());
|
||||
const PerfMonitorCounters &counters = perfMonitorGroups[group].counters;
|
||||
ASSERT(counter < counters.size());
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_COUNTER_TYPE_AMD:
|
||||
{
|
||||
GLenum *dataOut = reinterpret_cast<GLenum *>(data);
|
||||
*dataOut = GL_UNSIGNED_INT;
|
||||
break;
|
||||
}
|
||||
case GL_COUNTER_RANGE_AMD:
|
||||
{
|
||||
GLuint *dataOut = reinterpret_cast<GLuint *>(data);
|
||||
dataOut[0] = 0;
|
||||
dataOut[1] = std::numeric_limits<GLuint>::max();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorCounterString(GLuint group,
|
||||
GLuint counter,
|
||||
GLsizei bufSize,
|
||||
GLsizei *length,
|
||||
GLchar *counterString)
|
||||
{}
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
ASSERT(group < perfMonitorGroups.size());
|
||||
const PerfMonitorCounters &counters = perfMonitorGroups[group].counters;
|
||||
ASSERT(counter < counters.size());
|
||||
GetPerfMonitorString(counters[counter].name, bufSize, length, counterString);
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorCounters(GLuint group,
|
||||
GLint *numCounters,
|
||||
GLint *maxActiveCounters,
|
||||
GLsizei counterSize,
|
||||
GLuint *counters)
|
||||
{}
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
ASSERT(group < perfMonitorGroups.size());
|
||||
const PerfMonitorCounters &groupCounters = perfMonitorGroups[group].counters;
|
||||
|
||||
if (numCounters)
|
||||
{
|
||||
*numCounters = static_cast<GLint>(groupCounters.size());
|
||||
}
|
||||
|
||||
if (maxActiveCounters)
|
||||
{
|
||||
*maxActiveCounters = static_cast<GLint>(groupCounters.size());
|
||||
}
|
||||
|
||||
if (counters)
|
||||
{
|
||||
GLsizei maxCounterIndex = std::min(counterSize, static_cast<GLsizei>(groupCounters.size()));
|
||||
for (GLsizei counterIndex = 0; counterIndex < maxCounterIndex; ++counterIndex)
|
||||
{
|
||||
counters[counterIndex] = static_cast<GLuint>(counterIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorGroupString(GLuint group,
|
||||
GLsizei bufSize,
|
||||
GLsizei *length,
|
||||
GLchar *groupString)
|
||||
{}
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
ASSERT(group < perfMonitorGroups.size());
|
||||
GetPerfMonitorString(perfMonitorGroups[group].name, bufSize, length, groupString);
|
||||
}
|
||||
|
||||
void Context::getPerfMonitorGroups(GLint *numGroups, GLsizei groupsSize, GLuint *groups) {}
|
||||
void Context::getPerfMonitorGroups(GLint *numGroups, GLsizei groupsSize, GLuint *groups)
|
||||
{
|
||||
using namespace angle;
|
||||
const PerfMonitorCounterGroups &perfMonitorGroups = mImplementation->getPerfMonitorCounters();
|
||||
|
||||
if (numGroups)
|
||||
{
|
||||
*numGroups = static_cast<GLint>(perfMonitorGroups.size());
|
||||
}
|
||||
|
||||
GLuint maxGroupIndex =
|
||||
std::min<GLuint>(groupsSize, static_cast<GLuint>(perfMonitorGroups.size()));
|
||||
for (GLuint groupIndex = 0; groupIndex < maxGroupIndex; ++groupIndex)
|
||||
{
|
||||
groups[groupIndex] = groupIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void Context::selectPerfMonitorCounters(GLuint monitor,
|
||||
GLboolean enable,
|
||||
|
@ -9425,6 +9593,11 @@ void Context::selectPerfMonitorCounters(GLuint monitor,
|
|||
GLuint *counterList)
|
||||
{}
|
||||
|
||||
const angle::PerfMonitorCounterGroups &Context::getPerfMonitorCounterGroups() const
|
||||
{
|
||||
return mImplementation->getPerfMonitorCounters();
|
||||
}
|
||||
|
||||
// ErrorSet implementation.
|
||||
ErrorSet::ErrorSet(Context *context) : mContext(context) {}
|
||||
|
||||
|
|
|
@ -649,6 +649,8 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
|
|||
// Needed by capture serialization logic that works with a "const" Context pointer.
|
||||
void finishImmutable() const;
|
||||
|
||||
const angle::PerfMonitorCounterGroups &getPerfMonitorCounterGroups() const;
|
||||
|
||||
private:
|
||||
void initializeDefaultResources();
|
||||
|
||||
|
|
|
@ -312,6 +312,9 @@ MSG kInvalidName = "Invalid name.";
|
|||
MSG kInvalidNameCharacters = "Name contains invalid characters.";
|
||||
MSG kInvalidOriginEnum = "Invalid origin enum.";
|
||||
MSG kInvalidPackParametersForWebGL = "Invalid combination of pack parameters for WebGL.";
|
||||
MSG kInvalidPerfMonitor = "Invalid perf monitor.";
|
||||
MSG kInvalidPerfMonitorCounter = "Invalid perf monitor counter.";
|
||||
MSG kInvalidPerfMonitorGroup = "Invalid perf monitor counter group.";
|
||||
MSG kInvalidPname = "Invalid pname.";
|
||||
MSG kInvalidPointerQuery = "Invalid pointer query.";
|
||||
MSG kInvalidPointParameter = "Invalid point parameter.";
|
||||
|
|
|
@ -4074,7 +4074,7 @@ void CaptureGetPerfMonitorCounterDataAMD_data(const State &glState,
|
|||
GLint *bytesWritten,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = dataSize;
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCounterDataAMD_bytesWritten(const State &glState,
|
||||
|
@ -4086,7 +4086,7 @@ void CaptureGetPerfMonitorCounterDataAMD_bytesWritten(const State &glState,
|
|||
GLint *bytesWritten,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = sizeof(GLint);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCounterInfoAMD_data(const State &glState,
|
||||
|
@ -4109,7 +4109,7 @@ void CaptureGetPerfMonitorCounterStringAMD_length(const State &glState,
|
|||
GLchar *counterString,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = sizeof(GLsizei);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCounterStringAMD_counterString(const State &glState,
|
||||
|
@ -4121,7 +4121,7 @@ void CaptureGetPerfMonitorCounterStringAMD_counterString(const State &glState,
|
|||
GLchar *counterString,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = bufSize;
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCountersAMD_numCounters(const State &glState,
|
||||
|
@ -4133,7 +4133,7 @@ void CaptureGetPerfMonitorCountersAMD_numCounters(const State &glState,
|
|||
GLuint *counters,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = sizeof(GLint);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCountersAMD_maxActiveCounters(const State &glState,
|
||||
|
@ -4145,7 +4145,7 @@ void CaptureGetPerfMonitorCountersAMD_maxActiveCounters(const State &glState,
|
|||
GLuint *counters,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = sizeof(GLint);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorCountersAMD_counters(const State &glState,
|
||||
|
@ -4157,7 +4157,7 @@ void CaptureGetPerfMonitorCountersAMD_counters(const State &glState,
|
|||
GLuint *counters,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = counterSize * sizeof(GLuint);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorGroupStringAMD_length(const State &glState,
|
||||
|
@ -4168,7 +4168,7 @@ void CaptureGetPerfMonitorGroupStringAMD_length(const State &glState,
|
|||
GLchar *groupString,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = sizeof(GLsizei);
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorGroupStringAMD_groupString(const State &glState,
|
||||
|
@ -4179,7 +4179,7 @@ void CaptureGetPerfMonitorGroupStringAMD_groupString(const State &glState,
|
|||
GLchar *groupString,
|
||||
angle::ParamCapture *paramCapture)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
paramCapture->readBufferSizeBytes = bufSize;
|
||||
}
|
||||
|
||||
void CaptureGetPerfMonitorGroupsAMD_numGroups(const State &glState,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
|
||||
#include "common/third_party/base/anglebase/no_destructor.h"
|
||||
#include "libANGLE/Context.h"
|
||||
|
||||
namespace rx
|
||||
|
@ -79,4 +80,9 @@ angle::Result ContextImpl::releaseTextures(const gl::Context *context,
|
|||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
const angle::PerfMonitorCounterGroups &ContextImpl::getPerfMonitorCounters()
|
||||
{
|
||||
static angle::base::NoDestructor<angle::PerfMonitorCounterGroups> sCounters;
|
||||
return *sCounters;
|
||||
}
|
||||
} // namespace rx
|
||||
|
|
|
@ -256,6 +256,9 @@ class ContextImpl : public GLImplFactory
|
|||
virtual angle::Result releaseTextures(const gl::Context *context,
|
||||
gl::TextureBarrierVector *textureBarriers);
|
||||
|
||||
// AMD_performance_monitor
|
||||
virtual const angle::PerfMonitorCounterGroups &getPerfMonitorCounters();
|
||||
|
||||
protected:
|
||||
const gl::State &mState;
|
||||
gl::MemoryProgramCache *mMemoryProgramCache;
|
||||
|
|
|
@ -848,6 +848,23 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
|
|||
mDescriptorBufferInfos.reserve(kDescriptorBufferInfosInitialSize);
|
||||
mDescriptorImageInfos.reserve(kDescriptorImageInfosInitialSize);
|
||||
mWriteDescriptorSets.reserve(kDescriptorWriteInfosInitialSize);
|
||||
|
||||
angle::PerfMonitorCounterGroup vulkanGroup;
|
||||
vulkanGroup.name = "vulkan";
|
||||
|
||||
#define ANGLE_ADD_PERF_MONITOR_COUNTER_GROUP(COUNTER) \
|
||||
{ \
|
||||
angle::PerfMonitorCounter counter; \
|
||||
counter.name = #COUNTER; \
|
||||
counter.value = 0; \
|
||||
vulkanGroup.counters.push_back(counter); \
|
||||
}
|
||||
|
||||
ANGLE_VK_PERF_COUNTERS_X(ANGLE_ADD_PERF_MONITOR_COUNTER_GROUP)
|
||||
|
||||
#undef ANGLE_ADD_PERF_MONITOR_COUNTER_GROUP
|
||||
|
||||
mPerfMonitorCounters.push_back(vulkanGroup);
|
||||
}
|
||||
|
||||
ContextVk::~ContextVk() = default;
|
||||
|
@ -6872,4 +6889,20 @@ ProgramExecutableVk *ContextVk::getExecutable() const
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const angle::PerfMonitorCounterGroups &ContextVk::getPerfMonitorCounters()
|
||||
{
|
||||
syncObjectPerfCounters();
|
||||
|
||||
angle::PerfMonitorCounters &counters =
|
||||
angle::GetPerfMonitorCounterGroup(mPerfMonitorCounters, "vulkan").counters;
|
||||
|
||||
#define ANGLE_UPDATE_PERF_MAP(COUNTER) \
|
||||
angle::GetPerfMonitorCounter(counters, #COUNTER).value = mPerfCounters.COUNTER;
|
||||
|
||||
ANGLE_VK_PERF_COUNTERS_X(ANGLE_UPDATE_PERF_MAP)
|
||||
|
||||
#undef ANGLE_UPDATE_PERF_MAP
|
||||
return mPerfMonitorCounters;
|
||||
}
|
||||
} // namespace rx
|
||||
|
|
|
@ -652,8 +652,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
|
|||
|
||||
vk::BufferHelper &getEmptyBuffer() { return mEmptyBuffer; }
|
||||
|
||||
const vk::PerfCounters &getPerfCounters() const { return mPerfCounters; }
|
||||
vk::PerfCounters &getPerfCounters() { return mPerfCounters; }
|
||||
const angle::VulkanPerfCounters &getPerfCounters() const { return mPerfCounters; }
|
||||
angle::VulkanPerfCounters &getPerfCounters() { return mPerfCounters; }
|
||||
|
||||
// Implementation of MultisampleTextureInitializer
|
||||
angle::Result initializeMultisampleTextureToBlack(const gl::Context *context,
|
||||
|
@ -688,6 +688,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
|
|||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
const angle::PerfMonitorCounterGroups &getPerfMonitorCounters() override;
|
||||
|
||||
private:
|
||||
// Dirty bits.
|
||||
enum DirtyBitType : size_t
|
||||
|
@ -1210,7 +1212,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
|
|||
uint64_t mGpuEventTimestampOrigin;
|
||||
|
||||
// A mix of per-frame and per-run counters.
|
||||
vk::PerfCounters mPerfCounters;
|
||||
angle::VulkanPerfCounters mPerfCounters;
|
||||
angle::PerfMonitorCounterGroups mPerfMonitorCounters;
|
||||
ContextVkPerfCounters mContextPerfCounters;
|
||||
ContextVkPerfCounters mCumulativeContextPerfCounters;
|
||||
|
||||
|
|
|
@ -1459,7 +1459,7 @@ angle::Result FramebufferVk::resolveColorWithCommand(ContextVk *contextVk,
|
|||
resolveRegion.extent.height = params.blitArea.height;
|
||||
resolveRegion.extent.depth = 1;
|
||||
|
||||
vk::PerfCounters &perfCounters = contextVk->getPerfCounters();
|
||||
angle::VulkanPerfCounters &perfCounters = contextVk->getPerfCounters();
|
||||
for (size_t colorIndexGL : mState.getEnabledDrawBuffers())
|
||||
{
|
||||
RenderTargetVk *drawRenderTarget = mRenderTargetCache.getColors()[colorIndexGL];
|
||||
|
|
|
@ -1278,7 +1278,7 @@ void GetRenderPassAndUpdateCounters(ContextVk *contextVk,
|
|||
*renderPassOut = &renderPassHelper->getRenderPass();
|
||||
if (updatePerfCounters)
|
||||
{
|
||||
PerfCounters &counters = contextVk->getPerfCounters();
|
||||
angle::VulkanPerfCounters &counters = contextVk->getPerfCounters();
|
||||
const RenderPassPerfCounters &rpCounters = renderPassHelper->getPerfCounters();
|
||||
|
||||
counters.depthClears += rpCounters.depthClears;
|
||||
|
|
|
@ -1246,43 +1246,6 @@ struct RenderPassPerfCounters
|
|||
uint8_t readOnlyDepthStencil;
|
||||
};
|
||||
|
||||
struct PerfCounters
|
||||
{
|
||||
uint32_t primaryBuffers;
|
||||
uint32_t renderPasses;
|
||||
uint32_t writeDescriptorSets;
|
||||
uint32_t flushedOutsideRenderPassCommandBuffers;
|
||||
uint32_t resolveImageCommands;
|
||||
uint32_t depthClears;
|
||||
uint32_t depthLoads;
|
||||
uint32_t depthStores;
|
||||
uint32_t stencilClears;
|
||||
uint32_t stencilLoads;
|
||||
uint32_t stencilStores;
|
||||
uint32_t colorAttachmentUnresolves;
|
||||
uint32_t depthAttachmentUnresolves;
|
||||
uint32_t stencilAttachmentUnresolves;
|
||||
uint32_t colorAttachmentResolves;
|
||||
uint32_t depthAttachmentResolves;
|
||||
uint32_t stencilAttachmentResolves;
|
||||
uint32_t readOnlyDepthStencilRenderPasses;
|
||||
uint32_t descriptorSetAllocations;
|
||||
uint32_t descriptorSetCacheTotalSize;
|
||||
uint32_t descriptorSetCacheKeySizeBytes;
|
||||
uint32_t uniformsAndXfbDescriptorSetCacheHits;
|
||||
uint32_t uniformsAndXfbDescriptorSetCacheMisses;
|
||||
uint32_t uniformsAndXfbDescriptorSetCacheTotalSize;
|
||||
uint32_t textureDescriptorSetCacheHits;
|
||||
uint32_t textureDescriptorSetCacheMisses;
|
||||
uint32_t textureDescriptorSetCacheTotalSize;
|
||||
uint32_t shaderBuffersDescriptorSetCacheHits;
|
||||
uint32_t shaderBuffersDescriptorSetCacheMisses;
|
||||
uint32_t shaderBuffersDescriptorSetCacheTotalSize;
|
||||
uint32_t buffersGhosted;
|
||||
uint32_t vertexArraySyncStateCalls;
|
||||
uint32_t allocateNewBufferBlockCalls;
|
||||
};
|
||||
|
||||
// A Vulkan image level index.
|
||||
using LevelIndex = gl::LevelIndexWrapper<uint32_t>;
|
||||
|
||||
|
|
|
@ -2697,6 +2697,7 @@ bool ValidateBeginPerfMonitorAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2711,6 +2712,7 @@ bool ValidateDeletePerfMonitorsAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2722,6 +2724,7 @@ bool ValidateEndPerfMonitorAMD(const Context *context, angle::EntryPoint entryPo
|
|||
return false;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2736,6 +2739,7 @@ bool ValidateGenPerfMonitorsAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2753,7 +2757,25 @@ bool ValidateGetPerfMonitorCounterDataAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (monitor != 0)
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitor);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_PERFMON_RESULT_AVAILABLE_AMD:
|
||||
case GL_PERFMON_RESULT_SIZE_AMD:
|
||||
case GL_PERFMON_RESULT_AMD:
|
||||
break;
|
||||
|
||||
default:
|
||||
context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPname);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPerfMonitorCounterInfoAMD(const Context *context,
|
||||
|
@ -2769,7 +2791,32 @@ bool ValidateGetPerfMonitorCounterInfoAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
|
||||
|
||||
if (group >= groups.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (counter >= groups[group].counters.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorCounter);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_COUNTER_TYPE_AMD:
|
||||
case GL_COUNTER_RANGE_AMD:
|
||||
break;
|
||||
|
||||
default:
|
||||
context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPname);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPerfMonitorCounterStringAMD(const Context *context,
|
||||
|
@ -2786,7 +2833,21 @@ bool ValidateGetPerfMonitorCounterStringAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
|
||||
|
||||
if (group >= groups.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (counter >= groups[group].counters.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorCounter);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPerfMonitorCountersAMD(const Context *context,
|
||||
|
@ -2803,7 +2864,15 @@ bool ValidateGetPerfMonitorCountersAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
|
||||
|
||||
if (group >= groups.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPerfMonitorGroupStringAMD(const Context *context,
|
||||
|
@ -2819,7 +2888,15 @@ bool ValidateGetPerfMonitorGroupStringAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
|
||||
|
||||
if (group >= groups.size())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPerfMonitorGroupsAMD(const Context *context,
|
||||
|
@ -2834,7 +2911,7 @@ bool ValidateGetPerfMonitorGroupsAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateSelectPerfMonitorCountersAMD(const Context *context,
|
||||
|
@ -2851,6 +2928,7 @@ bool ValidateSelectPerfMonitorCountersAMD(const Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
} // namespace gl
|
||||
|
|
|
@ -150,6 +150,7 @@ angle_end2end_tests_sources = [
|
|||
"gl_tests/UnpackRowLength.cpp",
|
||||
"gl_tests/VertexAttributeTest.cpp",
|
||||
"gl_tests/ViewportTest.cpp",
|
||||
"gl_tests/VulkanPerformanceCounterTest.cpp",
|
||||
"gl_tests/WEBGLVideoTextureTest.cpp",
|
||||
"gl_tests/WebGLCompatibilityTest.cpp",
|
||||
"gl_tests/WebGLCompressedTextureAvailabilityTest.cpp",
|
||||
|
|
|
@ -527,3 +527,5 @@
|
|||
// NVidia fails new SwizzledChainedAssignIncrement test on GL and GLES.
|
||||
7029 NVIDIA OPENGL : GLSLTest.SwizzledChainedAssignIncrement/* = SKIP
|
||||
7029 NVIDIA GLES : GLSLTest.SwizzledChainedAssignIncrement/* = SKIP
|
||||
|
||||
7085 : VulkanPerformanceCounterTest.InvalidateDrawDisable/* = SKIP
|
||||
|
|
|
@ -22,6 +22,5 @@ angle_white_box_tests_vulkan_sources = [
|
|||
"gl_tests/VulkanFormatTablesTest.cpp",
|
||||
"gl_tests/VulkanFramebufferTest.cpp",
|
||||
"gl_tests/VulkanMultithreadingTest.cpp",
|
||||
"gl_tests/VulkanPerformanceCounterTest.cpp",
|
||||
"gl_tests/VulkanUniformUpdatesTest.cpp",
|
||||
]
|
||||
|
|
|
@ -203,3 +203,5 @@
|
|||
# GLES 3.2 tests that fail because of missing features
|
||||
5366 : GeometryShaderTestES32.MaxGeometryImageUniforms/* = CRASH
|
||||
5366 : ProgramPipelineTest32.MaxGeometryImageUniforms/* = CRASH
|
||||
|
||||
7088 : VulkanPerformanceCounterTest* = SKIP_FOR_CAPTURE
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче