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>
This commit is contained in:
parent
0a0304c426
commit
bdf12ad8d5
@ -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<GrGLGpu*>(this->contextInfo.grContext()->contextPriv().getGpu())
|
||||
->glInterface();
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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; //<! height in pixels
|
||||
GrPixelConfig fConfig;
|
||||
GrMipMapped fMipMapped;
|
||||
GrBackend fBackend;
|
||||
GrBackendApi fBackend;
|
||||
|
||||
union {
|
||||
GrGLTextureInfo fGLInfo;
|
||||
@ -278,7 +278,7 @@ public:
|
||||
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 @@ private:
|
||||
int fStencilBits;
|
||||
GrPixelConfig fConfig;
|
||||
|
||||
GrBackend fBackend;
|
||||
GrBackendApi fBackend;
|
||||
|
||||
union {
|
||||
GrGLFramebufferInfo fGLInfo;
|
||||
|
@ -284,14 +284,14 @@ public:
|
||||
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 @@ private:
|
||||
// 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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
@ -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<GrGLGpu*>(state->gpu())
|
||||
: nullptr;
|
||||
if (glGpu) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<GrVkGpu*>(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<GrTextureProxy> 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
|
||||
|
@ -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<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 @@ sk_sp<GrVkImageLayout> 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<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 @@ sk_sp<GrVkImageLayout> 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
|
||||
|
@ -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<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 @@ 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);
|
||||
|
@ -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(); }
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
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:
|
||||
|
@ -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<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) {
|
||||
|
||||
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 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
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) {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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<const GrGLCaps*>(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();
|
||||
|
@ -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) &&
|
||||
|
@ -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++;
|
||||
|
@ -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;
|
||||
|
@ -124,7 +124,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter,
|
||||
|
||||
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 @@ 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<GrGLGpu*>(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<GrVkGpu*>(ctx->contextPriv().getGpu());
|
||||
const GrVkInterface* interface = gpu->vkInterface();
|
||||
VkDevice device = gpu->device();
|
||||
|
@ -148,9 +148,9 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
}
|
||||
|
||||
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 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
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 @@ 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) {
|
||||
|
@ -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<GLTestContext*>(fTestContext);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
*/
|
||||
SkScopeExit SK_WARN_UNUSED_RESULT makeCurrentAndAutoRestore() const;
|
||||
|
||||
virtual GrBackend backend() = 0;
|
||||
virtual GrBackendApi backend() = 0;
|
||||
|
||||
virtual sk_sp<GrContext> makeGrContext(const GrContextOptions&);
|
||||
|
||||
|
@ -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()); }
|
||||
|
||||
|
@ -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 {}
|
||||
|
@ -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);
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
|
||||
~MtlTestContext() override { this->teardown(); }
|
||||
|
||||
GrBackend backend() override { return kMetal_GrBackend; }
|
||||
GrBackendApi backend() override { return GrBackendApi::kMetal; }
|
||||
|
||||
void testAbandon() override {}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user