Move GrBackend enum to enum class.
Bug: skia:
Change-Id: I8add2470313549723be6720b543091c444d2eb4f
Reviewed-on: https://skia-review.googlesource.com/c/161680
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ee9f9c0..21bed94 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -215,7 +215,7 @@
}
void fillOptions(ResultsWriter* log) override {
const GrGLubyte* version;
- if (this->contextInfo.backend() == kOpenGL_GrBackend) {
+ if (this->contextInfo.backend() == GrBackendApi::kOpenGL) {
const GrGLInterface* gl =
static_cast<GrGLGpu*>(this->contextInfo.grContext()->contextPriv().getGpu())
->glInterface();
diff --git a/dm/DMGpuTestProcs.cpp b/dm/DMGpuTestProcs.cpp
index ae8c7ab..f17c89a 100644
--- a/dm/DMGpuTestProcs.cpp
+++ b/dm/DMGpuTestProcs.cpp
@@ -14,13 +14,13 @@
namespace skiatest {
bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
- return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
+ return GrBackendApi::kOpenGL == GrContextFactory::ContextTypeBackend(type);
}
bool IsVulkanContextType(sk_gpu_test::GrContextFactory::ContextType type) {
- return kVulkan_GrBackend == GrContextFactory::ContextTypeBackend(type);
+ return GrBackendApi::kVulkan == GrContextFactory::ContextTypeBackend(type);
}
bool IsMetalContextType(sk_gpu_test::GrContextFactory::ContextType type) {
- return kMetal_GrBackend == GrContextFactory::ContextTypeBackend(type);
+ return GrBackendApi::kMetal == GrContextFactory::ContextTypeBackend(type);
}
bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
diff --git a/include/gpu/GrBackendSemaphore.h b/include/gpu/GrBackendSemaphore.h
index 828cdcb..bf49356 100644
--- a/include/gpu/GrBackendSemaphore.h
+++ b/include/gpu/GrBackendSemaphore.h
@@ -20,16 +20,16 @@
public:
// For convenience we just set the backend here to OpenGL. The GrBackendSemaphore cannot be used
// until either initGL or initVulkan are called which will set the appropriate GrBackend.
- GrBackendSemaphore() : fBackend(kOpenGL_GrBackend), fGLSync(0), fIsInitialized(false) {}
+ GrBackendSemaphore() : fBackend(GrBackendApi::kOpenGL), fGLSync(0), fIsInitialized(false) {}
void initGL(GrGLsync sync) {
- fBackend = kOpenGL_GrBackend;
+ fBackend = GrBackendApi::kOpenGL;
fGLSync = sync;
fIsInitialized = true;
}
void initVulkan(VkSemaphore semaphore) {
- fBackend = kVulkan_GrBackend;
+ fBackend = GrBackendApi::kVulkan;
fVkSemaphore = semaphore;
#ifdef SK_VULKAN
fIsInitialized = true;
@@ -41,21 +41,21 @@
bool isInitialized() const { return fIsInitialized; }
GrGLsync glSync() const {
- if (!fIsInitialized || kOpenGL_GrBackend != fBackend) {
+ if (!fIsInitialized || GrBackendApi::kOpenGL != fBackend) {
return 0;
}
return fGLSync;
}
VkSemaphore vkSemaphore() const {
- if (!fIsInitialized || kVulkan_GrBackend != fBackend) {
+ if (!fIsInitialized || GrBackendApi::kVulkan != fBackend) {
return VK_NULL_HANDLE;
}
return fVkSemaphore;
}
private:
- GrBackend fBackend;
+ GrBackendApi fBackend;
union {
GrGLsync fGLSync;
VkSemaphore fVkSemaphore;
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index 2e366d0..3f40ce2 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -61,7 +61,7 @@
return GrBackendFormat(config);
}
- GrBackend backend() const {return fBackend; }
+ GrBackendApi backend() const {return fBackend; }
// If the backend API is GL, these return a pointer to the format and target. Otherwise
// it returns nullptr.
@@ -96,7 +96,7 @@
GrBackendFormat(const GrPixelConfig config);
- GrBackend fBackend;
+ GrBackendApi fBackend;
bool fValid;
union {
@@ -148,7 +148,7 @@
int width() const { return fWidth; }
int height() const { return fHeight; }
bool hasMipMaps() const { return GrMipMapped::kYes == fMipMapped; }
- GrBackend backend() const {return fBackend; }
+ GrBackendApi backend() const {return fBackend; }
// If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
// pointer and returns true. Otherwise returns false if the backend API is not GL.
@@ -224,7 +224,7 @@
int fHeight; //<! height in pixels
GrPixelConfig fConfig;
GrMipMapped fMipMapped;
- GrBackend fBackend;
+ GrBackendApi fBackend;
union {
GrGLTextureInfo fGLInfo;
@@ -278,7 +278,7 @@
int height() const { return fHeight; }
int sampleCnt() const { return fSampleCnt; }
int stencilBits() const { return fStencilBits; }
- GrBackend backend() const {return fBackend; }
+ GrBackendApi backend() const {return fBackend; }
// If the backend API is GL, copies a snapshot of the GrGLFramebufferInfo struct into the passed
// in pointer and returns true. Otherwise returns false if the backend API is not GL.
@@ -347,7 +347,7 @@
int fStencilBits;
GrPixelConfig fConfig;
- GrBackend fBackend;
+ GrBackendApi fBackend;
union {
GrGLFramebufferInfo fGLInfo;
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 6258c50..84101a8 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -284,14 +284,14 @@
bool supportsDistanceFieldText() const;
protected:
- GrContext(GrBackend, int32_t id = SK_InvalidGenID);
+ GrContext(GrBackendApi, int32_t id = SK_InvalidGenID);
bool initCommon(const GrContextOptions&);
virtual bool init(const GrContextOptions&) = 0; // must be called after the ctor!
virtual GrAtlasManager* onGetAtlasManager() = 0;
- const GrBackend fBackend;
+ const GrBackendApi fBackend;
sk_sp<const GrCaps> fCaps;
sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
@@ -417,13 +417,13 @@
// DDL TODO: need to add unit tests for backend & maybe options
GrContextThreadSafeProxy(sk_sp<const GrCaps> caps,
uint32_t uniqueID,
- GrBackend backend,
+ GrBackendApi backend,
const GrContextOptions& options,
sk_sp<GrSkSLFPFactoryCache> cache);
sk_sp<const GrCaps> fCaps;
const uint32_t fContextUniqueID;
- const GrBackend fBackend;
+ const GrBackendApi fBackend;
const GrContextOptions fOptions;
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 6337f77..e134bd7 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -154,7 +154,7 @@
/**
* Enables driver workaround to use draws instead of glClear. This only applies to
- * kOpenGL_GrBackend.
+ * GrBackendApi::kOpenGL.
*/
Enable fUseDrawInsteadOfGLClear = Enable::kDefault;
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index f908d1e..61505e1 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -184,17 +184,26 @@
/**
* Possible 3D APIs that may be used by Ganesh.
*/
-enum GrBackend {
- kMetal_GrBackend,
- kOpenGL_GrBackend,
- kVulkan_GrBackend,
+enum class GrBackendApi : unsigned {
+ kMetal,
+ kOpenGL,
+ kVulkan,
/**
* Mock is a backend that does not draw anything. It is used for unit tests
* and to measure CPU overhead.
*/
- kMock_GrBackend,
+ kMock,
};
+/**
+ * Previously the above enum was not an enum class but a normal enum. To support the legacy use of
+ * the enum values we define them below so that no clients break.
+ */
+static constexpr GrBackendApi kMetal_GrBackend = GrBackendApi::kMetal;
+static constexpr GrBackendApi kOpenGL_GrBackend = GrBackendApi::kOpenGL;
+static constexpr GrBackendApi kVulkan_GrBackend = GrBackendApi::kVulkan;
+static constexpr GrBackendApi kMock_GrBackend = GrBackendApi::kMock;
+
///////////////////////////////////////////////////////////////////////////////
/**
diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp
index 1d9bc2b..b0909e8 100644
--- a/samplecode/SampleCCPRGeometry.cpp
+++ b/samplecode/SampleCCPRGeometry.cpp
@@ -320,7 +320,7 @@
void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state) {
GrResourceProvider* rp = state->resourceProvider();
GrContext* context = state->gpu()->getContext();
- GrGLGpu* glGpu = kOpenGL_GrBackend == context->contextPriv().getBackend()
+ GrGLGpu* glGpu = GrBackendApi::kOpenGL == context->contextPriv().getBackend()
? static_cast<GrGLGpu*>(state->gpu())
: nullptr;
if (glGpu) {
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index 84f31c9..6971612 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -105,7 +105,7 @@
bool usesGLFBO0 = fCharacterization.usesGLFBO0();
if (usesGLFBO0) {
- if (kOpenGL_GrBackend != fContext->contextPriv().getBackend() ||
+ if (GrBackendApi::kOpenGL != fContext->contextPriv().getBackend() ||
fCharacterization.isTextureable()) {
return false;
}
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index afde089..76918de 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -55,7 +55,7 @@
}
static bool can_import_protected_content(GrContext* context) {
- if (kOpenGL_GrBackend == context->contextPriv().getBackend()) {
+ if (GrBackendApi::kOpenGL == context->contextPriv().getBackend()) {
// Only compute whether the extension is present once the first time this
// function is called.
static bool hasIt = can_import_protected_content_eglimpl();
@@ -156,7 +156,7 @@
GrAHardwareBufferImageGenerator::DeleteImageCtx* deleteCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat) {
- SkASSERT(context->contextPriv().getBackend() == kVulkan_GrBackend);
+ SkASSERT(context->contextPriv().getBackend() == GrBackendApi::kVulkan);
GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
VkPhysicalDevice physicalDevice = gpu->physicalDevice();
@@ -422,11 +422,11 @@
}
bool createProtectedImage = isProtectedContent && can_import_protected_content(context);
- if (kOpenGL_GrBackend == context->contextPriv().getBackend()) {
+ if (GrBackendApi::kOpenGL == context->contextPriv().getBackend()) {
return make_gl_backend_texture(context, hardwareBuffer, width, height, config, deleteProc,
deleteCtx, createProtectedImage, backendFormat);
} else {
- SkASSERT(kVulkan_GrBackend == context->contextPriv().getBackend());
+ SkASSERT(GrBackendApi::kVulkan == context->contextPriv().getBackend());
#ifdef SK_VULKAN
// Currently we don't support protected images on vulkan
SkASSERT(!createProtectedImage);
@@ -438,8 +438,8 @@
}
}
-GrBackendFormat get_backend_format(GrBackend backend, uint32_t bufferFormat) {
- if (backend == kOpenGL_GrBackend) {
+GrBackendFormat get_backend_format(GrBackendApi backend, uint32_t bufferFormat) {
+ if (backend == GrBackendApi::kOpenGL) {
switch (bufferFormat) {
//TODO: find out if we can detect, which graphic buffers support GR_GL_TEXTURE_2D
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
@@ -456,7 +456,7 @@
default:
return GrBackendFormat::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_EXTERNAL);
}
- } else if (backend == kVulkan_GrBackend) {
+ } else if (backend == GrBackendApi::kVulkan) {
switch (bufferFormat) {
//TODO: find out if we can detect, which graphic buffers support GR_GL_TEXTURE_2D
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
@@ -500,7 +500,7 @@
desc.fConfig = pixelConfig;
GrTextureType textureType = GrTextureType::k2D;
- if (context->contextPriv().getBackend() == kOpenGL_GrBackend) {
+ if (context->contextPriv().getBackend() == GrBackendApi::kOpenGL) {
textureType = GrTextureType::kExternal;
}
@@ -582,8 +582,8 @@
if (nullptr == context) {
return false; //CPU backend is not supported, because hardware buffer can be swizzled
}
- return kOpenGL_GrBackend == context->contextPriv().getBackend() ||
- kVulkan_GrBackend == context->contextPriv().getBackend();
+ return GrBackendApi::kOpenGL == context->contextPriv().getBackend() ||
+ GrBackendApi::kVulkan == context->contextPriv().getBackend();
}
#endif //SK_BUILD_FOR_ANDROID_FRAMEWORK
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 0e6df50..8198d52 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -19,28 +19,28 @@
#endif
GrBackendFormat::GrBackendFormat(GrGLenum format, GrGLenum target)
- : fBackend(kOpenGL_GrBackend)
+ : fBackend(GrBackendApi::kOpenGL)
, fValid(true) {
fGL.fTarget = target;
fGL.fFormat = format;
}
const GrGLenum* GrBackendFormat::getGLFormat() const {
- if (this->isValid() && kOpenGL_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
return &fGL.fFormat;
}
return nullptr;
}
const GrGLenum* GrBackendFormat::getGLTarget() const {
- if (this->isValid() && kOpenGL_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
return &fGL.fTarget;
}
return nullptr;
}
GrBackendFormat::GrBackendFormat(VkFormat vkFormat)
- : fBackend(kVulkan_GrBackend)
+ : fBackend(GrBackendApi::kVulkan)
#ifdef SK_VULKAN
, fValid(true)
#else
@@ -50,7 +50,7 @@
}
const VkFormat* GrBackendFormat::getVkFormat() const {
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
return &fVkFormat;
}
return nullptr;
@@ -58,13 +58,13 @@
#ifdef SK_METAL
GrBackendFormat::GrBackendFormat(GrMTLPixelFormat mtlFormat)
- : fBackend(kMetal_GrBackend)
+ : fBackend(GrBackendApi::kMetal)
, fValid(true)
, fMtlFormat(mtlFormat) {
}
const GrMTLPixelFormat* GrBackendFormat::getMtlFormat() const {
- if (this->isValid() && kMetal_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMetal == fBackend) {
return &fMtlFormat;
}
return nullptr;
@@ -72,13 +72,13 @@
#endif
GrBackendFormat::GrBackendFormat(GrPixelConfig config)
- : fBackend(kMock_GrBackend)
+ : fBackend(GrBackendApi::kMock)
, fValid(true)
, fMockFormat(config) {
}
const GrPixelConfig* GrBackendFormat::getMockFormat() const {
- if (this->isValid() && kMock_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMock == fBackend) {
return &fMockFormat;
}
return nullptr;
@@ -104,7 +104,7 @@
, fHeight(height)
, fConfig(kUnknown_GrPixelConfig)
, fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1))
- , fBackend(kVulkan_GrBackend)
+ , fBackend(GrBackendApi::kVulkan)
, fVkInfo(vkInfo, layout.release()) {
}
#endif
@@ -119,7 +119,7 @@
, fHeight(height)
, fConfig(GrPixelConfig::kUnknown_GrPixelConfig)
, fMipMapped(mipMapped)
- , fBackend(kMetal_GrBackend)
+ , fBackend(GrBackendApi::kMetal)
, fMtlInfo(mtlInfo) {}
#endif
@@ -132,7 +132,7 @@
, fHeight(height)
, fConfig(kUnknown_GrPixelConfig)
, fMipMapped(mipMapped)
- , fBackend(kOpenGL_GrBackend)
+ , fBackend(GrBackendApi::kOpenGL)
, fGLInfo(glInfo) {}
GrBackendTexture::GrBackendTexture(int width,
@@ -144,7 +144,7 @@
, fHeight(height)
, fConfig(mockInfo.fConfig)
, fMipMapped(mipMapped)
- , fBackend(kMock_GrBackend)
+ , fBackend(GrBackendApi::kMock)
, fMockInfo(mockInfo) {}
GrBackendTexture::~GrBackendTexture() {
@@ -153,7 +153,7 @@
void GrBackendTexture::cleanup() {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
fVkInfo.cleanup();
}
#endif
@@ -176,20 +176,20 @@
fBackend = that.fBackend;
switch (that.fBackend) {
- case kOpenGL_GrBackend:
+ case GrBackendApi::kOpenGL:
fGLInfo = that.fGLInfo;
break;
- case kVulkan_GrBackend:
+ case GrBackendApi::kVulkan:
#ifdef SK_VULKAN
fVkInfo.assign(that.fVkInfo, this->isValid());
#endif
break;
#ifdef SK_METAL
- case kMetal_GrBackend:
+ case GrBackendApi::kMetal:
fMtlInfo = that.fMtlInfo;
break;
#endif
- case kMock_GrBackend:
+ case GrBackendApi::kMock:
fMockInfo = that.fMockInfo;
break;
default:
@@ -201,7 +201,7 @@
bool GrBackendTexture::getVkImageInfo(GrVkImageInfo* outInfo) const {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
*outInfo = fVkInfo.snapImageInfo();
return true;
}
@@ -211,7 +211,7 @@
void GrBackendTexture::setVkImageLayout(VkImageLayout layout) {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
fVkInfo.setImageLayout(layout);
}
#endif
@@ -226,7 +226,7 @@
sk_sp<GrVkImageLayout> GrBackendTexture::getGrVkImageLayout() const {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
return fVkInfo.getGrVkImageLayout();
}
#endif
@@ -235,7 +235,7 @@
#ifdef SK_METAL
bool GrBackendTexture::getMtlTextureInfo(GrMtlTextureInfo* outInfo) const {
- if (this->isValid() && kMetal_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMetal == fBackend) {
*outInfo = fMtlInfo;
return true;
}
@@ -244,7 +244,7 @@
#endif
bool GrBackendTexture::getGLTextureInfo(GrGLTextureInfo* outInfo) const {
- if (this->isValid() && kOpenGL_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
*outInfo = fGLInfo;
return true;
}
@@ -252,7 +252,7 @@
}
bool GrBackendTexture::getMockTextureInfo(GrMockTextureInfo* outInfo) const {
- if (this->isValid() && kMock_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMock == fBackend) {
*outInfo = fMockInfo;
return true;
}
@@ -274,17 +274,17 @@
}
switch (t0.fBackend) {
- case kOpenGL_GrBackend:
+ case GrBackendApi::kOpenGL:
return t0.fGLInfo == t1.fGLInfo;
- case kMock_GrBackend:
+ case GrBackendApi::kMock:
return t0.fMockInfo == t1.fMockInfo;
- case kVulkan_GrBackend:
+ case GrBackendApi::kVulkan:
#ifdef SK_VULKAN
return t0.fVkInfo == t1.fVkInfo;
#else
// fall through
#endif
- case kMetal_GrBackend:
+ case GrBackendApi::kMetal:
#ifdef SK_METAL
return t0.fMtlInfo == t1.fMtlInfo;
#else
@@ -334,7 +334,7 @@
, fSampleCnt(SkTMax(1, sampleCnt))
, fStencilBits(0) // We always create stencil buffers internally for vulkan
, fConfig(kUnknown_GrPixelConfig)
- , fBackend(kVulkan_GrBackend)
+ , fBackend(GrBackendApi::kVulkan)
, fVkInfo(vkInfo, layout.release()) {}
#endif
@@ -349,7 +349,7 @@
, fSampleCnt(SkTMax(1, sampleCnt))
, fStencilBits(0)
, fConfig(GrPixelConfig::kUnknown_GrPixelConfig)
- , fBackend(kMetal_GrBackend)
+ , fBackend(GrBackendApi::kMetal)
, fMtlInfo(mtlInfo) {}
#endif
@@ -364,7 +364,7 @@
, fSampleCnt(SkTMax(1, sampleCnt))
, fStencilBits(stencilBits)
, fConfig(kUnknown_GrPixelConfig)
- , fBackend(kOpenGL_GrBackend)
+ , fBackend(GrBackendApi::kOpenGL)
, fGLInfo(glInfo) {}
GrBackendRenderTarget::GrBackendRenderTarget(int width,
@@ -386,7 +386,7 @@
void GrBackendRenderTarget::cleanup() {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
fVkInfo.cleanup();
}
#endif
@@ -410,20 +410,20 @@
fBackend = that.fBackend;
switch (that.fBackend) {
- case kOpenGL_GrBackend:
+ case GrBackendApi::kOpenGL:
fGLInfo = that.fGLInfo;
break;
- case kVulkan_GrBackend:
+ case GrBackendApi::kVulkan:
#ifdef SK_VULKAN
fVkInfo.assign(that.fVkInfo, this->isValid());
#endif
break;
#ifdef SK_METAL
- case kMetal_GrBackend:
+ case GrBackendApi::kMetal:
fMtlInfo = that.fMtlInfo;
break;
#endif
- case kMock_GrBackend:
+ case GrBackendApi::kMock:
fMockInfo = that.fMockInfo;
break;
default:
@@ -435,7 +435,7 @@
bool GrBackendRenderTarget::getVkImageInfo(GrVkImageInfo* outInfo) const {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
*outInfo = fVkInfo.snapImageInfo();
return true;
}
@@ -445,7 +445,7 @@
void GrBackendRenderTarget::setVkImageLayout(VkImageLayout layout) {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
fVkInfo.setImageLayout(layout);
}
#endif
@@ -453,7 +453,7 @@
sk_sp<GrVkImageLayout> GrBackendRenderTarget::getGrVkImageLayout() const {
#ifdef SK_VULKAN
- if (this->isValid() && kVulkan_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
return fVkInfo.getGrVkImageLayout();
}
#endif
@@ -462,7 +462,7 @@
#ifdef SK_METAL
bool GrBackendRenderTarget::getMtlTextureInfo(GrMtlTextureInfo* outInfo) const {
- if (this->isValid() && kMetal_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMetal == fBackend) {
*outInfo = fMtlInfo;
return true;
}
@@ -471,7 +471,7 @@
#endif
bool GrBackendRenderTarget::getGLFramebufferInfo(GrGLFramebufferInfo* outInfo) const {
- if (this->isValid() && kOpenGL_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
*outInfo = fGLInfo;
return true;
}
@@ -479,7 +479,7 @@
}
bool GrBackendRenderTarget::getMockRenderTargetInfo(GrMockRenderTargetInfo* outInfo) const {
- if (this->isValid() && kMock_GrBackend == fBackend) {
+ if (this->isValid() && GrBackendApi::kMock == fBackend) {
*outInfo = fMockInfo;
return true;
}
@@ -503,17 +503,17 @@
}
switch (r0.fBackend) {
- case kOpenGL_GrBackend:
+ case GrBackendApi::kOpenGL:
return r0.fGLInfo == r1.fGLInfo;
- case kMock_GrBackend:
+ case GrBackendApi::kMock:
return r0.fMockInfo == r1.fMockInfo;
- case kVulkan_GrBackend:
+ case GrBackendApi::kVulkan:
#ifdef SK_VULKAN
return r0.fVkInfo == r1.fVkInfo;
#else
// fall through
#endif
- case kMetal_GrBackend:
+ case GrBackendApi::kMetal:
#ifdef SK_METAL
return r0.fMtlInfo == r1.fMtlInfo;
#else
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 596fa66..487dfe8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -66,7 +66,7 @@
return id;
}
-GrContext::GrContext(GrBackend backend, int32_t id)
+GrContext::GrContext(GrBackendApi backend, int32_t id)
: fBackend(backend)
, fUniqueID(SK_InvalidGenID == id ? next_id() : id) {
fResourceCache = nullptr;
@@ -168,7 +168,7 @@
//////////////////////////////////////////////////////////////////////////////
GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID,
- GrBackend backend,
+ GrBackendApi backend,
const GrContextOptions& options,
sk_sp<GrSkSLFPFactoryCache> cache)
: fCaps(std::move(caps))
@@ -193,7 +193,7 @@
return SkSurfaceCharacterization(); // return an invalid characterization
}
- if (kOpenGL_GrBackend != backendFormat.backend() && willUseGLFBO0) {
+ if (GrBackendApi::kOpenGL != backendFormat.backend() && willUseGLFBO0) {
// The willUseGLFBO0 flags can only be used for a GL backend.
return SkSurfaceCharacterization(); // return an invalid characterization
}
@@ -1129,11 +1129,11 @@
"Vulkan",
"Mock",
};
- GR_STATIC_ASSERT(0 == kMetal_GrBackend);
- GR_STATIC_ASSERT(1 == kOpenGL_GrBackend);
- GR_STATIC_ASSERT(2 == kVulkan_GrBackend);
- GR_STATIC_ASSERT(3 == kMock_GrBackend);
- writer.appendString("backend", kBackendStr[fContext->fBackend]);
+ GR_STATIC_ASSERT(0 == (unsigned)GrBackendApi::kMetal);
+ GR_STATIC_ASSERT(1 == (unsigned)GrBackendApi::kOpenGL);
+ GR_STATIC_ASSERT(2 == (unsigned)GrBackendApi::kVulkan);
+ GR_STATIC_ASSERT(3 == (unsigned)GrBackendApi::kMock);
+ writer.appendString("backend", kBackendStr[(unsigned)fContext->fBackend]);
writer.appendName("caps");
fContext->fCaps->dumpJSON(&writer);
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index afb3949..ba7b0cf 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -177,7 +177,7 @@
GrColorType srcColorType, SkColorSpace* srcColorSpace,
const void* buffer, size_t rowBytes, uint32_t pixelOpsFlags = 0);
- GrBackend getBackend() const { return fContext->fBackend; }
+ GrBackendApi getBackend() const { return fContext->fBackend; }
SkTaskGroup* getTaskGroup() { return fContext->fTaskGroup.get(); }
diff --git a/src/gpu/GrContextThreadSafeProxyPriv.h b/src/gpu/GrContextThreadSafeProxyPriv.h
index b3a4eab..1d251e4 100644
--- a/src/gpu/GrContextThreadSafeProxyPriv.h
+++ b/src/gpu/GrContextThreadSafeProxyPriv.h
@@ -22,7 +22,7 @@
const GrCaps* caps() const { return fProxy->fCaps.get(); }
sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
uint32_t contextUniqueID() const { return fProxy->fContextUniqueID; }
- GrBackend backend() const { return fProxy->fBackend; }
+ GrBackendApi backend() const { return fProxy->fBackend; }
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() const { return fProxy->fFPFactoryCache; }
private:
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 59b984c..c5acb50 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -23,7 +23,7 @@
class SK_API GrDirectContext : public GrContext {
public:
- GrDirectContext(GrBackend backend)
+ GrDirectContext(GrBackendApi backend)
: INHERITED(backend)
, fAtlasManager(nullptr) {
}
@@ -112,7 +112,7 @@
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
const GrContextOptions& options) {
- sk_sp<GrContext> context(new GrDirectContext(kOpenGL_GrBackend));
+ sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kOpenGL));
context->fGpu = GrGLGpu::Make(std::move(interface), options, context.get());
if (!context->fGpu) {
@@ -133,7 +133,7 @@
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
const GrContextOptions& options) {
- sk_sp<GrContext> context(new GrDirectContext(kMock_GrBackend));
+ sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMock));
context->fGpu = GrMockGpu::Make(mockOptions, options, context.get());
if (!context->fGpu) {
@@ -160,7 +160,7 @@
const GrContextOptions& options) {
#ifdef SK_VULKAN
GrContextOptions defaultOptions;
- sk_sp<GrContext> context(new GrDirectContext(kVulkan_GrBackend));
+ sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kVulkan));
context->fGpu = GrVkGpu::Make(backendContext, options, context.get());
if (!context->fGpu) {
@@ -184,7 +184,7 @@
}
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
- sk_sp<GrContext> context(new GrDirectContext(kMetal_GrBackend));
+ sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMetal));
context->fGpu = GrMtlTrampoline::MakeGpu(context.get(), options, device, queue);
if (!context->fGpu) {
diff --git a/src/gpu/GrNonAtomicRef.h b/src/gpu/GrNonAtomicRef.h
index 5a4e8d1..d554755 100644
--- a/src/gpu/GrNonAtomicRef.h
+++ b/src/gpu/GrNonAtomicRef.h
@@ -13,7 +13,7 @@
#include "SkTArray.h"
/**
- * A simple non-atomic ref used in the GrBackend when we don't want to pay for the overhead of a
+ * A simple non-atomic ref used in the GrBackendApi when we don't want to pay for the overhead of a
* threadsafe ref counted object
*/
template<typename TSubclass> class GrNonAtomicRef : public SkNoncopyable {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 3bc7d3a..d5a8d42 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4025,7 +4025,7 @@
}
bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
- SkASSERT(kOpenGL_GrBackend == tex.backend());
+ SkASSERT(GrBackendApi::kOpenGL == tex.backend());
GrGLTextureInfo info;
if (!tex.getGLTextureInfo(&info)) {
@@ -4039,7 +4039,7 @@
}
void GrGLGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
- SkASSERT(kOpenGL_GrBackend == tex.backend());
+ SkASSERT(GrBackendApi::kOpenGL == tex.backend());
GrGLTextureInfo info;
if (tex.getGLTextureInfo(&info)) {
@@ -4165,7 +4165,7 @@
}
void GrGLGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& backendRT) {
- SkASSERT(kOpenGL_GrBackend == backendRT.backend());
+ SkASSERT(GrBackendApi::kOpenGL == backendRT.backend());
GrGLFramebufferInfo info;
if (backendRT.getGLFramebufferInfo(&info)) {
if (info.fFBOID) {
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index ac3e5ca..8a8aee6 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -209,7 +209,7 @@
}
bool GrMockGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
- SkASSERT(kMock_GrBackend == tex.backend());
+ SkASSERT(GrBackendApi::kMock == tex.backend());
GrMockTextureInfo info;
if (!tex.getMockTextureInfo(&info)) {
@@ -220,7 +220,7 @@
}
void GrMockGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
- SkASSERT(kMock_GrBackend == tex.backend());
+ SkASSERT(GrBackendApi::kMock == tex.backend());
GrMockTextureInfo info;
if (tex.getMockTextureInfo(&info)) {
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index ee38c00..6624eef 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -518,7 +518,7 @@
}
bool GrMtlGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
- SkASSERT(kMetal_GrBackend == tex.backend());
+ SkASSERT(GrBackendApi::kMetal == tex.backend());
GrMtlTextureInfo info;
if (!tex.getMtlTextureInfo(&info)) {
@@ -533,7 +533,7 @@
}
void GrMtlGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
- SkASSERT(kMetal_GrBackend == tex.fBackend);
+ SkASSERT(GrBackendApi::kMetal == tex.fBackend);
GrMtlTextureInfo info;
if (tex.getMtlTextureInfo(&info)) {
@@ -561,7 +561,7 @@
}
void GrMtlGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) {
- SkASSERT(kMetal_GrBackend == rt.fBackend);
+ SkASSERT(GrBackendApi::kMetal == rt.fBackend);
GrMtlTextureInfo info;
if (rt.getMtlTextureInfo(&info)) {
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 371fd31..d002955 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1473,7 +1473,7 @@
}
bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
- SkASSERT(kVulkan_GrBackend == tex.fBackend);
+ SkASSERT(GrBackendApi::kVulkan == tex.fBackend);
GrVkImageInfo backend;
if (!tex.getVkImageInfo(&backend)) {
@@ -1495,7 +1495,7 @@
}
void GrVkGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
- SkASSERT(kVulkan_GrBackend == tex.fBackend);
+ SkASSERT(GrBackendApi::kVulkan == tex.fBackend);
GrVkImageInfo info;
if (tex.getVkImageInfo(&info)) {
@@ -1526,7 +1526,7 @@
}
void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) {
- SkASSERT(kVulkan_GrBackend == rt.fBackend);
+ SkASSERT(GrBackendApi::kVulkan == rt.fBackend);
GrVkImageInfo info;
if (rt.getVkImageInfo(&info)) {
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 703792d..419ee77 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -222,7 +222,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {
clear_op_test(reporter, ctxInfo.grContext());
- if (ctxInfo.backend() == kOpenGL_GrBackend) {
+ if (ctxInfo.backend() == GrBackendApi::kOpenGL) {
GrContextOptions options(ctxInfo.options());
options.fUseDrawInsteadOfGLClear = GrContextOptions::Enable::kYes;
sk_gpu_test::GrContextFactory workaroundFactory(options);
@@ -287,7 +287,7 @@
// From crbug.com/768134
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers, reporter, ctxInfo) {
fullscreen_clear_with_layer_test(reporter, ctxInfo.grContext());
- if (ctxInfo.backend() == kOpenGL_GrBackend) {
+ if (ctxInfo.backend() == GrBackendApi::kOpenGL) {
GrContextOptions options(ctxInfo.options());
options.fUseDrawInsteadOfGLClear = GrContextOptions::Enable::kYes;
sk_gpu_test::GrContextFactory workaroundFactory(options);
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index c4a7efd..f4ad618 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -56,7 +56,7 @@
const GrCaps* caps = context->contextPriv().caps();
switch (context->contextPriv().getBackend()) {
- case kOpenGL_GrBackend: {
+ case GrBackendApi::kOpenGL: {
const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(caps);
GrGLStandard standard = glCaps->standard();
@@ -126,7 +126,7 @@
}
break;
#ifdef SK_VULKAN
- case kVulkan_GrBackend:
+ case GrBackendApi::kVulkan:
switch (ct) {
case kUnknown_SkColorType:
return GrBackendFormat();
@@ -184,7 +184,7 @@
}
break;
#endif
- case kMock_GrBackend:
+ case GrBackendApi::kMock:
switch (ct) {
case kUnknown_SkColorType:
return GrBackendFormat();
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index f7e3768..db000d5 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -174,7 +174,7 @@
GrBackendTexture genBackendTex = genTexture->getBackendTexture();
- if (kOpenGL_GrBackend == genBackendTex.backend()) {
+ if (GrBackendApi::kOpenGL == genBackendTex.backend()) {
GrGLTextureInfo genTexInfo;
GrGLTextureInfo origTexInfo;
if (genBackendTex.getGLTextureInfo(&genTexInfo) &&
@@ -189,7 +189,7 @@
ERRORF(reporter, "Failed to get GrGLTextureInfo");
}
#ifdef SK_VULKAN
- } else if (kVulkan_GrBackend == genBackendTex.backend()) {
+ } else if (GrBackendApi::kVulkan == genBackendTex.backend()) {
GrVkImageInfo genImageInfo;
GrVkImageInfo origImageInfo;
if (genBackendTex.getVkImageInfo(&genImageInfo) &&
diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp
index 7eed68f..2a43458 100644
--- a/tests/PromiseImageTest.cpp
+++ b/tests/PromiseImageTest.cpp
@@ -136,7 +136,7 @@
expectedDoneCnt,
reporter));
- bool isVulkan = kVulkan_GrBackend == ctx->contextPriv().getBackend();
+ bool isVulkan = GrBackendApi::kVulkan == ctx->contextPriv().getBackend();
canvas->flush();
expectedFulfillCnt++;
expectedReleaseCnt++;
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 5e050a3..8988ed5 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -234,7 +234,7 @@
// Test wrapping FBO 0 (with made up properties). This tests sample count and the
// special case where FBO 0 doesn't support window rectangles.
- if (kOpenGL_GrBackend == ctxInfo.backend()) {
+ if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
static constexpr int kStencilBits = 8;
diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp
index 43aea5a..508051d 100644
--- a/tests/SurfaceSemaphoreTest.cpp
+++ b/tests/SurfaceSemaphoreTest.cpp
@@ -124,7 +124,7 @@
SkAutoTArray<GrBackendSemaphore> semaphores(2);
#ifdef SK_VULKAN
- if (kVulkan_GrBackend == mainInfo.backend()) {
+ if (GrBackendApi::kVulkan == mainInfo.backend()) {
// Initialize the secondary semaphore instead of having Ganesh create one internally
GrVkGpu* gpu = static_cast<GrVkGpu*>(mainCtx->contextPriv().getGpu());
const GrVkInterface* interface = gpu->vkInterface();
@@ -154,7 +154,7 @@
draw_child(reporter, childInfo1, backendTexture, semaphores[0]);
#ifdef SK_VULKAN
- if (kVulkan_GrBackend == mainInfo.backend()) {
+ if (GrBackendApi::kVulkan == mainInfo.backend()) {
// In Vulkan we need to make sure we are sending the correct VkImageLayout in with the
// backendImage. After the first child draw the layout gets changed to SHADER_READ, so
// we just manually set that here.
@@ -229,7 +229,7 @@
GrSemaphoresSubmitted submitted = mainSurface->flushAndSignalSemaphores(1, &semaphore);
REPORTER_ASSERT(reporter, GrSemaphoresSubmitted::kYes == submitted);
- if (kOpenGL_GrBackend == ctxInfo.backend()) {
+ if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLGpu* gpu = static_cast<GrGLGpu*>(ctx->contextPriv().getGpu());
const GrGLInterface* interface = gpu->glInterface();
GrGLsync sync = semaphore.glSync();
@@ -240,7 +240,7 @@
}
#ifdef SK_VULKAN
- if (kVulkan_GrBackend == ctxInfo.backend()) {
+ if (GrBackendApi::kVulkan == ctxInfo.backend()) {
GrVkGpu* gpu = static_cast<GrVkGpu*>(ctx->contextPriv().getGpu());
const GrVkInterface* interface = gpu->vkInterface();
VkDevice device = gpu->device();
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index d0ee218..d932602 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -148,9 +148,9 @@
}
std::unique_ptr<TestContext> testCtx;
- GrBackend backend = ContextTypeBackend(type);
+ GrBackendApi backend = ContextTypeBackend(type);
switch (backend) {
- case kOpenGL_GrBackend: {
+ case GrBackendApi::kOpenGL: {
GLTestContext* glShareContext = masterContext
? static_cast<GLTestContext*>(masterContext->fTestContext) : nullptr;
GLTestContext* glCtx;
@@ -202,7 +202,7 @@
break;
}
#ifdef SK_VULKAN
- case kVulkan_GrBackend: {
+ case GrBackendApi::kVulkan: {
VkTestContext* vkSharedContext = masterContext
? static_cast<VkTestContext*>(masterContext->fTestContext) : nullptr;
SkASSERT(kVulkan_ContextType == type);
@@ -227,7 +227,7 @@
}
#endif
#ifdef SK_METAL
- case kMetal_GrBackend: {
+ case GrBackendApi::kMetal: {
SkASSERT(!masterContext);
testCtx.reset(CreatePlatformMtlTestContext(nullptr));
if (!testCtx) {
@@ -236,7 +236,7 @@
break;
}
#endif
- case kMock_GrBackend: {
+ case GrBackendApi::kMock: {
TestContext* sharedContext = masterContext ? masterContext->fTestContext : nullptr;
SkASSERT(kMock_ContextType == type);
if (ContextOverrides::kRequireNVPRSupport & overrides) {
diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h
index 7134c5c..e2e4fe9 100644
--- a/tools/gpu/GrContextFactory.h
+++ b/tools/gpu/GrContextFactory.h
@@ -70,16 +70,16 @@
}
}
- static GrBackend ContextTypeBackend(ContextType type) {
+ static GrBackendApi ContextTypeBackend(ContextType type) {
switch (type) {
case kVulkan_ContextType:
- return kVulkan_GrBackend;
+ return GrBackendApi::kVulkan;
case kMetal_ContextType:
- return kMetal_GrBackend;
+ return GrBackendApi::kMetal;
case kMock_ContextType:
- return kMock_GrBackend;
+ return GrBackendApi::kMock;
default:
- return kOpenGL_GrBackend;
+ return GrBackendApi::kOpenGL;
}
}
@@ -150,7 +150,7 @@
ContextType fType;
ContextOverrides fOverrides;
GrContextOptions fOptions;
- GrBackend fBackend;
+ GrBackendApi fBackend;
TestContext* fTestContext;
GrContext* fGrContext;
GrContext* fShareContext;
@@ -169,14 +169,14 @@
ContextInfo& operator=(const ContextInfo&) = default;
GrContextFactory::ContextType type() const { return fType; }
- GrBackend backend() const { return GrContextFactory::ContextTypeBackend(fType); }
+ GrBackendApi backend() const { return GrContextFactory::ContextTypeBackend(fType); }
GrContext* grContext() const { return fGrContext; }
TestContext* testContext() const { return fTestContext; }
GLTestContext* glContext() const {
- SkASSERT(kOpenGL_GrBackend == this->backend());
+ SkASSERT(GrBackendApi::kOpenGL == this->backend());
return static_cast<GLTestContext*>(fTestContext);
}
diff --git a/tools/gpu/TestContext.h b/tools/gpu/TestContext.h
index 8e939a6..7a92bc0 100644
--- a/tools/gpu/TestContext.h
+++ b/tools/gpu/TestContext.h
@@ -59,7 +59,7 @@
*/
SkScopeExit SK_WARN_UNUSED_RESULT makeCurrentAndAutoRestore() const;
- virtual GrBackend backend() = 0;
+ virtual GrBackendApi backend() = 0;
virtual sk_sp<GrContext> makeGrContext(const GrContextOptions&);
diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h
index f5a0593..d376ed6 100644
--- a/tools/gpu/gl/GLTestContext.h
+++ b/tools/gpu/gl/GLTestContext.h
@@ -20,7 +20,7 @@
public:
~GLTestContext() override;
- virtual GrBackend backend() override { return kOpenGL_GrBackend; }
+ virtual GrBackendApi backend() override { return GrBackendApi::kOpenGL; }
bool isValid() const { return SkToBool(this->gl()); }
diff --git a/tools/gpu/mock/MockTestContext.cpp b/tools/gpu/mock/MockTestContext.cpp
index 6075bc8..3bcf0f1 100644
--- a/tools/gpu/mock/MockTestContext.cpp
+++ b/tools/gpu/mock/MockTestContext.cpp
@@ -19,7 +19,7 @@
MockTestContext() {}
~MockTestContext() override {}
- virtual GrBackend backend() override { return kMock_GrBackend; }
+ virtual GrBackendApi backend() override { return GrBackendApi::kMock; }
void testAbandon() override {}
void submit() override {}
diff --git a/tools/gpu/mock/MockTestContext.h b/tools/gpu/mock/MockTestContext.h
index 4aac248..4c3a52f 100644
--- a/tools/gpu/mock/MockTestContext.h
+++ b/tools/gpu/mock/MockTestContext.h
@@ -13,7 +13,7 @@
namespace sk_gpu_test {
/**
- * Creates mock context object for use with GrContexts created with kMock_GrBackend. It will
+ * Creates mock context object for use with GrContexts created with GrBackendApi::kMock. It will
* trivially succeed at everything.
*/
TestContext* CreateMockTestContext(TestContext* shareContext = nullptr);
diff --git a/tools/gpu/mtl/MtlTestContext.mm b/tools/gpu/mtl/MtlTestContext.mm
index cdc0f8f..18be792 100644
--- a/tools/gpu/mtl/MtlTestContext.mm
+++ b/tools/gpu/mtl/MtlTestContext.mm
@@ -120,7 +120,7 @@
~MtlTestContext() override { this->teardown(); }
- GrBackend backend() override { return kMetal_GrBackend; }
+ GrBackendApi backend() override { return GrBackendApi::kMetal; }
void testAbandon() override {}
diff --git a/tools/gpu/vk/VkTestContext.h b/tools/gpu/vk/VkTestContext.h
index f8f12cb..a1a1fe1 100644
--- a/tools/gpu/vk/VkTestContext.h
+++ b/tools/gpu/vk/VkTestContext.h
@@ -20,7 +20,7 @@
namespace sk_gpu_test {
class VkTestContext : public TestContext {
public:
- virtual GrBackend backend() override { return kVulkan_GrBackend; }
+ virtual GrBackendApi backend() override { return GrBackendApi::kVulkan; }
const GrVkBackendContext& getVkBackendContext() const {
return fVk;