[bazel] Support Vulkan

PS1 regenerates BUILD.bazel files

I suggest reviewing the deltas between PS1 and the latest
PS to focus on the interesting bits.

The changes here allow for a Vulkan-only build of HelloWorld
based on sk_app. The toughest change was properly fetching
the VisualID after removing the gl calls that used to
fill that in.

There are a few changes that fix resolution of Dawn
header files, but those won't actually be built until
a follow-on CL.

Change-Id: I54fb58b5dd7ecd4313562aed401759b3eaed53c0
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2022-03-08 15:27:12 -05:00 committed by SkCQ
parent 6e9b0ab507
commit 7ac7413f08
36 changed files with 369 additions and 114 deletions

View File

@ -1,6 +1,9 @@
load("//bazel:macros.bzl", "select_multi")
GENERAL_DEFINES = ["SK_HAS_ANDROID_CODEC"] + select({
GENERAL_DEFINES = [
"SK_HAS_ANDROID_CODEC",
"SKIA_IMPLEMENTATION=1",
] + select({
"//bazel/common_config_settings:debug_build": [
"SK_DEBUG",
],
@ -32,6 +35,7 @@ GPU_DEFINES = select({
"//bazel/common_config_settings:vulkan_backend": [
"SK_VULKAN",
"SK_SUPPORT_GPU=1",
"SK_USE_VMA", # TODO(kjlubick) This will need to be configurable
],
"//conditions:default": [
"SK_SUPPORT_GPU=0",

View File

@ -22,4 +22,4 @@ known_good_builds:
bazelisk build //:skia_core --config=clang --sandbox_base=/dev/shm
bazelisk build //src/sksl/lex:sksllex --config=clang --sandbox_base=/dev/shm
bazelisk build //tools/skdiff --config=clang --sandbox_base=/dev/shm
bazelisk build //example:hello_world --config=clang --sandbox_base=/dev/shm
bazelisk build //example:hello_world_gl --config=clang --sandbox_base=/dev/shm

View File

@ -2,7 +2,7 @@ load("//bazel:macros.bzl", "generated_cc_atom")
load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
cc_binary_with_flags(
name = "hello_world",
name = "hello_world_gl",
srcs = [
"//example:HelloWorld_src",
],
@ -35,6 +35,37 @@ cc_binary_with_flags(
],
)
cc_binary_with_flags(
name = "hello_world_vulkan",
srcs = [
"//example:HelloWorld_src",
],
linkopts = [
"-lX11",
"-lxcb",
"-lXau",
"-lXdmcp",
"-lX11-xcb",
],
# These flags are defined in //bazel/common_config_settings/BUILD.bazel
set_flags = {
"gpu_backend": [
"vulkan_backend",
],
# Load fonts from the standard system directory (e.g. "/usr/share/fonts/")
# as defined in //src/ports/SkFontMgr_custom_directory_factory.cpp
"fontmgr_factory": [
"custom_directory_fontmgr_factory",
],
},
deps = [
"//:skia_core",
"//src/utils:json_srcs",
"//third_party:vulkanmemoryallocator",
"//tools/sk_app",
],
)
# Everything below this line is autogenerated by gazelle using the C++ plugin built here:
# https://github.com/google/skia-buildbot/tree/main/bazel/gazelle/cpp
# These can be regenerated (if needed) by navigating to //bazel and running `make generate`

View File

@ -20,8 +20,14 @@ Application* Application::Create(int argc, char** argv, void* platformData) {
}
HelloWorld::HelloWorld(int argc, char** argv, void* platformData)
: fBackendType(Window::kNativeGL_BackendType)
, fRotationAngle(0) {
#if defined(SK_GL)
: fBackendType(Window::kNativeGL_BackendType),
#elif defined(SK_VULKAN)
: fBackendType(Window::kVulkan_BackendType),
#else
: fBackendType(Window::kRaster_BackendType),
#endif
fRotationAngle(0) {
SkGraphics::Init();
fWindow = Window::CreateNativeWindow(platformData);
@ -39,12 +45,23 @@ HelloWorld::~HelloWorld() {
}
void HelloWorld::updateTitle() {
if (!fWindow || fWindow->sampleCount() <= 1) {
if (!fWindow) {
return;
}
SkString title("Hello World ");
title.append(Window::kRaster_BackendType == fBackendType ? "Raster" : "OpenGL");
if (Window::kRaster_BackendType == fBackendType) {
title.append("Raster");
} else {
#if defined(SK_GL)
title.append("GL");
#elif defined(SK_VULKAN)
title.append("Vulkan");
#else
title.append("Unknown GPU backend");
#endif
}
fWindow->setTitle(title.c_str());
}
@ -111,8 +128,18 @@ void HelloWorld::onIdle() {
bool HelloWorld::onChar(SkUnichar c, skui::ModifierKey modifiers) {
if (' ' == c) {
fBackendType = Window::kRaster_BackendType == fBackendType ? Window::kNativeGL_BackendType
: Window::kRaster_BackendType;
if (Window::kRaster_BackendType == fBackendType) {
#if defined(SK_GL)
fBackendType = Window::kNativeGL_BackendType;
#elif defined(SK_VULKAN)
fBackendType = Window::kVulkan_BackendType;
#else
SkDebugf("No GPU backend configured\n");
return true;
#endif
} else {
fBackendType = Window::kRaster_BackendType;
}
fWindow->detach();
fWindow->attach(fBackendType);
}

View File

@ -30,10 +30,7 @@ generated_cc_atom(
name = "GraphiteTypes_hdr",
hdrs = ["GraphiteTypes.h"],
visibility = ["//:__subpackages__"],
deps = [
"//include/core:SkTypes_hdr",
"//include/private:SkVx_hdr",
],
deps = ["//include/core:SkTypes_hdr"],
)
generated_cc_atom(

View File

@ -357,11 +357,11 @@ generated_cc_atom(
":GlobalCache_hdr",
":GraphicsPipelineDesc_hdr",
":GraphicsPipeline_hdr",
":PipelineDataCache_hdr",
":RecorderPriv_hdr",
":Renderer_hdr",
":ResourceProvider_hdr",
":TextureProxy_hdr",
":UniformCache_hdr",
":UniformManager_hdr",
"//experimental/graphite/include:GraphiteTypes_hdr",
"//experimental/graphite/include:Recorder_hdr",
@ -495,8 +495,10 @@ generated_cc_atom(
srcs = ["Image_Graphite.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":Caps_hdr",
":Image_Graphite_hdr",
"//src/gpu:GrFragmentProcessor_hdr",
":RecorderPriv_hdr",
"//experimental/graphite/include:Recorder_hdr",
],
)
@ -519,9 +521,9 @@ generated_cc_atom(
":DrawBufferManager_hdr",
":GlobalCache_hdr",
":Gpu_hdr",
":PipelineDataCache_hdr",
":ResourceProvider_hdr",
":TaskGraph_hdr",
":UniformCache_hdr",
"//experimental/graphite/include:Recorder_hdr",
"//experimental/graphite/include:Recording_hdr",
"//src/core:SkUniformData_hdr",
@ -741,24 +743,6 @@ generated_cc_atom(
deps = [":Texture_hdr"],
)
generated_cc_atom(
name = "UniformCache_hdr",
hdrs = ["UniformCache.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/core:SkRefCnt_hdr"],
)
generated_cc_atom(
name = "UniformCache_src",
srcs = ["UniformCache.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":UniformCache_hdr",
"//src/core:SkOpts_hdr",
"//src/core:SkUniformData_hdr",
],
)
generated_cc_atom(
name = "UniformManager_hdr",
hdrs = ["UniformManager.h"],
@ -924,6 +908,7 @@ generated_cc_atom(
":ResourceCache_hdr",
":Resource_hdr",
"//include/private:SingleOwner_hdr",
"//include/utils:SkRandom_hdr",
"//src/core:SkTMultiMap_hdr",
],
)
@ -970,3 +955,21 @@ generated_cc_atom(
"//src/gpu:Swizzle_hdr",
],
)
generated_cc_atom(
name = "PipelineDataCache_hdr",
hdrs = ["PipelineDataCache.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/core:SkRefCnt_hdr"],
)
generated_cc_atom(
name = "PipelineDataCache_src",
srcs = ["PipelineDataCache.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":PipelineDataCache_hdr",
"//src/core:SkOpts_hdr",
"//src/core:SkUniformData_hdr",
],
)

View File

@ -89,5 +89,8 @@ generated_cc_atom(
name = "VectorTypes_hdr",
hdrs = ["VectorTypes.h"],
visibility = ["//:__subpackages__"],
deps = ["//experimental/graphite/include:GraphiteTypes_hdr"],
deps = [
"//experimental/graphite/include:GraphiteTypes_hdr",
"//include/private:SkVx_hdr",
],
)

View File

@ -2414,6 +2414,7 @@ generated_cc_atom(
"//include/core:SkFont_hdr",
"//include/core:SkPaint_hdr",
"//include/core:SkPathBuilder_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRect_hdr",
"//include/core:SkScalar_hdr",
"//include/core:SkSize_hdr",
@ -2663,6 +2664,7 @@ generated_cc_atom(
"//include/core:SkMatrix_hdr",
"//include/core:SkPaint_hdr",
"//include/core:SkPathBuilder_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRect_hdr",
"//include/core:SkScalar_hdr",
"//include/core:SkSize_hdr",
@ -6729,6 +6731,7 @@ generated_cc_atom(
"//include/core:SkColor_hdr",
"//include/core:SkPaint_hdr",
"//include/core:SkPathBuilder_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRect_hdr",
"//include/core:SkScalar_hdr",
"//include/core:SkSize_hdr",

View File

@ -412,6 +412,7 @@ generated_cc_atom(
":SkScalar_hdr",
":SkShader_hdr",
":SkTileMode_hdr",
"//experimental/graphite/include:GraphiteTypes_hdr",
"//include/gpu:GrTypes_hdr",
],
)

View File

@ -49,6 +49,7 @@ generated_cc_atom(
"//include/private:GrD3DTypesMinimal_hdr",
"//include/private:GrGLTypesPriv_hdr",
"//include/private:GrVkTypesPriv_hdr",
"//third_party:dawn",
],
)

View File

@ -4,5 +4,8 @@ generated_cc_atom(
name = "GrDawnTypes_hdr",
hdrs = ["GrDawnTypes.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/gpu:GrTypes_hdr"],
deps = [
"//include/gpu:GrTypes_hdr",
"//third_party:dawn",
],
)

View File

@ -290,7 +290,6 @@ generated_cc_atom(
":SkTo_hdr",
"//include/core:SkMatrix_hdr",
"//include/core:SkPoint_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRect_hdr",
"//include/core:SkRefCnt_hdr",
],

8
include/third_party/BUILD.bazel vendored Normal file
View File

@ -0,0 +1,8 @@
cc_library(
name = "skias_vulkan_headers",
includes = ["vulkan"],
visibility = ["//:__subpackages__"],
deps = [
"//include/third_party/vulkan/vulkan:vulkan_hdr",
],
)

View File

@ -16,12 +16,22 @@ generated_cc_atom(
name = "vulkan_core_hdr",
hdrs = ["vulkan_core.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/third_party/vulkan/vulkan:vk_platform_hdr"],
)
generated_cc_atom(
name = "vulkan_hdr",
hdrs = ["vulkan.h"],
visibility = ["//:__subpackages__"],
deps = [
"//include/third_party/vulkan/vulkan:vk_platform_hdr",
"//include/third_party/vulkan/vulkan:vulkan_android_hdr",
"//include/third_party/vulkan/vulkan:vulkan_core_hdr",
"//include/third_party/vulkan/vulkan:vulkan_ios_hdr",
"//include/third_party/vulkan/vulkan:vulkan_macos_hdr",
"//include/third_party/vulkan/vulkan:vulkan_win32_hdr",
"//include/third_party/vulkan/vulkan:vulkan_xcb_hdr",
],
)
generated_cc_atom(

View File

@ -466,6 +466,7 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
"//include/core:SkCanvas_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRect_hdr",
"//modules/svg/include:SkSVGRect_hdr",
"//modules/svg/include:SkSVGRenderContext_hdr",

View File

@ -3267,6 +3267,7 @@ generated_cc_atom(
":SkPathPriv_hdr",
":SkSafeMath_hdr",
"//include/core:SkPath_hdr",
"//include/core:SkRRect_hdr",
"//include/private:SkNx_hdr",
"//include/private:SkOnce_hdr",
"//include/private:SkPathRef_hdr",
@ -5187,6 +5188,7 @@ generated_cc_atom(
"//include/private:SkImageInfoPriv_hdr",
"//include/private:SkMacros_hdr",
"//src/shaders:SkColorFilterShader_hdr",
"//src/shaders:SkColorShader_hdr",
"//src/utils:SkBlitterTrace_hdr",
],
)

View File

@ -135,6 +135,15 @@ cc_library(
"//src/gpu/geometry:GrShape_src",
"//src/gpu/geometry:GrStyledShape_src",
"//src/gpu/geometry:GrTriangulator_src",
"//src/gpu/glsl:GrGLSLBlend_src",
"//src/gpu/glsl:GrGLSLFragmentShaderBuilder_src",
"//src/gpu/glsl:GrGLSLProgramBuilder_src",
"//src/gpu/glsl:GrGLSLProgramDataManager_src",
"//src/gpu/glsl:GrGLSLShaderBuilder_src",
"//src/gpu/glsl:GrGLSLUniformHandler_src",
"//src/gpu/glsl:GrGLSLVarying_src",
"//src/gpu/glsl:GrGLSLVertexGeoBuilder_src",
"//src/gpu/glsl:GrGLSL_src",
"//src/gpu/gradients:GrGradientBitmapCache_src",
"//src/gpu/gradients:GrGradientShader_src",
"//src/gpu/ops:AAConvexPathRenderer_src",
@ -231,15 +240,47 @@ cc_library(
"//src/gpu/gl:GrGLVertexArray_src",
"//src/gpu/gl/builders:GrGLProgramBuilder_src",
"//src/gpu/gl/builders:GrGLShaderStringBuilder_src",
"//src/gpu/glsl:GrGLSLBlend_src",
"//src/gpu/glsl:GrGLSLFragmentShaderBuilder_src",
"//src/gpu/glsl:GrGLSLProgramBuilder_src",
"//src/gpu/glsl:GrGLSLProgramDataManager_src",
"//src/gpu/glsl:GrGLSLShaderBuilder_src",
"//src/gpu/glsl:GrGLSLUniformHandler_src",
"//src/gpu/glsl:GrGLSLVarying_src",
"//src/gpu/glsl:GrGLSLVertexGeoBuilder_src",
"//src/gpu/glsl:GrGLSL_src",
],
)
cc_library(
name = "vulkan_srcs",
deps = [
"//src/gpu/vk:GrVkAMDMemoryAllocator_src",
"//src/gpu/vk:GrVkBuffer_src",
"//src/gpu/vk:GrVkCaps_src",
"//src/gpu/vk:GrVkCommandBuffer_src",
"//src/gpu/vk:GrVkCommandPool_src",
"//src/gpu/vk:GrVkDescriptorPool_src",
"//src/gpu/vk:GrVkDescriptorSetManager_src",
"//src/gpu/vk:GrVkDescriptorSet_src",
"//src/gpu/vk:GrVkExtensions_src",
"//src/gpu/vk:GrVkFramebuffer_src",
"//src/gpu/vk:GrVkGpu_src",
"//src/gpu/vk:GrVkImageView_src",
"//src/gpu/vk:GrVkImage_src",
"//src/gpu/vk:GrVkInterface_src",
"//src/gpu/vk:GrVkMSAALoadManager_src",
"//src/gpu/vk:GrVkMemory_src",
"//src/gpu/vk:GrVkOpsRenderPass_src",
"//src/gpu/vk:GrVkPipelineStateBuilder_src",
"//src/gpu/vk:GrVkPipelineStateCache_src",
"//src/gpu/vk:GrVkPipelineStateDataManager_src",
"//src/gpu/vk:GrVkPipelineState_src",
"//src/gpu/vk:GrVkPipeline_src",
"//src/gpu/vk:GrVkRenderPass_src",
"//src/gpu/vk:GrVkRenderTarget_src",
"//src/gpu/vk:GrVkResourceProvider_src",
"//src/gpu/vk:GrVkSamplerYcbcrConversion_src",
"//src/gpu/vk:GrVkSampler_src",
"//src/gpu/vk:GrVkSecondaryCBDrawContext_src",
"//src/gpu/vk:GrVkSemaphore_src",
"//src/gpu/vk:GrVkTextureRenderTarget_src",
"//src/gpu/vk:GrVkTexture_src",
"//src/gpu/vk:GrVkTypesPriv_src",
"//src/gpu/vk:GrVkUniformHandler_src",
"//src/gpu/vk:GrVkUtil_src",
"//src/gpu/vk:GrVkVaryingHandler_src",
],
)
@ -298,6 +339,10 @@ cc_library(
":gl_srcs",
":v1_srcs",
],
"//bazel/common_config_settings:vulkan_backend": [
":vulkan_srcs",
":v1_srcs",
],
"//conditions:default": [],
}) + select({
":gl_and_linux": [":glx_srcs"],

View File

@ -4,7 +4,10 @@ generated_cc_atom(
name = "GrDawnAttachment_hdr",
hdrs = ["GrDawnAttachment.h"],
visibility = ["//:__subpackages__"],
deps = ["//src/gpu:GrAttachment_hdr"],
deps = [
"//src/gpu:GrAttachment_hdr",
"//third_party:dawn",
],
)
generated_cc_atom(
@ -22,7 +25,10 @@ generated_cc_atom(
name = "GrDawnBuffer_hdr",
hdrs = ["GrDawnBuffer.h"],
visibility = ["//:__subpackages__"],
deps = ["//src/gpu:GrGpuBuffer_hdr"],
deps = [
"//src/gpu:GrGpuBuffer_hdr",
"//third_party:dawn",
],
)
generated_cc_atom(
@ -73,6 +79,7 @@ generated_cc_atom(
"//src/gpu:GrProgramDesc_hdr",
"//src/gpu:GrStagingBufferManager_hdr",
"//src/sksl/ir:SkSLProgram_hdr",
"//third_party:dawn",
],
)
@ -119,6 +126,7 @@ generated_cc_atom(
"//include/gpu:GrTypes_hdr",
"//src/gpu:GrColor_hdr",
"//src/gpu:GrOpsRenderPass_hdr",
"//third_party:dawn",
],
)
@ -154,6 +162,7 @@ generated_cc_atom(
"//src/gpu:GrSPIRVVaryingHandler_hdr",
"//src/gpu/glsl:GrGLSLProgramBuilder_hdr",
"//src/sksl:SkSLCompiler_hdr",
"//third_party:dawn",
],
)
@ -182,6 +191,7 @@ generated_cc_atom(
"//src/core:SkAutoMalloc_hdr",
"//src/gpu:GrSPIRVUniformHandler_hdr",
"//src/gpu:GrUniformDataManager_hdr",
"//third_party:dawn",
],
)
@ -261,7 +271,10 @@ generated_cc_atom(
name = "GrDawnTexture_hdr",
hdrs = ["GrDawnTexture.h"],
visibility = ["//:__subpackages__"],
deps = ["//src/gpu:GrTexture_hdr"],
deps = [
"//src/gpu:GrTexture_hdr",
"//third_party:dawn",
],
)
generated_cc_atom(
@ -287,7 +300,10 @@ generated_cc_atom(
name = "GrDawnUtil_hdr",
hdrs = ["GrDawnUtil.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/private:GrTypesPriv_hdr"],
deps = [
"//include/private:GrTypesPriv_hdr",
"//third_party:dawn",
],
)
generated_cc_atom(

View File

@ -4,7 +4,10 @@ generated_cc_atom(
name = "GrVkAMDMemoryAllocator_hdr",
hdrs = ["GrVkAMDMemoryAllocator.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/gpu/vk:GrVkMemoryAllocator_hdr"],
deps = [
"//include/gpu/vk:GrVkMemoryAllocator_hdr",
"//third_party:vulkanmemoryallocator",
],
)
generated_cc_atom(

View File

@ -40,6 +40,7 @@ generated_cc_atom(
hdrs = ["SkImage_Base.h"],
visibility = ["//:__subpackages__"],
deps = [
"//experimental/graphite/src:TextureProxyView_hdr",
"//include/core:SkImage_hdr",
"//include/core:SkSurface_hdr",
"//include/private:SkTDArray_hdr",

View File

@ -331,6 +331,7 @@ generated_cc_atom(
deps = [
":SkSLLexer_hdr",
"//include/private:SkSLProgramKind_hdr",
"//include/private:SkTHash_hdr",
"//include/sksl:DSLSymbols_hdr",
"//include/sksl:DSL_hdr",
"//src/sksl/ir:SkSLProgram_hdr",
@ -455,6 +456,7 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":SkSLMangler_hdr",
"//include/private:SkTHash_hdr",
"//src/sksl/ir:SkSLProgram_hdr",
"//src/sksl/ir:SkSLVariableReference_hdr",
],
@ -702,6 +704,7 @@ generated_cc_atom(
"//include/private:SkSLModifiers_hdr",
"//include/private:SkSLProgramElement_hdr",
"//include/private:SkSLStatement_hdr",
"//include/sksl:DSLCore_hdr",
"//src/sksl/ir:SkSLBinaryExpression_hdr",
"//src/sksl/ir:SkSLBreakStatement_hdr",
"//src/sksl/ir:SkSLConstructorArrayCast_hdr",
@ -838,7 +841,10 @@ generated_cc_atom(
name = "SkSLBuiltinMap_hdr",
hdrs = ["SkSLBuiltinMap.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/private:SkSLString_hdr"],
deps = [
"//include/private:SkSLString_hdr",
"//include/private:SkTHash_hdr",
],
)
generated_cc_atom(

View File

@ -24,6 +24,7 @@ generated_cc_atom(
":SkSLProgramVisitor_hdr",
"//include/private:SkSLProgramElement_hdr",
"//include/private:SkSLStatement_hdr",
"//include/private:SkTHash_hdr",
"//src/core:SkSafeMath_hdr",
"//src/sksl:SkSLAnalysis_hdr",
"//src/sksl:SkSLContext_hdr",

View File

@ -63,6 +63,7 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":SkSLCodeGenerator_hdr",
"//include/private:SkTHash_hdr",
"//src/sksl:SkSLOperators_hdr",
"//src/sksl:SkSLStringStream_hdr",
],
@ -163,6 +164,7 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":SkSLCodeGenerator_hdr",
"//include/private:SkTHash_hdr",
"//src/core:SkOpts_hdr",
"//src/sksl:SkSLMemoryLayout_hdr",
"//src/sksl:SkSLStringStream_hdr",
@ -249,6 +251,7 @@ generated_cc_atom(
"//include/private:SkSLProgramElement_hdr",
"//include/private:SkSLStatement_hdr",
"//include/private:SkTArray_hdr",
"//include/private:SkTHash_hdr",
"//include/private:SkTPin_hdr",
"//src/sksl:SkSLCompiler_hdr",
"//src/sksl:SkSLOperators_hdr",

View File

@ -3315,6 +3315,7 @@ generated_cc_atom(
"//include/core:SkImage_hdr",
"//include/core:SkPictureRecorder_hdr",
"//include/core:SkPicture_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkString_hdr",
"//include/core:SkSurface_hdr",
"//include/core:SkTextBlob_hdr",
@ -3664,6 +3665,7 @@ generated_cc_atom(
":Test_hdr",
"//include/core:SkPathBuilder_hdr",
"//include/core:SkPathTypes_hdr",
"//include/core:SkRRect_hdr",
"//include/utils:SkRandom_hdr",
"//src/core:SkPathPriv_hdr",
],
@ -5065,6 +5067,7 @@ generated_cc_atom(
deps = [
":Test_hdr",
"//include/core:SkPath_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkRegion_hdr",
"//include/utils:SkRandom_hdr",
"//src/core:SkAutoMalloc_hdr",
@ -5385,6 +5388,7 @@ generated_cc_atom(
":Test_hdr",
"//include/core:SkCanvas_hdr",
"//include/core:SkPath_hdr",
"//include/core:SkRRect_hdr",
"//include/core:SkVertices_hdr",
"//include/utils:SkShadowUtils_hdr",
"//src/core:SkDrawShadowInfo_hdr",

View File

@ -114,21 +114,6 @@ generated_cc_atom(
],
)
generated_cc_atom(
name = "UniformCacheTest_src",
srcs = ["UniformCacheTest.cpp"],
visibility = ["//:__subpackages__"],
deps = [
"//experimental/graphite/include:Context_hdr",
"//experimental/graphite/include:Recorder_hdr",
"//experimental/graphite/src:RecorderPriv_hdr",
"//experimental/graphite/src:UniformCache_hdr",
"//src/core:SkUniformData_hdr",
"//src/core:SkUniform_hdr",
"//tests:Test_hdr",
],
)
generated_cc_atom(
name = "UniformTest_src",
srcs = ["UniformTest.cpp"],
@ -162,3 +147,18 @@ generated_cc_atom(
"//tests:Test_hdr",
],
)
generated_cc_atom(
name = "PipelineDataCacheTest_src",
srcs = ["PipelineDataCacheTest.cpp"],
visibility = ["//:__subpackages__"],
deps = [
"//experimental/graphite/include:Context_hdr",
"//experimental/graphite/include:Recorder_hdr",
"//experimental/graphite/src:PipelineDataCache_hdr",
"//experimental/graphite/src:RecorderPriv_hdr",
"//src/core:SkUniformData_hdr",
"//src/core:SkUniform_hdr",
"//tests:Test_hdr",
],
)

View File

@ -2421,3 +2421,25 @@ cc_library(
"etc1/etc1.h",
],
)
cc_library(
name = "dawn",
# TODO(kjlubick)
)
cc_library(
name = "vulkanmemoryallocator",
srcs = [
"vulkanmemoryallocator/GrVulkanMemoryAllocator.cpp",
"vulkanmemoryallocator/include/vk_mem_alloc.h",
],
hdrs = [
"vulkanmemoryallocator/GrVulkanMemoryAllocator.h",
],
includes = [
"vulkanmemoryallocator",
],
deps = [
"//include/third_party:skias_vulkan_headers",
],
)

View File

@ -1,7 +1,14 @@
{
"D3D12MemAlloc.h": "SK_GAZELLE_IGNORE TODO //third_party:d3d12allocator",
"dawn/webgpu_cpp.h": "SK_GAZELLE_IGNORE TODO //third_party:dawn",
"dawn/dawn_proc.h": "//third_party:dawn",
"dawn/dawn_wsi.h": "//third_party:dawn",
"dawn/native/D3D12Backend.h": "//third_party:dawn",
"dawn/native/DawnNative.h": "//third_party:dawn",
"dawn/native/OpenGLBackend.h": "//third_party:dawn",
"dawn/native/VulkanBackend.h": "//third_party:dawn",
"webgpu/webgpu.h": "//third_party:dawn",
"webgpu/webgpu_cpp.h": "//third_party:dawn",
"dng_area_task.h": "//third_party:dng_sdk",
"dng_color_space.h": "//third_party:dng_sdk",
@ -58,25 +65,27 @@
"third_party/externals/spirv-cross/spirv_hlsl.hpp": "SK_GAZELLE_IGNORE TODO //third_party:spirv_cross",
"spirv-tools/libspirv.hpp": "SK_GAZELLE_IGNORE TODO //third_party:spirv_tools",
"vk_platform.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_android.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_beta.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_core.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_directfb.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_fuchsia.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_ggp.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_ios.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_macos.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_metal.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_screen.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_vi.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_wayland.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_win32.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_xcb.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_xlib.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vulkan_xlib_xrandr.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkan",
"vk_platform.h": "//include/third_party/vulkan/vulkan:vk_platform_hdr",
"vulkan_android.h": "//include/third_party/vulkan/vulkan:vulkan_android_hdr",
"vulkan_core.h": "//include/third_party/vulkan/vulkan:vulkan_core_hdr",
"vulkan_ios.h": "//include/third_party/vulkan/vulkan:vulkan_ios_hdr",
"vulkan_macos.h": "//include/third_party/vulkan/vulkan:vulkan_macos_hdr",
"vulkan_win32.h": "//include/third_party/vulkan/vulkan:vulkan_win32_hdr",
"vulkan_xcb.h": "//include/third_party/vulkan/vulkan:vulkan_xcb_hdr",
"vulkan/vulkan.h": "//include/third_party:skias_vulkan_headers",
"GrVulkanMemoryAllocator.h": "SK_GAZELLE_IGNORE TODO //third_party:vulkanmemoryallocator",
"vulkan_beta.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_directfb.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_fuchsia.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_ggp.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_metal.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_screen.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_vi.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_wayland.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_xlib.h": "SK_GAZELLE_IGNORE not actually included by us",
"vulkan_xlib_xrandr.h": "SK_GAZELLE_IGNORE not actually included by us",
"GrVulkanMemoryAllocator.h": "//third_party:vulkanmemoryallocator",
"wuffs-v0.3.c": "//third_party:wuffs",

View File

@ -13,6 +13,7 @@ clang_url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0
# still have their file extension, as some of the Starlark functions sniff the file extension
# (e.g. download_and_extract). See //bazel/gcs_mirror for an automated way to update this mirror.
mirror_prefix = "https://storage.googleapis.com/skia-world-readable/bazel/"
# Set this to True to only use the files from the mirror host. This can be used to test the data
# in the mirrors is not corrupt and publicly accessible.
# If testing this, you need to delete the download cache, which defaults to
@ -92,6 +93,12 @@ debs_to_install = [
"sha256": "f300f9610b5f05f1ce566c4095f1bf2170e512ac5d201c40d895b8fce29dec98",
"url": "https://ftp.debian.org/debian/pool/main/libg/libglvnd/libgl1_1.3.2-1_amd64.deb",
},
# This is used by sk_app for Vulkan and Dawn on Unix.
{
# From https://packages.debian.org/bullseye/amd64/libx11-xcb-dev/download
"sha256": "80a2413ace2a0a073f2472059b9e589737cbf8a336fb6862684a5811bf640aa3",
"url": "https://ftp.debian.org/debian/pool/main/libx/libx11/libx11-xcb-dev_1.7.2-1_amd64.deb",
},
]
def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""):
@ -99,7 +106,7 @@ def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""):
# https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download
download_info = ctx.download(
url = _mirror([deb, mirror_prefix+sha256+".deb"]),
url = _mirror([deb, mirror_prefix + sha256 + ".deb"]),
output = "deb.ar",
sha256 = sha256,
)
@ -124,7 +131,7 @@ def _build_cpp_toolchain_impl(ctx):
# Download the clang toolchain (the extraction can take a while)
# https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download_and_extract
download_info = ctx.download_and_extract(
url = _mirror([clang_url, mirror_prefix+clang_sha256+".tar.xz"]),
url = _mirror([clang_url, mirror_prefix + clang_sha256 + ".tar.xz"]),
output = "",
stripPrefix = clang_prefix,
sha256 = clang_sha256,

View File

@ -4,7 +4,10 @@ generated_cc_atom(
name = "DawnTestContext_hdr",
hdrs = ["DawnTestContext.h"],
visibility = ["//:__subpackages__"],
deps = ["//tools/gpu:TestContext_hdr"],
deps = [
"//third_party:dawn",
"//tools/gpu:TestContext_hdr",
],
)
generated_cc_atom(
@ -14,10 +17,8 @@ generated_cc_atom(
deps = [
":DawnTestContext_hdr",
"//GL:glx_hdr",
"//dawn:dawn_proc_hdr",
"//dawn:webgpu_hdr",
"//dawn_native:OpenGLBackend_hdr",
"//include/gpu:GrDirectContext_hdr",
"//third_party:dawn",
"//tools:AutoreleasePool_hdr",
],
)

View File

@ -4,7 +4,10 @@ generated_cc_atom(
name = "GrVulkanDefines_hdr",
hdrs = ["GrVulkanDefines.h"],
visibility = ["//:__subpackages__"],
deps = ["//include/core:SkTypes_hdr"],
deps = [
"//include/core:SkTypes_hdr",
"//include/third_party:skias_vulkan_headers",
],
)
generated_cc_atom(

View File

@ -15,7 +15,8 @@
#elif defined SK_BUILD_FOR_MAC
#define SK_GPU_TOOLS_VK_LIBRARY_NAME libvk_swiftshader.dylib
#else
#define SK_GPU_TOOLS_VK_LIBRARY_NAME libvulkan.so
#define SK_GPU_TOOLS_VK_LIBRARY_NAME libvulkan.so
#define SK_GPU_TOOLS_VK_LIBRARY_NAME_BACKUP libvulkan.so.1
#endif
#endif
@ -44,7 +45,16 @@ bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr* instProc) {
if (!vkLib) {
vkLib = SkLoadDynamicLibrary(STRINGIFY(SK_GPU_TOOLS_VK_LIBRARY_NAME));
if (!vkLib) {
// vulkaninfo tries to load the library from two places, so we do as well
// https://github.com/KhronosGroup/Vulkan-Tools/blob/078d44e4664b7efa0b6c96ebced1995c4425d57a/vulkaninfo/vulkaninfo.h#L249
#ifdef SK_GPU_TOOLS_VK_LIBRARY_NAME_BACKUP
vkLib = SkLoadDynamicLibrary(STRINGIFY(SK_GPU_TOOLS_VK_LIBRARY_NAME_BACKUP));
if (!vkLib) {
return false;
}
#else
return false;
#endif
}
localInstProc = (PFN_vkGetInstanceProcAddr) SkGetProcedureAddress(vkLib,
"vkGetInstanceProcAddr");

View File

@ -1,5 +1,23 @@
# https://github.com/bazelbuild/bazel-skylib
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//bazel:macros.bzl", "generated_cc_atom")
selects.config_setting_group(
name = "vulkan_unix",
match_all = [
"//bazel/common_config_settings:vulkan_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "gl_unix",
match_all = [
"//bazel/common_config_settings:gl_backend",
"@platforms//os:linux",
],
)
cc_library(
name = "sk_app",
visibility = ["//:__subpackages__"],
@ -8,16 +26,27 @@ cc_library(
":CommandSet_src",
":RasterWindowContext_hdr",
":WindowContext_src",
":GLWindowContext_src",
":Window_src",
] + [
# TODO(kjlubick) use a select to set these based on target platform
"//tools/sk_app/unix:GLWindowContext_unix_src",
"//tools/sk_app/unix:RasterWindowContext_unix_src",
"//tools/sk_app/unix:Window_unix_src",
"//tools/sk_app/unix:keysym2ucs_src",
"//tools/sk_app/unix:main_unix_src",
],
] + select({
"@platforms//os:linux": [
"//tools/sk_app/unix:RasterWindowContext_unix_src",
"//tools/sk_app/unix:Window_unix_src",
"//tools/sk_app/unix:keysym2ucs_src",
"//tools/sk_app/unix:main_unix_src",
],
# TODO(kjlubick) add Windows/Mac support
}) + select({
"//bazel/common_config_settings:gl_backend": [
":GLWindowContext_src",
],
"//bazel/common_config_settings:vulkan_backend": [
":VulkanWindowContext_src",
"//tools/gpu/vk:VkTestUtils_src",
],
}) + select({
":gl_unix": ["//tools/sk_app/unix:GLWindowContext_unix_src"],
":vulkan_unix": ["//tools/sk_app/unix:VulkanWindowContext_unix_src"],
}),
)
generated_cc_atom(
@ -54,10 +83,9 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//dawn:dawn_wsi_hdr",
"//dawn_native:DawnNative_hdr",
"//include/core:SkRefCnt_hdr",
"//include/core:SkSurface_hdr",
"//third_party:dawn",
],
)
@ -67,11 +95,11 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":DawnWindowContext_hdr",
"//dawn:dawn_proc_hdr",
"//include/core:SkSurface_hdr",
"//include/gpu:GrBackendSurface_hdr",
"//include/gpu:GrDirectContext_hdr",
"//src/core:SkAutoMalloc_hdr",
"//third_party:dawn",
],
)

View File

@ -6,9 +6,9 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":WindowContextFactory_unix_hdr",
"//dawn_native:DawnNative_hdr",
"//dawn_native:VulkanBackend_hdr",
"//include/third_party:skias_vulkan_headers",
"//src/ports:SkOSLibrary_hdr",
"//third_party:dawn",
"//tools/gpu/vk:VkTestUtils_hdr",
"//tools/sk_app:DawnWindowContext_hdr",
],
@ -54,6 +54,7 @@ generated_cc_atom(
name = "WindowContextFactory_unix_hdr",
hdrs = ["WindowContextFactory_unix.h"],
visibility = ["//:__subpackages__"],
deps = ["//third_party:dawn"],
)
generated_cc_atom(

View File

@ -26,6 +26,7 @@ std::unique_ptr<WindowContext> MakeVulkanForXlib(const XlibWindowInfo& info,
const DisplayParams& displayParams) {
PFN_vkGetInstanceProcAddr instProc;
if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
SkDebugf("Could not load vulkan library\n");
return nullptr;
}
@ -64,9 +65,9 @@ std::unique_ptr<WindowContext> MakeVulkanForXlib(const XlibWindowInfo& info,
instProc(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
}
Display* display = info.fDisplay;
VisualID visualID = info.fVisualInfo->visualid;
VisualID visualID = XVisualIDFromVisual(DefaultVisual(info.fDisplay,
DefaultScreen(info.fDisplay)));
VkBool32 check = getPhysicalDeviceXcbPresentationSupportKHR(physDev,
queueFamilyIndex,
XGetXCBConnection(display),

View File

@ -61,6 +61,7 @@ bool Window_unix::initWindow(Display* display) {
constexpr int initialWidth = 1280;
constexpr int initialHeight = 960;
#ifdef SK_GL
// Attempt to create a window that supports GL
// We prefer the more recent glXChooseFBConfig but fall back to glXChooseVisual. They have
@ -137,7 +138,9 @@ bool Window_unix::initWindow(Display* display) {
fVisualInfo->visual,
CWEventMask | CWColormap,
&swa);
} else {
}
#endif
if (!fWindow) {
// Create a simple window instead. We will not be able to show GL
fWindow = XCreateSimpleWindow(display,
DefaultRootWindow(display),

View File

@ -32,9 +32,7 @@ generated_cc_atom(
visibility = ["//:__subpackages__"],
deps = [
":WindowContextFactory_win_hdr",
"//dawn:dawn_wsi_hdr",
"//dawn_native:D3D12Backend_hdr",
"//dawn_native:DawnNative_hdr",
"//third_party:dawn",
"//tools/sk_app:DawnWindowContext_hdr",
],
)