Commit 72537ef1 by Jamie Madill

Add collection of D3D11 and DXGI stats.

Will require a chromium-side patch to enable boolean histograms. BUG=angleproject:966 BUG=436191 Change-Id: I3026c73894fbbff521503b377955816a8e831df8 Reviewed-on: https://chromium-review.googlesource.com/271174Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 21ce9b02
...@@ -114,6 +114,8 @@ class Platform ...@@ -114,6 +114,8 @@ class Platform
virtual void histogramEnumeration(const char *name, int sample, int boundaryValue) { } virtual void histogramEnumeration(const char *name, int sample, int boundaryValue) { }
// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets. // Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
virtual void histogramSparse(const char *name, int sample) { } virtual void histogramSparse(const char *name, int sample) { }
// Boolean histograms track two-state variables.
virtual void histogramBoolean(const char *name, bool sample) { }
protected: protected:
virtual ~Platform() { } virtual ~Platform() { }
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
#define ANGLE_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ #define ANGLE_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
ANGLE_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) ANGLE_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
#define ANGLE_HISTOGRAM_BOOLEAN(name, sample) \
ANGLEPlatformCurrent()->histogramBoolean(name, sample)
#define ANGLE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ #define ANGLE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
ANGLEPlatformCurrent()->histogramEnumeration(name, sample, boundary_value) ANGLEPlatformCurrent()->histogramEnumeration(name, sample, boundary_value)
......
...@@ -75,7 +75,7 @@ enum ...@@ -75,7 +75,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16 MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
}; };
static bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOURCE_VIEW_DESC desc) bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOURCE_VIEW_DESC desc)
{ {
unsigned mipLevel = index.mipIndex; unsigned mipLevel = index.mipIndex;
unsigned layerIndex = index.layerIndex; unsigned layerIndex = index.layerIndex;
...@@ -164,6 +164,32 @@ egl::Error GenerateD3D11CreateDeviceErr(HRESULT errorCode) ...@@ -164,6 +164,32 @@ egl::Error GenerateD3D11CreateDeviceErr(HRESULT errorCode)
return egl::Error(EGL_NOT_INITIALIZED, errorCode, "Could not create D3D11 device."); return egl::Error(EGL_NOT_INITIALIZED, errorCode, "Could not create D3D11 device.");
} }
enum ANGLEFeatureLevel
{
ANGLE_FEATURE_LEVEL_INVALID,
ANGLE_FEATURE_LEVEL_9_3,
ANGLE_FEATURE_LEVEL_10_0,
ANGLE_FEATURE_LEVEL_10_1,
ANGLE_FEATURE_LEVEL_11_0,
ANGLE_FEATURE_LEVEL_11_1,
NUM_ANGLE_FEATURE_LEVELS
};
ANGLEFeatureLevel GetANGLEFeatureLevel(D3D_FEATURE_LEVEL d3dFeatureLevel)
{
switch (d3dFeatureLevel)
{
case D3D_FEATURE_LEVEL_9_3: return ANGLE_FEATURE_LEVEL_9_3;
case D3D_FEATURE_LEVEL_10_0: return ANGLE_FEATURE_LEVEL_10_0;
case D3D_FEATURE_LEVEL_10_1: return ANGLE_FEATURE_LEVEL_10_1;
case D3D_FEATURE_LEVEL_11_0: return ANGLE_FEATURE_LEVEL_11_0;
// Note: we don't ever request a 11_1 device, because this gives
// an E_INVALIDARG error on systems that don't have the platform update.
case D3D_FEATURE_LEVEL_11_1: return ANGLE_FEATURE_LEVEL_11_1;
default: return ANGLE_FEATURE_LEVEL_INVALID;
}
}
} }
Renderer11::Renderer11(egl::Display *display) Renderer11::Renderer11(egl::Display *display)
...@@ -588,6 +614,24 @@ void Renderer11::initializeDevice() ...@@ -588,6 +614,24 @@ void Renderer11::initializeDevice()
mCurPixelSRVs.resize(rendererCaps.maxTextureImageUnits); mCurPixelSRVs.resize(rendererCaps.maxTextureImageUnits);
markAllStateDirty(); markAllStateDirty();
// Gather stats on DXGI and D3D feature level
ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_2", mRenderer11DeviceCaps.supportsDXGI1_2);
ANGLEFeatureLevel angleFeatureLevel = GetANGLEFeatureLevel(mRenderer11DeviceCaps.featureLevel);
// We don't actually request a 11_1 device, because of complications with the platform
// update. Instead we check if the mDeviceContext1 pointer cast succeeded.
// Note: we should support D3D11_0 always, but we aren't guaranteed to be at FL11_0
// because the app can specify a lower version (such as 9_3) on Display creation.
if (mDeviceContext1 != nullptr)
{
angleFeatureLevel = ANGLE_FEATURE_LEVEL_11_1;
}
ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D11FeatureLevel",
angleFeatureLevel,
NUM_ANGLE_FEATURE_LEVELS);
} }
egl::ConfigSet Renderer11::generateConfigs() const egl::ConfigSet Renderer11::generateConfigs() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment