Make GrCaps and GrShaderCaps private.
Moves getCaps() from GrContext to GrContextPriv and removes unused refCaps().
Change-Id: Ic6a8951b656c0d1b2773eae73bff8e88af819866
Reviewed-on: https://skia-review.googlesource.com/127389
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 3692606..2bfccd9 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -7,6 +7,7 @@
*/
#include "GrContextFactory.h"
+#include "GrContextPriv.h"
#include "gl/GLTestContext.h"
#if SK_ANGLE
@@ -275,12 +276,12 @@
return ContextInfo();
}
if (ContextOverrides::kRequireNVPRSupport & overrides) {
- if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) {
+ if (!grCtx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
return ContextInfo();
}
}
if (ContextOverrides::kRequireSRGBSupport & overrides) {
- if (!grCtx->caps()->srgbSupport()) {
+ if (!grCtx->contextPriv().caps()->srgbSupport()) {
return ContextInfo();
}
}
diff --git a/tools/sk_app/GLWindowContext.cpp b/tools/sk_app/GLWindowContext.cpp
index 7dddede..b6a8df9 100644
--- a/tools/sk_app/GLWindowContext.cpp
+++ b/tools/sk_app/GLWindowContext.cpp
@@ -6,17 +6,17 @@
* found in the LICENSE file.
*/
-#include "GrBackendSurface.h"
-#include "GrContext.h"
#include "GLWindowContext.h"
-
-#include "gl/GrGLDefines.h"
-#include "gl/GrGLUtil.h"
-
+#include "GrBackendSurface.h"
+#include "GrCaps.h"
+#include "GrContext.h"
+#include "GrContextPriv.h"
#include "SkCanvas.h"
#include "SkImage_Base.h"
#include "SkMathPriv.h"
#include "SkSurface.h"
+#include "gl/GrGLDefines.h"
+#include "gl/GrGLUtil.h"
namespace sk_app {
@@ -61,8 +61,10 @@
GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING,
&buffer));
fbInfo.fFBOID = buffer;
- fbInfo.fFormat = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace
- ? GR_GL_SRGB8_ALPHA8 : GR_GL_RGBA8;
+ fbInfo.fFormat =
+ fContext->contextPriv().caps()->srgbSupport() && fDisplayParams.fColorSpace
+ ? GR_GL_SRGB8_ALPHA8
+ : GR_GL_RGBA8;
GrBackendRenderTarget backendRT(fWidth,
fHeight,
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 6081c05..7808638 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -136,7 +136,7 @@
bounds = fPicture->cullRect().roundOut();
if (fGPUEnabled) {
#if SK_SUPPORT_GPU
- int maxRTSize = this->getContext()->caps()->maxRenderTargetSize();
+ int maxRTSize = this->getContext()->maxRenderTargetSize();
bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize),
SkTMin(bounds.height(), maxRTSize));
#endif
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 92a642a..452095f 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -5,13 +5,20 @@
* found in the LICENSE file.
*/
+#include <stdlib.h>
+#include <algorithm>
+#include <array>
+#include <chrono>
+#include <cmath>
+#include <vector>
#include "GpuTimer.h"
+#include "GrCaps.h"
#include "GrContextFactory.h"
-#include "SkGr.h"
-
+#include "GrContextPriv.h"
#include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsGpu.h"
+#include "SkGr.h"
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkPerlinNoiseShader.h"
@@ -20,16 +27,10 @@
#include "SkStream.h"
#include "SkSurface.h"
#include "SkSurfaceProps.h"
-#include "picture_utils.h"
-#include "sk_tool_utils.h"
#include "flags/SkCommandLineFlags.h"
#include "flags/SkCommonFlagsConfig.h"
-#include <stdlib.h>
-#include <algorithm>
-#include <array>
-#include <chrono>
-#include <cmath>
-#include <vector>
+#include "picture_utils.h"
+#include "sk_tool_utils.h"
/**
* This is a minimalist program whose sole purpose is to open an skp file, benchmark it on a single
@@ -290,19 +291,18 @@
exitf(ExitErr::kUnavailable, "failed to create context for config %s",
config->getTag().c_str());
}
- if (ctx->caps()->maxRenderTargetSize() < SkTMax(width, height)) {
+ if (ctx->maxRenderTargetSize() < SkTMax(width, height)) {
exitf(ExitErr::kUnavailable, "render target size %ix%i not supported by platform (max: %i)",
- width, height, ctx->caps()->maxRenderTargetSize());
+ width, height, ctx->maxRenderTargetSize());
}
- GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(config->getColorType(),
- config->getColorSpace(),
- *ctx->caps());
+ GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(
+ config->getColorType(), config->getColorSpace(), *ctx->contextPriv().caps());
if (kUnknown_GrPixelConfig == grPixConfig) {
exitf(ExitErr::kUnavailable, "failed to get GrPixelConfig from SkColorType: %d",
config->getColorType());
}
- int supportedSampleCount =
- ctx->caps()->getRenderTargetSampleCount(config->getSamples(), grPixConfig);
+ int supportedSampleCount = ctx->contextPriv().caps()->getRenderTargetSampleCount(
+ config->getSamples(), grPixConfig);
if (supportedSampleCount != config->getSamples()) {
exitf(ExitErr::kUnavailable, "sample count %i not supported by platform",
config->getSamples());
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 1858682..cfb8c61 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -6,22 +6,21 @@
*/
#include "Viewer.h"
-
+#include <stdlib.h>
+#include <map>
#include "BisectSlide.h"
#include "GMSlide.h"
+#include "GrContext.h"
+#include "GrContextPriv.h"
#include "ImageSlide.h"
#include "Resources.h"
-#include "SampleSlide.h"
#include "SKPSlide.h"
-#include "SlideDir.h"
-#include "SvgSlide.h"
-
-#include "GrContext.h"
+#include "SampleSlide.h"
#include "SkCanvas.h"
#include "SkColorSpacePriv.h"
#include "SkColorSpaceXformCanvas.h"
-#include "SkCommonFlags.h"
#include "SkCommandLineFlags.h"
+#include "SkCommonFlags.h"
#include "SkCommonFlagsGpu.h"
#include "SkEventTracingPriv.h"
#include "SkFontMgrPriv.h"
@@ -38,13 +37,10 @@
#include "SkTaskGroup.h"
#include "SkTestFontMgr.h"
#include "SkThreadedBMPDevice.h"
-
-#include "imgui.h"
-
+#include "SlideDir.h"
+#include "SvgSlide.h"
#include "ccpr/GrCoverageCountingPathRenderer.h"
-
-#include <stdlib.h>
-#include <map>
+#include "imgui.h"
#if defined(SK_ENABLE_SKOTTIE)
#include "SkottieSlide.h"
@@ -1479,7 +1475,7 @@
} else if (fWindow->sampleCount() > 1) {
prButton(GpuPathRenderers::kDefault);
prButton(GpuPathRenderers::kAll);
- if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
+ if (ctx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
prButton(GpuPathRenderers::kStencilAndCover);
}
prButton(GpuPathRenderers::kTessellating);
@@ -1487,7 +1483,8 @@
} else {
prButton(GpuPathRenderers::kDefault);
prButton(GpuPathRenderers::kAll);
- if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
+ if (GrCoverageCountingPathRenderer::IsSupported(
+ *ctx->contextPriv().caps())) {
prButton(GpuPathRenderers::kCoverageCounting);
}
prButton(GpuPathRenderers::kSmall);
@@ -1852,7 +1849,7 @@
} else if (fWindow->sampleCount() > 1) {
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
- if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
+ if (ctx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kStencilAndCover]);
}
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kTessellating]);
@@ -1860,7 +1857,7 @@
} else {
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
- if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
+ if (GrCoverageCountingPathRenderer::IsSupported(*ctx->contextPriv().caps())) {
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kCoverageCounting]);
}
prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kSmall]);