Reland fully delineate GL usage w/ skia_use_gl.
Change-Id: I90f40467be145537cc08461fd3805606432f0cfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254240
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Rosasco <rosasco@google.com>
Auto-Submit: John Rosasco <rosasco@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 349ac1f..9ed9d9d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,7 +6,6 @@
import("gn/flutter_defines.gni")
import("gn/fuchsia_defines.gni")
import("gn/shared_sources.gni")
-
import("gn/skia.gni")
if (skia_use_dawn) {
@@ -500,11 +499,7 @@
if (skia_generate_workarounds) {
deps += [ ":workaround_list" ]
}
- if (!is_fuchsia) {
- public_defines = [ "SK_GL" ]
- } else {
- public_defines = []
- }
+ public_defines = []
public_configs = []
public_deps = []
@@ -519,9 +514,6 @@
sources += [ "src/gpu/GrPathRendering_none.cpp" ]
}
- # These paths need to be absolute to match the ones produced by shared_sources.gni.
- sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
- "abspath")
libs = []
if (is_android) {
sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
@@ -549,6 +541,10 @@
sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
}
+ if (skia_use_gl) {
+ public_defines += [ "SK_GL" ]
+ sources += skia_gl_gpu_sources
+ }
if (skia_use_vulkan) {
public_defines += [ "SK_VULKAN" ]
deps += [ "third_party/vulkanmemoryallocator" ]
@@ -557,7 +553,7 @@
public_defines += [ "SK_ENABLE_VK_LAYERS" ]
}
if (is_fuchsia) {
- if (using_fuchsia_sdk) {
+ if (skia_using_fuchsia_sdk) {
public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
} else {
public_deps += [ "//src/graphics/lib/vulkan" ]
@@ -1303,6 +1299,7 @@
"tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
"tools/gpu/mock/MockTestContext.cpp",
]
+
libs = []
if (is_android || skia_use_egl) {
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 04b5886..637e712 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -7,8 +7,6 @@
_src = get_path_info("../src", "abspath")
_include = get_path_info("../include", "abspath")
-skia_gl_gpu_sources = []
-
skia_gpu_sources = [
"$_include/gpu/GrBackendDrawableInfo.h",
"$_include/gpu/GrBackendSemaphore.h",
@@ -23,13 +21,6 @@
"$_include/gpu/GrTexture.h",
"$_include/gpu/GrTypes.h",
- "$_include/gpu/gl/GrGLAssembleInterface.h",
- "$_include/gpu/gl/GrGLConfig.h",
- "$_include/gpu/gl/GrGLExtensions.h",
- "$_include/gpu/gl/GrGLFunctions.h",
- "$_include/gpu/gl/GrGLInterface.h",
- "$_include/gpu/gl/GrGLTypes.h",
-
# Private includes
"$_include/private/GrContext_Base.h",
"$_include/private/GrGLTypesPriv.h",
@@ -132,10 +123,10 @@
"$_src/gpu/GrOpsTask.h",
"$_src/gpu/GrPaint.cpp",
"$_src/gpu/GrPaint.h",
- "$_src/gpu/GrPathRendererChain.cpp",
- "$_src/gpu/GrPathRendererChain.h",
"$_src/gpu/GrPathRenderer.cpp",
"$_src/gpu/GrPathRenderer.h",
+ "$_src/gpu/GrPathRendererChain.cpp",
+ "$_src/gpu/GrPathRendererChain.h",
"$_src/gpu/GrPipeline.cpp",
"$_src/gpu/GrPipeline.h",
"$_src/gpu/GrPrimitiveProcessor.cpp",
@@ -451,58 +442,6 @@
"$_src/gpu/text/GrTextBlobVertexRegenerator.cpp",
"$_src/gpu/text/GrTextTarget.h",
- "$_src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp",
- "$_src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp",
- "$_src/gpu/gl/GrGLAssembleHelpers.cpp",
- "$_src/gpu/gl/GrGLAssembleInterface.cpp",
- "$_src/gpu/gl/GrGLAssembleWebGLInterfaceAutogen.cpp",
- "$_src/gpu/gl/GrGLBuffer.cpp",
- "$_src/gpu/gl/GrGLBuffer.h",
- "$_src/gpu/gl/GrGLCaps.cpp",
- "$_src/gpu/gl/GrGLCaps.h",
- "$_src/gpu/gl/GrGLContext.cpp",
- "$_src/gpu/gl/GrGLContext.h",
- "$_src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
- "$_src/gpu/gl/GrGLDefines.h",
- "$_src/gpu/gl/GrGLGLSL.cpp",
- "$_src/gpu/gl/GrGLGLSL.h",
- "$_src/gpu/gl/GrGLGpu.cpp",
- "$_src/gpu/gl/GrGLGpu.h",
- "$_src/gpu/gl/GrGLGpuProgramCache.cpp",
- "$_src/gpu/gl/GrGLExtensions.cpp",
- "$_src/gpu/gl/GrGLInterfaceAutogen.cpp",
- "$_src/gpu/gl/GrGLOpsRenderPass.cpp",
- "$_src/gpu/gl/GrGLOpsRenderPass.h",
- "$_src/gpu/gl/GrGLProgram.cpp",
- "$_src/gpu/gl/GrGLProgram.h",
- "$_src/gpu/gl/GrGLProgramDataManager.cpp",
- "$_src/gpu/gl/GrGLProgramDataManager.h",
- "$_src/gpu/gl/GrGLRenderTarget.cpp",
- "$_src/gpu/gl/GrGLRenderTarget.h",
- "$_src/gpu/gl/GrGLSemaphore.cpp",
- "$_src/gpu/gl/GrGLSemaphore.h",
- "$_src/gpu/gl/GrGLStencilAttachment.cpp",
- "$_src/gpu/gl/GrGLStencilAttachment.h",
- "$_src/gpu/gl/GrGLTexture.cpp",
- "$_src/gpu/gl/GrGLTexture.h",
- "$_src/gpu/gl/GrGLTextureRenderTarget.cpp",
- "$_src/gpu/gl/GrGLTextureRenderTarget.h",
- "$_src/gpu/gl/GrGLTypesPriv.cpp",
- "$_src/gpu/gl/GrGLUtil.cpp",
- "$_src/gpu/gl/GrGLUtil.h",
- "$_src/gpu/gl/GrGLUniformHandler.cpp",
- "$_src/gpu/gl/GrGLUniformHandler.h",
- "$_src/gpu/gl/GrGLVaryingHandler.cpp",
- "$_src/gpu/gl/GrGLVaryingHandler.h",
- "$_src/gpu/gl/GrGLVertexArray.cpp",
- "$_src/gpu/gl/GrGLVertexArray.h",
-
- # Files for building GLSL shaders
- "$_src/gpu/gl/builders/GrGLProgramBuilder.cpp",
- "$_src/gpu/gl/builders/GrGLProgramBuilder.h",
- "$_src/gpu/gl/builders/GrGLShaderStringBuilder.cpp",
- "$_src/gpu/gl/builders/GrGLShaderStringBuilder.h",
-
# GLSL
"$_src/gpu/glsl/GrGLSL.cpp",
"$_src/gpu/glsl/GrGLSL.h",
@@ -561,6 +500,66 @@
"$_src/image/SkSurface_Gpu.cpp",
]
+skia_gl_gpu_sources = [
+ "$_include/gpu/gl/GrGLAssembleInterface.h",
+ "$_include/gpu/gl/GrGLConfig.h",
+ "$_include/gpu/gl/GrGLExtensions.h",
+ "$_include/gpu/gl/GrGLFunctions.h",
+ "$_include/gpu/gl/GrGLInterface.h",
+ "$_include/gpu/gl/GrGLTypes.h",
+
+ "$_src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp",
+ "$_src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp",
+ "$_src/gpu/gl/GrGLAssembleHelpers.cpp",
+ "$_src/gpu/gl/GrGLAssembleInterface.cpp",
+ "$_src/gpu/gl/GrGLAssembleWebGLInterfaceAutogen.cpp",
+ "$_src/gpu/gl/GrGLBuffer.cpp",
+ "$_src/gpu/gl/GrGLBuffer.h",
+ "$_src/gpu/gl/GrGLCaps.cpp",
+ "$_src/gpu/gl/GrGLCaps.h",
+ "$_src/gpu/gl/GrGLContext.cpp",
+ "$_src/gpu/gl/GrGLContext.h",
+ "$_src/gpu/gl/GrGLDefines.h",
+ "$_src/gpu/gl/GrGLGLSL.cpp",
+ "$_src/gpu/gl/GrGLGLSL.h",
+ "$_src/gpu/gl/GrGLGpu.cpp",
+ "$_src/gpu/gl/GrGLGpu.h",
+ "$_src/gpu/gl/GrGLGpuProgramCache.cpp",
+ "$_src/gpu/gl/GrGLExtensions.cpp",
+ "$_src/gpu/gl/GrGLInterfaceAutogen.cpp",
+ "$_src/gpu/gl/GrGLOpsRenderPass.cpp",
+ "$_src/gpu/gl/GrGLOpsRenderPass.h",
+ "$_src/gpu/gl/GrGLProgram.cpp",
+ "$_src/gpu/gl/GrGLProgram.h",
+ "$_src/gpu/gl/GrGLProgramDataManager.cpp",
+ "$_src/gpu/gl/GrGLProgramDataManager.h",
+ "$_src/gpu/gl/GrGLRenderTarget.cpp",
+ "$_src/gpu/gl/GrGLRenderTarget.h",
+ "$_src/gpu/gl/GrGLSemaphore.cpp",
+ "$_src/gpu/gl/GrGLSemaphore.h",
+ "$_src/gpu/gl/GrGLStencilAttachment.cpp",
+ "$_src/gpu/gl/GrGLStencilAttachment.h",
+ "$_src/gpu/gl/GrGLTexture.cpp",
+ "$_src/gpu/gl/GrGLTexture.h",
+ "$_src/gpu/gl/GrGLTextureRenderTarget.cpp",
+ "$_src/gpu/gl/GrGLTextureRenderTarget.h",
+ "$_src/gpu/gl/GrGLTypesPriv.cpp",
+ "$_src/gpu/gl/GrGLUtil.cpp",
+ "$_src/gpu/gl/GrGLUtil.h",
+ "$_src/gpu/gl/GrGLUniformHandler.cpp",
+ "$_src/gpu/gl/GrGLUniformHandler.h",
+ "$_src/gpu/gl/GrGLVaryingHandler.cpp",
+ "$_src/gpu/gl/GrGLVaryingHandler.h",
+ "$_src/gpu/gl/GrGLVertexArray.cpp",
+ "$_src/gpu/gl/GrGLVertexArray.h",
+
+ # Files for building GLSL shaders
+ "$_src/gpu/gl/builders/GrGLProgramBuilder.cpp",
+ "$_src/gpu/gl/builders/GrGLProgramBuilder.h",
+ "$_src/gpu/gl/builders/GrGLShaderStringBuilder.cpp",
+ "$_src/gpu/gl/builders/GrGLShaderStringBuilder.h",
+]
+
skia_ccpr_sources = [
# coverage counting path renderer
"$_src/gpu/ccpr/GrCCAtlas.cpp",
@@ -609,16 +608,16 @@
]
skia_nvpr_sources = [
+ "$_src/gpu/gl/GrGLPath.cpp",
+ "$_src/gpu/gl/GrGLPath.h",
+ "$_src/gpu/gl/GrGLPathRendering.cpp",
+ "$_src/gpu/gl/GrGLPathRendering.h",
"$_src/gpu/GrPath.cpp",
"$_src/gpu/GrPath.h",
"$_src/gpu/GrPathProcessor.cpp",
"$_src/gpu/GrPathProcessor.h",
"$_src/gpu/GrPathRendering.cpp",
"$_src/gpu/GrPathRendering.h",
- "$_src/gpu/gl/GrGLPath.cpp",
- "$_src/gpu/gl/GrGLPath.h",
- "$_src/gpu/gl/GrGLPathRendering.cpp",
- "$_src/gpu/gl/GrGLPathRendering.h",
"$_src/gpu/ops/GrDrawPathOp.cpp",
"$_src/gpu/ops/GrDrawPathOp.h",
"$_src/gpu/ops/GrStencilAndCoverPathRenderer.cpp",
@@ -630,7 +629,9 @@
skia_gpu_sources += skia_ccpr_sources
skia_gpu_sources += skia_nvpr_sources
-skia_null_gpu_sources = []
+skia_null_gpu_sources = [
+ "$_src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
+]
skia_vk_sources = [
"$_include/gpu/vk/GrVkBackendContext.h",
diff --git a/gn/skia.gni b/gn/skia.gni
index a87c3f7..3e0c07c 100644
--- a/gn/skia.gni
+++ b/gn/skia.gni
@@ -49,6 +49,7 @@
skia_use_freetype = is_android || is_fuchsia || is_linux
skia_use_gl = !is_fuchsia
skia_use_harfbuzz = true
+ skia_use_gl = !is_fuchsia
skia_use_icu = !is_fuchsia && !is_ios
skia_use_libheif = is_skia_dev_build
skia_use_libjpeg_turbo = true
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index e10b79e..1b1d1f2 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -62,6 +62,7 @@
}
}
+#ifdef SK_GL
GrBackendFormat::GrBackendFormat(GrGLenum format, GrGLenum target)
: fBackend(GrBackendApi::kOpenGL)
, fValid(true)
@@ -90,6 +91,7 @@
}
return GrGLFormat::kUnknown;
}
+#endif
GrBackendFormat GrBackendFormat::MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo) {
SkASSERT(ycbcrInfo.isValid());
@@ -202,24 +204,27 @@
}
switch (fBackend) {
+#ifdef SK_GL
case GrBackendApi::kOpenGL:
return fGLFormat == that.fGLFormat;
- case GrBackendApi::kVulkan:
+ break;
+#endif
#ifdef SK_VULKAN
+ case GrBackendApi::kVulkan:
return fVk.fFormat == that.fVk.fFormat &&
fVk.fYcbcrConversionInfo == that.fVk.fYcbcrConversionInfo;
-#endif
break;
+#endif
#ifdef SK_METAL
case GrBackendApi::kMetal:
return fMtlFormat == that.fMtlFormat;
-#endif
break;
- case GrBackendApi::kDawn:
+#endif
#ifdef SK_DAWN
+ case GrBackendApi::kDawn:
return fDawnFormat == that.fDawnFormat;
-#endif
break;
+#endif
case GrBackendApi::kMock:
return fMockColorType == that.fMockColorType;
default:
@@ -347,6 +352,7 @@
, fMtlInfo(mtlInfo) {}
#endif
+#ifdef SK_GL
GrBackendTexture::GrBackendTexture(int width,
int height,
GrMipMapped mipMapped,
@@ -355,6 +361,7 @@
// Make no assumptions about client's texture's parameters.
this->glTextureParametersModified();
}
+#endif
GrBackendTexture::GrBackendTexture(int width,
int height,
@@ -691,6 +698,7 @@
, fMtlInfo(mtlInfo) {}
#endif
+#ifdef SK_GL
GrBackendRenderTarget::GrBackendRenderTarget(int width,
int height,
int sampleCnt,
@@ -704,6 +712,7 @@
, fGLInfo(glInfo) {
fIsValid = SkToBool(glInfo.fFormat); // the glInfo must have a valid format
}
+#endif
GrBackendRenderTarget::GrBackendRenderTarget(int width,
int height,
@@ -749,14 +758,16 @@
fBackend = that.fBackend;
switch (that.fBackend) {
+#ifdef SK_GL
case GrBackendApi::kOpenGL:
fGLInfo = that.fGLInfo;
break;
- case GrBackendApi::kVulkan:
-#ifdef SK_VULKAN
- fVkInfo.assign(that.fVkInfo, this->isValid());
#endif
+#ifdef SK_VULKAN
+ case GrBackendApi::kVulkan:
+ fVkInfo.assign(that.fVkInfo, this->isValid());
break;
+#endif
#ifdef SK_DAWN
case GrBackendApi::kDawn:
fDawnInfo = that.fDawnInfo;
@@ -824,6 +835,7 @@
}
#endif
+#ifdef SK_GL
bool GrBackendRenderTarget::getGLFramebufferInfo(GrGLFramebufferInfo* outInfo) const {
if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
*outInfo = fGLInfo;
@@ -831,6 +843,7 @@
}
return false;
}
+#endif
GrBackendFormat GrBackendRenderTarget::getBackendFormat() const {
if (!this->isValid()) {
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index afba0b9..1353001 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -122,6 +122,7 @@
typedef GrContext INHERITED;
};
+#ifdef SK_GL
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface) {
GrContextOptions defaultOptions;
return MakeGL(std::move(interface), defaultOptions);
@@ -150,6 +151,7 @@
}
return context;
}
+#endif
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
GrContextOptions defaultOptions;
@@ -222,12 +224,12 @@
#endif
#ifdef SK_DAWN
-sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device) {
+sk_sp<GrContext> GrContext::MakeDawn(const dawn::Device& device) {
GrContextOptions defaultOptions;
return MakeDawn(device, defaultOptions);
}
-sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContextOptions& options) {
+sk_sp<GrContext> GrContext::MakeDawn(const dawn::Device& device, const GrContextOptions& options) {
sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kDawn, options));
context->fGpu = GrDawnGpu::Make(device, options, context.get());
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index e816ba6..ec7048d 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -998,6 +998,7 @@
}
}
+#ifdef SK_GL
////////////////////////////////////////////////////////////////////////////////
// Check that the texture-specific flags (i.e., for external & rectangle textures) work
// for promise images. As such, this is a GL-only test.
@@ -1043,6 +1044,7 @@
}
}
}
+#endif // SK_GL
////////////////////////////////////////////////////////////////////////////////
// Test colorType and pixelConfig compatibility.
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 7f4c6f8..80497c0 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -21,6 +21,8 @@
#include "tools/gpu/GrContextFactory.h"
#include "tools/gpu/gl/GLTestContext.h"
+#ifdef SK_GL
+
using sk_gpu_test::GLTestContext;
static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx1,
@@ -197,3 +199,5 @@
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);
}
+
+#endif // SK_GL
diff --git a/tests/GrGLExtensionsTest.cpp b/tests/GrGLExtensionsTest.cpp
index 480e624..4c95706 100644
--- a/tests/GrGLExtensionsTest.cpp
+++ b/tests/GrGLExtensionsTest.cpp
@@ -11,6 +11,8 @@
#include "src/gpu/gl/GrGLDefines.h"
#include "tests/Test.h"
+#ifdef SK_GL
+
const GrGLubyte* simpleGetString(GrGLenum name) {
return (const GrGLubyte*)(name == GR_GL_VERSION ? "3.0" : "");
}
@@ -46,3 +48,5 @@
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
}
+
+#endif // SK_GL
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 28eb8d6..5a83ccd 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -20,8 +20,10 @@
#include "src/gpu/GrSurfaceProxyPriv.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
+#ifdef SK_GL
#include "src/gpu/gl/GrGLDefines.h"
#include "src/gpu/gl/GrGLUtil.h"
+#endif
// Check that the surface proxy's member vars are set as expected
static void check_surface(skiatest::Reporter* reporter,
@@ -258,6 +260,7 @@
continue;
}
+#ifdef SK_GL
// 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 (GrBackendApi::kOpenGL == ctxInfo.backend()) {
@@ -278,6 +281,7 @@
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact, 0);
}
+#endif
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index f1f9102..886cff3 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -17,10 +17,14 @@
#include "src/gpu/GrSurfacePriv.h"
#include "src/gpu/GrTexturePriv.h"
#include "src/gpu/SkGr.h"
+#ifdef SK_GL
#include "src/gpu/gl/GrGLGpu.h"
#include "src/gpu/gl/GrGLUtil.h"
+#endif
#include "tools/gpu/ProxyUtils.h"
+#ifdef SK_GL
#include "tools/gpu/gl/GLTestContext.h"
+#endif
// skbug.com/5932
static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context,
@@ -117,6 +121,7 @@
}
}
+#ifdef SK_GL
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
@@ -201,3 +206,4 @@
GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
}
}
+#endif
diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp
index 6d6a1fe..5e7fc05 100644
--- a/tests/SurfaceSemaphoreTest.cpp
+++ b/tests/SurfaceSemaphoreTest.cpp
@@ -16,8 +16,10 @@
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrBackendSurface.h"
+#ifdef SK_GL
#include "src/gpu/gl/GrGLGpu.h"
#include "src/gpu/gl/GrGLUtil.h"
+#endif
#ifdef SK_VULKAN
#include "include/gpu/vk/GrVkTypes.h"
@@ -182,6 +184,7 @@
draw_child(reporter, childInfo2, backendTexture, semaphores[1]);
}
+#ifdef SK_GL
DEF_GPUTEST(SurfaceSemaphores, reporter, options) {
#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
static constexpr auto kNativeGLType = sk_gpu_test::GrContextFactory::kGL_ContextType;
@@ -222,6 +225,7 @@
}
}
}
+#endif
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) {
GrContext* ctx = ctxInfo.grContext();
@@ -243,6 +247,7 @@
GrSemaphoresSubmitted submitted = mainSurface->flushAndSignalSemaphores(1, &semaphore);
REPORTER_ASSERT(reporter, GrSemaphoresSubmitted::kYes == submitted);
+#ifdef SK_GL
if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLGpu* gpu = static_cast<GrGLGpu*>(ctx->priv().getGpu());
const GrGLInterface* interface = gpu->glInterface();
@@ -252,6 +257,7 @@
GR_GL_CALL_RET(interface, result, IsSync(sync));
REPORTER_ASSERT(reporter, result);
}
+#endif
#ifdef SK_VULKAN
if (GrBackendApi::kVulkan == ctxInfo.backend()) {
diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp
index 04602ff..1703a34 100644
--- a/tests/TextureBindingsResetTest.cpp
+++ b/tests/TextureBindingsResetTest.cpp
@@ -12,6 +12,8 @@
#include "src/gpu/gl/GrGLUtil.h"
#include "tests/Test.h"
+#ifdef SK_GL
+
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInfo) {
#define GL(F) GR_GL_CALL(ctxInfo.glContext()->gl(), F)
@@ -164,3 +166,5 @@
#undef GL
}
+
+#endif // SK_GL
diff --git a/tests/TraceMemoryDumpTest.cpp b/tests/TraceMemoryDumpTest.cpp
index 16096a2..42e2c47 100644
--- a/tests/TraceMemoryDumpTest.cpp
+++ b/tests/TraceMemoryDumpTest.cpp
@@ -12,9 +12,11 @@
#include "include/gpu/GrTexture.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTarget.h"
+#ifdef SK_GL
#include "src/gpu/gl/GrGLBuffer.h"
#include "src/gpu/gl/GrGLDefines.h"
#include "src/gpu/gl/GrGLGpu.h"
+#endif
/*
* Build test for SkTraceMemoryDump.
@@ -71,6 +73,7 @@
}
}
+#ifdef SK_GL
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_ownedGLBuffer, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
@@ -157,3 +160,4 @@
ValidateMemoryDumps(reporter, context, rt->gpuMemorySize(), false /* isOwned */);
}
+#endif // SK_GL
diff --git a/tests/VkHardwareBufferTest.cpp b/tests/VkHardwareBufferTest.cpp
index 07563cb..cfe453b 100644
--- a/tests/VkHardwareBufferTest.cpp
+++ b/tests/VkHardwareBufferTest.cpp
@@ -70,6 +70,7 @@
int fFdHandle = 0;
};
+#ifdef SK_GL
class EGLTestHelper : public BaseTestHelper {
public:
EGLTestHelper(const GrContextOptions& options) : fFactory(options) {}
@@ -362,6 +363,7 @@
fenceSync->waitFence(fence);
fenceSync->deleteFence(fence);
}
+#endif // SK_GL
#define DECLARE_VK_PROC(name) PFN_vk##name fVk##name
@@ -1078,7 +1080,11 @@
if (SrcType::kVulkan == srcType) {
srcHelper.reset(new VulkanTestHelper());
} else if (SrcType::kEGL == srcType) {
+#ifdef SK_GL
srcHelper.reset(new EGLTestHelper(options));
+#else
+ SkASSERT(false, "SrcType::kEGL used without OpenGL support.");
+#endif
}
if (srcHelper) {
if (!srcHelper->init(reporter)) {
@@ -1090,8 +1096,12 @@
if (DstType::kVulkan == dstType) {
dstHelper.reset(new VulkanTestHelper());
} else {
+#ifdef SK_GL
SkASSERT(DstType::kEGL == dstType);
dstHelper.reset(new EGLTestHelper(options));
+#else
+ SkASSERT(false, "DstType::kEGL used without OpenGL support.");
+#endif
}
if (dstHelper) {
if (!dstHelper->init(reporter)) {
@@ -1275,14 +1285,19 @@
run_test(reporter, options, SrcType::kCPU, DstType::kVulkan, false);
}
-DEF_GPUTEST(VulkanHardwareBuffer_EGL_Vulkan, reporter, options) {
- run_test(reporter, options, SrcType::kEGL, DstType::kVulkan, false);
-}
-
DEF_GPUTEST(VulkanHardwareBuffer_Vulkan_Vulkan, reporter, options) {
run_test(reporter, options, SrcType::kVulkan, DstType::kVulkan, false);
}
+DEF_GPUTEST(VulkanHardwareBuffer_Vulkan_Vulkan_Syncs, reporter, options) {
+ run_test(reporter, options, SrcType::kVulkan, DstType::kVulkan, true);
+}
+
+#if defined(SK_GL)
+DEF_GPUTEST(VulkanHardwareBuffer_EGL_Vulkan, reporter, options) {
+ run_test(reporter, options, SrcType::kEGL, DstType::kVulkan, false);
+}
+
DEF_GPUTEST(VulkanHardwareBuffer_CPU_EGL, reporter, options) {
run_test(reporter, options, SrcType::kCPU, DstType::kEGL, false);
}
@@ -1306,10 +1321,8 @@
DEF_GPUTEST(VulkanHardwareBuffer_EGL_Vulkan_Syncs, reporter, options) {
run_test(reporter, options, SrcType::kEGL, DstType::kVulkan, true);
}
-
-DEF_GPUTEST(VulkanHardwareBuffer_Vulkan_Vulkan_Syncs, reporter, options) {
- run_test(reporter, options, SrcType::kVulkan, DstType::kVulkan, true);
-}
-
#endif
+#endif // SK_SUPPORT_GPU && defined(SK_BUILD_FOR_ANDROID) &&
+ // __ANDROID_API__ >= 26 && defined(SK_VULKAN)
+
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index d0defdc..be33802 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -8,7 +8,9 @@
#include "src/gpu/GrContextPriv.h"
#include "tools/gpu/GrContextFactory.h"
+#ifdef SK_GL
#include "tools/gpu/gl/GLTestContext.h"
+#endif
#if SK_ANGLE
#include "tools/gpu/gl/angle/GLTestContext_angle.h"
@@ -152,6 +154,7 @@
std::unique_ptr<TestContext> testCtx;
GrBackendApi backend = ContextTypeBackend(type);
switch (backend) {
+#ifdef SK_GL
case GrBackendApi::kOpenGL: {
GLTestContext* glShareContext = masterContext
? static_cast<GLTestContext*>(masterContext->fTestContext) : nullptr;
@@ -199,6 +202,7 @@
testCtx.reset(glCtx);
break;
}
+#endif // SK_GL
#ifdef SK_VULKAN
case GrBackendApi::kVulkan: {
VkTestContext* vkSharedContext = masterContext
@@ -209,6 +213,7 @@
return ContextInfo();
}
+#ifdef SK_GL
// There is some bug (either in Skia or the NV Vulkan driver) where VkDevice
// destruction will hang occaisonally. For some reason having an existing GL
// context fixes this.
@@ -218,6 +223,7 @@
fSentinelGLContext.reset(CreatePlatformGLTestContext(kGLES_GrGLStandard));
}
}
+#endif
break;
}
#endif
diff --git a/tools/skqp/src/skqp.cpp b/tools/skqp/src/skqp.cpp
index 04f0369..ac08a5e 100644
--- a/tools/skqp/src/skqp.cpp
+++ b/tools/skqp/src/skqp.cpp
@@ -22,8 +22,12 @@
#include "src/utils/SkOSPath.h"
#include "tests/Test.h"
#include "tools/fonts/TestFontMgr.h"
+#ifdef SK_GL
#include "tools/gpu/gl/GLTestContext.h"
+#endif
+#ifdef SK_VULKAN
#include "tools/gpu/vk/VkTestContext.h"
+#endif
#include <limits.h>
#include <algorithm>