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>
This commit is contained in:
parent
9acf68267a
commit
a9b348f66c
17
BUILD.gn
17
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 @@ optional("gpu") {
|
||||
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 @@ optional("gpu") {
|
||||
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 @@ optional("gpu") {
|
||||
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 @@ optional("gpu") {
|
||||
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 @@ if (skia_enable_tools) {
|
||||
"tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
|
||||
"tools/gpu/mock/MockTestContext.cpp",
|
||||
]
|
||||
|
||||
libs = []
|
||||
|
||||
if (is_android || skia_use_egl) {
|
||||
|
137
gn/gpu.gni
137
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 @@ skia_gpu_sources = [
|
||||
"$_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 @@ skia_gpu_sources = [
|
||||
"$_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 @@ skia_gpu_sources = [
|
||||
"$_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 @@ skia_gpu_sources = [
|
||||
"$_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_ccpr_sources = [
|
||||
]
|
||||
|
||||
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_nvpr_sources = [
|
||||
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",
|
||||
|
@ -49,6 +49,7 @@ declare_args() {
|
||||
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
|
||||
|
@ -62,6 +62,7 @@ GrBackendFormat::GrBackendFormat(const GrBackendFormat& that)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_GL
|
||||
GrBackendFormat::GrBackendFormat(GrGLenum format, GrGLenum target)
|
||||
: fBackend(GrBackendApi::kOpenGL)
|
||||
, fValid(true)
|
||||
@ -90,6 +91,7 @@ GrGLFormat GrBackendFormat::asGLFormat() const {
|
||||
}
|
||||
return GrGLFormat::kUnknown;
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendFormat GrBackendFormat::MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo) {
|
||||
SkASSERT(ycbcrInfo.isValid());
|
||||
@ -202,24 +204,27 @@ bool GrBackendFormat::operator==(const GrBackendFormat& that) const {
|
||||
}
|
||||
|
||||
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 @@ GrBackendTexture::GrBackendTexture(int width,
|
||||
, fMtlInfo(mtlInfo) {}
|
||||
#endif
|
||||
|
||||
#ifdef SK_GL
|
||||
GrBackendTexture::GrBackendTexture(int width,
|
||||
int height,
|
||||
GrMipMapped mipMapped,
|
||||
@ -355,6 +361,7 @@ GrBackendTexture::GrBackendTexture(int width,
|
||||
// Make no assumptions about client's texture's parameters.
|
||||
this->glTextureParametersModified();
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendTexture::GrBackendTexture(int width,
|
||||
int height,
|
||||
@ -691,6 +698,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width,
|
||||
, fMtlInfo(mtlInfo) {}
|
||||
#endif
|
||||
|
||||
#ifdef SK_GL
|
||||
GrBackendRenderTarget::GrBackendRenderTarget(int width,
|
||||
int height,
|
||||
int sampleCnt,
|
||||
@ -704,6 +712,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width,
|
||||
, fGLInfo(glInfo) {
|
||||
fIsValid = SkToBool(glInfo.fFormat); // the glInfo must have a valid format
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendRenderTarget::GrBackendRenderTarget(int width,
|
||||
int height,
|
||||
@ -749,14 +758,16 @@ GrBackendRenderTarget& GrBackendRenderTarget::operator=(const GrBackendRenderTar
|
||||
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 @@ bool GrBackendRenderTarget::getMtlTextureInfo(GrMtlTextureInfo* outInfo) const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_GL
|
||||
bool GrBackendRenderTarget::getGLFramebufferInfo(GrGLFramebufferInfo* outInfo) const {
|
||||
if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
|
||||
*outInfo = fGLInfo;
|
||||
@ -831,6 +843,7 @@ bool GrBackendRenderTarget::getGLFramebufferInfo(GrGLFramebufferInfo* outInfo) c
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendFormat GrBackendRenderTarget::getBackendFormat() const {
|
||||
if (!this->isValid()) {
|
||||
|
@ -122,6 +122,7 @@ private:
|
||||
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 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
|
||||
}
|
||||
return context;
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
|
||||
GrContextOptions defaultOptions;
|
||||
@ -222,12 +224,12 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContext
|
||||
#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());
|
||||
|
@ -998,6 +998,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMultipleDDLs, reporter, ctxInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
#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 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // SK_GL
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Test colorType and pixelConfig compatibility.
|
||||
|
@ -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 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
|
||||
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);
|
||||
}
|
||||
|
||||
#endif // SK_GL
|
||||
|
@ -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 @@ DEF_TEST(GrGLExtensionsTest_remove, reporter) {
|
||||
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
|
||||
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
|
||||
}
|
||||
|
||||
#endif // SK_GL
|
||||
|
@ -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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
sProxy->asRenderTargetProxy(),
|
||||
supportedNumSamples, SkBackingFit::kExact, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Tests wrapBackendRenderTarget with a GrBackendTexture
|
||||
{
|
||||
|
@ -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 @@ static void test_copy_to_surface(skiatest::Reporter* reporter,
|
||||
}
|
||||
}
|
||||
|
||||
#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 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
|
||||
GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -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 @@ void surface_semaphore_test(skiatest::Reporter* reporter,
|
||||
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 @@ DEF_GPUTEST(SurfaceSemaphores, reporter, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) {
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
@ -243,6 +247,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo)
|
||||
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo)
|
||||
GR_GL_CALL_RET(interface, result, IsSync(sync));
|
||||
REPORTER_ASSERT(reporter, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
if (GrBackendApi::kVulkan == ctxInfo.backend()) {
|
||||
|
@ -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 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf
|
||||
|
||||
#undef GL
|
||||
}
|
||||
|
||||
#endif // SK_GL
|
||||
|
@ -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 @@ void ValidateMemoryDumps(skiatest::Reporter* reporter, GrContext* context, size_
|
||||
}
|
||||
}
|
||||
|
||||
#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 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_unownedGLRenderTarget, r
|
||||
|
||||
ValidateMemoryDumps(reporter, context, rt->gpuMemorySize(), false /* isOwned */);
|
||||
}
|
||||
#endif // SK_GL
|
||||
|
@ -70,6 +70,7 @@ protected:
|
||||
int fFdHandle = 0;
|
||||
};
|
||||
|
||||
#ifdef SK_GL
|
||||
class EGLTestHelper : public BaseTestHelper {
|
||||
public:
|
||||
EGLTestHelper(const GrContextOptions& options) : fFactory(options) {}
|
||||
@ -362,6 +363,7 @@ void EGLTestHelper::doClientSync() {
|
||||
fenceSync->waitFence(fence);
|
||||
fenceSync->deleteFence(fence);
|
||||
}
|
||||
#endif // SK_GL
|
||||
|
||||
#define DECLARE_VK_PROC(name) PFN_vk##name fVk##name
|
||||
|
||||
@ -1078,7 +1080,11 @@ void run_test(skiatest::Reporter* reporter, const GrContextOptions& options,
|
||||
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 @@ void run_test(skiatest::Reporter* reporter, const GrContextOptions& options,
|
||||
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 @@ DEF_GPUTEST(VulkanHardwareBuffer_CPU_Vulkan, reporter, options) {
|
||||
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_Vulkan_EGL_Syncs, reporter, options) {
|
||||
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)
|
||||
|
||||
|
@ -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 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
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 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
testCtx.reset(glCtx);
|
||||
break;
|
||||
}
|
||||
#endif // SK_GL
|
||||
#ifdef SK_VULKAN
|
||||
case GrBackendApi::kVulkan: {
|
||||
VkTestContext* vkSharedContext = masterContext
|
||||
@ -209,6 +213,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
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 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
fSentinelGLContext.reset(CreatePlatformGLTestContext(kGLES_GrGLStandard));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user