diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index ee9f9c0dbe..21bed94212 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -215,7 +215,7 @@ struct GPUTarget : public Target { } 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(this->contextInfo.grContext()->contextPriv().getGpu()) ->glInterface(); diff --git a/dm/DMGpuTestProcs.cpp b/dm/DMGpuTestProcs.cpp index ae8c7ab689..f17c89a651 100644 --- a/dm/DMGpuTestProcs.cpp +++ b/dm/DMGpuTestProcs.cpp @@ -14,13 +14,13 @@ using sk_gpu_test::ContextInfo; 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 828cdcb17a..bf4935654c 100644 --- a/include/gpu/GrBackendSemaphore.h +++ b/include/gpu/GrBackendSemaphore.h @@ -20,16 +20,16 @@ class GrBackendSemaphore { 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 @@ public: 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 2e366d0fd7..3f40ce2feb 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -61,7 +61,7 @@ public: 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 @@ private: GrBackendFormat(const GrPixelConfig config); - GrBackend fBackend; + GrBackendApi fBackend; bool fValid; union { @@ -148,7 +148,7 @@ public: 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 @@ private: int fHeight; // fCaps; sk_sp fThreadSafeProxy; sk_sp fFPFactoryCache; @@ -417,13 +417,13 @@ private: // DDL TODO: need to add unit tests for backend & maybe options GrContextThreadSafeProxy(sk_sp caps, uint32_t uniqueID, - GrBackend backend, + GrBackendApi backend, const GrContextOptions& options, sk_sp cache); sk_sp fCaps; const uint32_t fContextUniqueID; - const GrBackend fBackend; + const GrBackendApi fBackend; const GrContextOptions fOptions; sk_sp fFPFactoryCache; diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index 6337f778d5..e134bd7d8e 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -154,7 +154,7 @@ struct GrContextOptions { /** * 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 f908d1e1f6..61505e1452 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -184,17 +184,26 @@ static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) { /** * 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 1d9bc2bfcf..b0909e8f06 100644 --- a/samplecode/SampleCCPRGeometry.cpp +++ b/samplecode/SampleCCPRGeometry.cpp @@ -320,7 +320,7 @@ void CCPRGeometryView::updateGpuData() { 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(state->gpu()) : nullptr; if (glGpu) { diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp index 84f31c93df..697161292e 100644 --- a/src/core/SkDeferredDisplayListRecorder.cpp +++ b/src/core/SkDeferredDisplayListRecorder.cpp @@ -105,7 +105,7 @@ bool SkDeferredDisplayListRecorder::init() { 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 afde0892b5..76918dee9d 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -55,7 +55,7 @@ static bool can_import_protected_content_eglimpl() { } 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 @@ static GrBackendTexture make_vk_backend_texture( GrAHardwareBufferImageGenerator::DeleteImageCtx* deleteCtx, bool isProtectedContent, const GrBackendFormat& backendFormat) { - SkASSERT(context->contextPriv().getBackend() == kVulkan_GrBackend); + SkASSERT(context->contextPriv().getBackend() == GrBackendApi::kVulkan); GrVkGpu* gpu = static_cast(context->contextPriv().getGpu()); VkPhysicalDevice physicalDevice = gpu->physicalDevice(); @@ -422,11 +422,11 @@ static GrBackendTexture make_backend_texture( } 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 @@ static GrBackendTexture make_backend_texture( } } -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 @@ GrBackendFormat get_backend_format(GrBackend backend, uint32_t bufferFormat) { 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 @@ sk_sp GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont 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 @@ bool GrAHardwareBufferImageGenerator::onIsValid(GrContext* context) const { 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 0e6df50c1e..8198d5280f 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 @@ GrBackendFormat::GrBackendFormat(VkFormat vkFormat) } 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 @@ const VkFormat* GrBackendFormat::getVkFormat() const { #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 @@ const GrMTLPixelFormat* GrBackendFormat::getMtlFormat() const { #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 @@ GrBackendTexture::GrBackendTexture(int width, , 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 @@ GrBackendTexture::GrBackendTexture(int width, , fHeight(height) , fConfig(GrPixelConfig::kUnknown_GrPixelConfig) , fMipMapped(mipMapped) - , fBackend(kMetal_GrBackend) + , fBackend(GrBackendApi::kMetal) , fMtlInfo(mtlInfo) {} #endif @@ -132,7 +132,7 @@ GrBackendTexture::GrBackendTexture(int width, , fHeight(height) , fConfig(kUnknown_GrPixelConfig) , fMipMapped(mipMapped) - , fBackend(kOpenGL_GrBackend) + , fBackend(GrBackendApi::kOpenGL) , fGLInfo(glInfo) {} GrBackendTexture::GrBackendTexture(int width, @@ -144,7 +144,7 @@ GrBackendTexture::GrBackendTexture(int width, , fHeight(height) , fConfig(mockInfo.fConfig) , fMipMapped(mipMapped) - , fBackend(kMock_GrBackend) + , fBackend(GrBackendApi::kMock) , fMockInfo(mockInfo) {} GrBackendTexture::~GrBackendTexture() { @@ -153,7 +153,7 @@ GrBackendTexture::~GrBackendTexture() { 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 @@ GrBackendTexture& GrBackendTexture::operator=(const GrBackendTexture& that) { 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 @@ GrBackendTexture& GrBackendTexture::operator=(const GrBackendTexture& that) { 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 @@ bool GrBackendTexture::getVkImageInfo(GrVkImageInfo* outInfo) const { 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 @@ class GrVkImageLayout : public SkRefCnt { sk_sp 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 @@ sk_sp GrBackendTexture::getGrVkImageLayout() const { #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 @@ bool GrBackendTexture::getMtlTextureInfo(GrMtlTextureInfo* outInfo) const { #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::getGLTextureInfo(GrGLTextureInfo* outInfo) const { } 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 @@ bool GrBackendTexture::TestingOnly_Equals(const GrBackendTexture& t0, const GrBa } 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 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , 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 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(0) , fConfig(GrPixelConfig::kUnknown_GrPixelConfig) - , fBackend(kMetal_GrBackend) + , fBackend(GrBackendApi::kMetal) , fMtlInfo(mtlInfo) {} #endif @@ -364,7 +364,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , 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 @@ GrBackendRenderTarget::~GrBackendRenderTarget() { 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 @@ GrBackendRenderTarget& GrBackendRenderTarget::operator=(const GrBackendRenderTar 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 @@ GrBackendRenderTarget& GrBackendRenderTarget::operator=(const GrBackendRenderTar 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 @@ bool GrBackendRenderTarget::getVkImageInfo(GrVkImageInfo* outInfo) const { 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 @@ void GrBackendRenderTarget::setVkImageLayout(VkImageLayout layout) { sk_sp 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 @@ sk_sp GrBackendRenderTarget::getGrVkImageLayout() const { #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 @@ bool GrBackendRenderTarget::getMtlTextureInfo(GrMtlTextureInfo* outInfo) const { #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::getGLFramebufferInfo(GrGLFramebufferInfo* outInfo) c } 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 @@ bool GrBackendRenderTarget::TestingOnly_Equals(const GrBackendRenderTarget& r0, } 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 596fa66eb6..487dfe83ea 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -66,7 +66,7 @@ static int32_t next_id() { 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 @@ GrContext::~GrContext() { ////////////////////////////////////////////////////////////////////////////// GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp caps, uint32_t uniqueID, - GrBackend backend, + GrBackendApi backend, const GrContextOptions& options, sk_sp cache) : fCaps(std::move(caps)) @@ -193,7 +193,7 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization( 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 @@ SkString GrContextPriv::dump() const { "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 afb3949f4c..ba7b0cfa0e 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -177,7 +177,7 @@ public: 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 b3a4eab021..1d251e46c3 100644 --- a/src/gpu/GrContextThreadSafeProxyPriv.h +++ b/src/gpu/GrContextThreadSafeProxyPriv.h @@ -22,7 +22,7 @@ public: const GrCaps* caps() const { return fProxy->fCaps.get(); } sk_sp 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 fpFactoryCache() const { return fProxy->fFPFactoryCache; } private: diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp index 59b984caa3..c5acb50e3c 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::MakeGL() { sk_sp GrContext::MakeGL(sk_sp interface, const GrContextOptions& options) { - sk_sp context(new GrDirectContext(kOpenGL_GrBackend)); + sk_sp 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::MakeMock(const GrMockOptions* mockOptions) { sk_sp GrContext::MakeMock(const GrMockOptions* mockOptions, const GrContextOptions& options) { - sk_sp context(new GrDirectContext(kMock_GrBackend)); + sk_sp context(new GrDirectContext(GrBackendApi::kMock)); context->fGpu = GrMockGpu::Make(mockOptions, options, context.get()); if (!context->fGpu) { @@ -160,7 +160,7 @@ sk_sp GrContext::MakeVulkan(const GrVkBackendContext& backendContext, const GrContextOptions& options) { #ifdef SK_VULKAN GrContextOptions defaultOptions; - sk_sp context(new GrDirectContext(kVulkan_GrBackend)); + sk_sp context(new GrDirectContext(GrBackendApi::kVulkan)); context->fGpu = GrVkGpu::Make(backendContext, options, context.get()); if (!context->fGpu) { @@ -184,7 +184,7 @@ sk_sp GrContext::MakeMetal(void* device, void* queue) { } sk_sp GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) { - sk_sp context(new GrDirectContext(kMetal_GrBackend)); + sk_sp 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 5a4e8d1dbb..d554755629 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 class GrNonAtomicRef : public SkNoncopyable { diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 3bc7d3a4ca..d5a8d42d25 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -4025,7 +4025,7 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in } 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 @@ bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { } 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 @@ GrBackendRenderTarget GrGLGpu::createTestingOnlyBackendRenderTarget(int w, int h } 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 ac3e5ca2c8..8a8aee6472 100644 --- a/src/gpu/mock/GrMockGpu.cpp +++ b/src/gpu/mock/GrMockGpu.cpp @@ -209,7 +209,7 @@ GrBackendTexture GrMockGpu::createTestingOnlyBackendTexture(const void* pixels, } 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 @@ bool GrMockGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { } 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 ee38c006e1..6624eef7d2 100644 --- a/src/gpu/mtl/GrMtlGpu.mm +++ b/src/gpu/mtl/GrMtlGpu.mm @@ -518,7 +518,7 @@ GrBackendTexture GrMtlGpu::createTestingOnlyBackendTexture(const void* pixels, i } 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 @@ bool GrMtlGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { } 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 @@ GrBackendRenderTarget GrMtlGpu::createTestingOnlyBackendRenderTarget(int w, int } 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 371fd31f2d..d002955531 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1473,7 +1473,7 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(const void* srcData, i } 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 @@ bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { } 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 @@ GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h } 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 703792d1a2..419ee7731e 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -222,7 +222,7 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { 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 @@ void fullscreen_clear_with_layer_test(skiatest::Reporter* reporter, GrContext* c // 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 c4a7efd67f..f4ad618107 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -56,7 +56,7 @@ static GrBackendFormat create_backend_format(GrContext* context, const GrCaps* caps = context->contextPriv().caps(); switch (context->contextPriv().getBackend()) { - case kOpenGL_GrBackend: { + case GrBackendApi::kOpenGL: { const GrGLCaps* glCaps = static_cast(caps); GrGLStandard standard = glCaps->standard(); @@ -126,7 +126,7 @@ static GrBackendFormat create_backend_format(GrContext* context, } break; #ifdef SK_VULKAN - case kVulkan_GrBackend: + case GrBackendApi::kVulkan: switch (ct) { case kUnknown_SkColorType: return GrBackendFormat(); @@ -184,7 +184,7 @@ static GrBackendFormat create_backend_format(GrContext* context, } 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 f7e376831b..db000d51b4 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -174,7 +174,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, 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 7eed68f0a1..2a43458ee0 100644 --- a/tests/PromiseImageTest.cpp +++ b/tests/PromiseImageTest.cpp @@ -136,7 +136,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTest, reporter, ctxInfo) { 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 5e050a371c..8988ed5895 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -234,7 +234,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { // 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 43aea5afa3..508051d2c1 100644 --- a/tests/SurfaceSemaphoreTest.cpp +++ b/tests/SurfaceSemaphoreTest.cpp @@ -124,7 +124,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter, SkAutoTArray 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(mainCtx->contextPriv().getGpu()); const GrVkInterface* interface = gpu->vkInterface(); @@ -154,7 +154,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter, 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) 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(ctx->contextPriv().getGpu()); const GrGLInterface* interface = gpu->glInterface(); GrGLsync sync = semaphore.glSync(); @@ -240,7 +240,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) } #ifdef SK_VULKAN - if (kVulkan_GrBackend == ctxInfo.backend()) { + if (GrBackendApi::kVulkan == ctxInfo.backend()) { GrVkGpu* gpu = static_cast(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 d0ee2187d1..d932602d6c 100644 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -148,9 +148,9 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv } std::unique_ptr testCtx; - GrBackend backend = ContextTypeBackend(type); + GrBackendApi backend = ContextTypeBackend(type); switch (backend) { - case kOpenGL_GrBackend: { + case GrBackendApi::kOpenGL: { GLTestContext* glShareContext = masterContext ? static_cast(masterContext->fTestContext) : nullptr; GLTestContext* glCtx; @@ -202,7 +202,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv break; } #ifdef SK_VULKAN - case kVulkan_GrBackend: { + case GrBackendApi::kVulkan: { VkTestContext* vkSharedContext = masterContext ? static_cast(masterContext->fTestContext) : nullptr; SkASSERT(kVulkan_ContextType == type); @@ -227,7 +227,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv } #endif #ifdef SK_METAL - case kMetal_GrBackend: { + case GrBackendApi::kMetal: { SkASSERT(!masterContext); testCtx.reset(CreatePlatformMtlTestContext(nullptr)); if (!testCtx) { @@ -236,7 +236,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv 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 7134c5c959..e2e4fe96ee 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -70,16 +70,16 @@ public: } } - 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 @@ private: ContextType fType; ContextOverrides fOverrides; GrContextOptions fOptions; - GrBackend fBackend; + GrBackendApi fBackend; TestContext* fTestContext; GrContext* fGrContext; GrContext* fShareContext; @@ -169,14 +169,14 @@ public: 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(fTestContext); } diff --git a/tools/gpu/TestContext.h b/tools/gpu/TestContext.h index 8e939a6ace..7a92bc01f3 100644 --- a/tools/gpu/TestContext.h +++ b/tools/gpu/TestContext.h @@ -59,7 +59,7 @@ public: */ SkScopeExit SK_WARN_UNUSED_RESULT makeCurrentAndAutoRestore() const; - virtual GrBackend backend() = 0; + virtual GrBackendApi backend() = 0; virtual sk_sp makeGrContext(const GrContextOptions&); diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h index f5a05932a2..d376ed6690 100644 --- a/tools/gpu/gl/GLTestContext.h +++ b/tools/gpu/gl/GLTestContext.h @@ -20,7 +20,7 @@ class GLTestContext : public TestContext { 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 6075bc83c2..3bcf0f1c9d 100644 --- a/tools/gpu/mock/MockTestContext.cpp +++ b/tools/gpu/mock/MockTestContext.cpp @@ -19,7 +19,7 @@ public: 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 4aac2483e6..4c3a52fbca 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 cdc0f8f168..18be792861 100644 --- a/tools/gpu/mtl/MtlTestContext.mm +++ b/tools/gpu/mtl/MtlTestContext.mm @@ -120,7 +120,7 @@ public: ~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 f8f12cb44e..a1a1fe1c8a 100644 --- a/tools/gpu/vk/VkTestContext.h +++ b/tools/gpu/vk/VkTestContext.h @@ -20,7 +20,7 @@ class GrVkExtensions; 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;