diff --git a/BUILD.gn b/BUILD.gn index 2d227d7b9161..4ebae5159e25 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -173,7 +173,7 @@ is_loong64 = current_cpu == "loong64" opts("hsw") { enabled = is_x86 sources = skia_opts.hsw_sources - if (is_win) { + if (is_msvc) { cflags = [ "/arch:AVX2" ] } else { cflags = [ "-march=haswell" ] @@ -183,7 +183,7 @@ opts("hsw") { opts("skx") { enabled = is_x86 sources = skia_opts.skx_sources - if (is_win) { + if (is_msvc) { cflags = [ "/arch:AVX512" ] } else { cflags = [ "-march=skylake-avx512" ] @@ -497,7 +497,11 @@ optional("fontmgr_win_gdi") { public_defines = [ "SK_FONTMGR_GDI_AVAILABLE" ] public = skia_ports_windows_fonts_public sources = skia_ports_fonthost_win_sources - libs = [ "Gdi32.lib" ] + if (is_msvc) { + libs = [ "Gdi32.lib" ] + } else { + libs = [ "gdi32" ] + } } if (skia_lex) { @@ -898,7 +902,31 @@ optional("gpu_shared") { if (skia_use_dawn) { public_defines += [ "SK_DAWN" ] - public_deps += [ "//third_party/dawn" ] + + # When building for WASM, the WebGPU headers are provided by Emscripten. For native builds we + # have to depend on Dawn directly. + if (!skia_use_webgpu) { + public_deps += [ + "//third_party/externals/dawn/include/dawn:cpp_headers", + "//third_party/externals/dawn/src/dawn:cpp", + "//third_party/externals/dawn/src/dawn:proc", + ] + + if (dawn_enable_d3d12 || dawn_enable_d3d11 || dawn_enable_desktop_gl || + dawn_enable_metal || dawn_enable_opengles || dawn_enable_vulkan) { + public_deps += [ "//third_party/externals/dawn/src/dawn/native" ] + } + if (dawn_enable_d3d12) { + if (is_msvc) { + libs += ["d3d12.lib", "dxgi.lib", "d3dcompiler.lib"] + } else { + libs += ["d3d12", "dxgi", "d3dcompiler"] + } + + } else if (dawn_enable_metal) { + frameworks += [ "Metal.framework" ] + } + } } if (skia_use_direct3d) { @@ -1001,7 +1029,12 @@ optional("gpu") { "src/gpu/ganesh/gl/win/GrGLMakeWinInterface.cpp", ] if (target_cpu != "arm64") { - libs += [ "OpenGL32.lib" ] + if (is_msvc) { + libs += [ "OpenGL32.lib" ] + } else { + libs += [ "opengl32" ] + } + } } else { sources += [ "src/gpu/ganesh/gl/GrGLMakeNativeInterface_none.cpp" ] @@ -1026,11 +1059,19 @@ optional("gpu") { if (skia_enable_direct3d_debug_layer) { public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ] } - libs += [ - "d3d12.lib", - "dxgi.lib", - "d3dcompiler.lib", - ] + if(is_msvc) { + libs += [ + "d3d12.lib", + "dxgi.lib", + "d3dcompiler.lib", + ] + } else { + libs += [ + "d3d12", + "dxgi", + "d3dcompiler", + ] + } } cflags_objcc = [] @@ -1760,17 +1801,18 @@ skia_component("skia") { "src/ports/SkDebug_win.cpp", "src/ports/SkImageGeneratorWIC.cpp", ] - libs += [ - "Ole32.lib", - "OleAut32.lib", - ] - + if(is_msvc) { + libs += ["Ole32.lib","OleAut32.lib"] + } else { + libs += ["ole32","oleaut32"] + } if (!skia_enable_winuwp) { - libs += [ - "FontSub.lib", - "User32.lib", - "Usp10.lib", - ] + if(is_msvc) { + libs += ["FontSub.lib", "User32.lib", "Usp10.lib"] + } else { + libs += ["fontsub", "user32", "usp10"] + } + } } else { sources += [ "src/ports/SkOSFile_posix.cpp" ] @@ -1927,6 +1969,14 @@ action("skia.h") { outputs = [ skia_h ] } +config("cpp17") { + if (is_msvc) { + cflags_cc = [ "/std:c++17" ] + } else { + cflags_cc = [ "-std=c++17" ] + } +} + skia_source_set("public_headers_warnings_check") { sources = [ "tools/public_headers_warnings_check.cpp" ] configs = [ ":use_skia_vulkan_headers" ] diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn index b08ab14c5962..695f2e401d03 100644 --- a/gn/BUILDCONFIG.gn +++ b/gn/BUILDCONFIG.gn @@ -71,6 +71,36 @@ is_mac = current_os == "mac" is_wasm = current_os == "wasm" is_win = current_os == "win" +declare_args() { + extra_asmflags = [] + extra_cflags = [] + extra_cflags_c = [] + extra_cflags_cc = [] + extra_ldflags = [] + malloc = "" + werror = false + xcode_sysroot = "" +} + +target_triple = "" +foreach(flag, extra_cflags) { + if (flag == "--target" || flag == "-target") { + } else { + parts = [] + parts = string_split(flag, "=") + if (parts[0] == "--target" || parts[0] == "-target") { + target_triple = parts[1] + } + } +} +is_mingw = (string_replace(target_triple, "mingw", "") != target_triple) || + (string_replace(target_triple, "windows-gnu", "") != target_triple) +is_msvc = !is_mingw + +if (is_mingw) { + extra_cflags += ["-mno-avx512f","-mno-avx512vl","-mpclmul"] +} + # Dawn has references to fuchsia, but Skia's GN rules do not is_fuchsia = false @@ -128,7 +158,7 @@ if (is_android) { } } -if (target_os == "win") { +if (is_msvc) { # By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a # non-default location, you can set win_vc to inform us where it is. @@ -139,11 +169,11 @@ if (target_os == "win") { # directory. } -if (target_os == "win") { +if (is_msvc) { if (win_toolchain_version == "") { win_toolchain_version = exec_script("//gn/highest_version_dir.py", [ - "$win_vc/Tools/MSVC", + "$win_vc/tools/msvc", "[0-9]{2}\.[0-9]{2}\.[0-9]{5}", ], "trim string") @@ -233,7 +263,7 @@ if (!is_official_build) { [ "//gn/skia:warnings_for_public_headers" ] } -if (is_win) { +if (is_msvc) { # Windows tool chain set_default_toolchain("//gn/toolchain:msvc") default_toolchain_name = "msvc" diff --git a/gn/portable/BUILD.gn b/gn/portable/BUILD.gn index 48cb62cc7f52..f7ac2e160d94 100644 --- a/gn/portable/BUILD.gn +++ b/gn/portable/BUILD.gn @@ -12,7 +12,7 @@ config("add_exceptions") { } config("add_rtti") { - if (is_win) { + if (is_msvc) { cflags_cc = [ "/GR" ] } else { cflags_cc = [ "-frtti" ] diff --git a/gn/skia/BUILD.gn b/gn/skia/BUILD.gn index 8fda9125f76c..3fabd5046742 100644 --- a/gn/skia/BUILD.gn +++ b/gn/skia/BUILD.gn @@ -9,18 +9,6 @@ if (is_wasm) { import("../skia.gni") -declare_args() { - extra_asmflags = [] - extra_cflags = [] - extra_cflags_c = [] - extra_cflags_cc = [] - extra_ldflags = [] - - malloc = "" - werror = false - xcode_sysroot = "" -} - if (is_ios && xcode_sysroot == "") { if (is_tvos) { sdk = "appletvos" @@ -59,12 +47,12 @@ config("default") { # Disable warnings about unknown attributes. # (These unknown attribute warnings are on by default, so we don't make # disabling them part of :warnings, as some targets remove :warnings.) - if (is_win && !is_clang) { + if (is_msvc && !is_clang) { cflags += [ "/wd5030", "/wd5051", ] - } else { + } else if (!is_mingw) { cflags += [ "-Wno-attributes" ] } @@ -74,7 +62,7 @@ config("default") { cflags += [ "-ffp-contract=off" ] } - if (is_win) { + if (is_msvc) { if (is_clang && current_cpu == "arm64") { cflags += [ "--target=arm64-windows" ] } @@ -120,6 +108,16 @@ config("default") { "$win_vc/Tools/MSVC/$win_toolchain_version/lib/$current_cpu", ] } else { + if (is_mingw) { + if (target_cpu == "arm64") { + cflags += ["-march=armv8-a+simd+fp"] + } else { + cflags += ["-mavx2", "-mavx512f", "-mf16c", "-mfma"] + } + cflags += ["-fpermissive", "-fstrict-aliasing", "-fvisibility=default"] + } else { + cflags += ["-fstrict-aliasing", "-fPIC", "-fvisibility=hidden"] + } cflags += [ "-fPIC", "-fvisibility=hidden", @@ -158,7 +156,12 @@ config("default") { ] libs += [ malloc ] } - + if (is_mingw) { + defines += ["_CRT_SECURE_NO_WARNINGS", "WIN32_LEAN_AND_MEAN", "NOMINMAX"] + if (!is_clang) { + cflags += ["-Wno-attributes", "-Wno-stringop-overflow"] + } + } if (is_android) { cflags += [ "--sysroot=$ndk/toolchains/llvm/prebuilt/$ndk_host/sysroot" ] ldflags += [ "-static-libstdc++" ] @@ -166,7 +169,7 @@ config("default") { if (show_includes) { assert(is_clang, "show_includes requires clang to build.") - if (is_win) { + if (is_msvc) { cflags += [ "/clang:-H", "/clang:-fshow-skipped-includes", @@ -189,8 +192,6 @@ config("default") { _arch_flags = [ "-arch", "arm64", - "-arch", - "arm64e", ] } else if (current_cpu == "x86") { _arch_flags = [ @@ -346,7 +347,7 @@ config("default") { cflags += [ "-fno-sanitize=function" ] } - if (is_win) { + if (is_msvc) { cflags += [ # On Release builds, we get strange warnings about string literals. "/GF-", @@ -385,7 +386,7 @@ config("recover_pointer_overflow") { config("no_exceptions") { # Exceptions are disabled by default on Windows. (Use /EHsc to enable them.) - if (!is_win) { + if (!is_msvc) { cflags_cc = [ "-fno-exceptions" ] cflags_objcc = cflags_cc } @@ -398,14 +399,14 @@ config("warnings") { cflags_objcc = [] if (werror) { - if (is_win) { + if (is_msvc) { cflags += [ "/WX" ] } else { cflags += [ "-Werror" ] } } - if (is_win) { + if (is_msvc) { cflags += [ "/W3", # Turn on lots of warnings. @@ -652,7 +653,7 @@ config("debug_symbols") { "-gline-tables-only", "-funwind-tables", # Helps make in-process backtraces fuller. ] - } else if (is_win) { + } else if (is_msvc) { cflags = [ "/Z7" ] if (is_clang) { cflags += [ "-gcodeview-ghash" ] @@ -672,7 +673,7 @@ config("no_rtti") { # -fsanitize=vptr requires RTTI which is enabled as a part of # -fsanitize=undefined if (sanitize != "ASAN") { - if (is_win) { + if (is_msvc) { cflags_cc = [ "/GR-" ] } else { cflags_cc = [ "-fno-rtti" ] @@ -683,7 +684,7 @@ config("no_rtti") { config("optimize") { ldflags = [] - if (is_win) { + if (is_msvc) { cflags = [ "/O2", "/Zc:inline", @@ -698,7 +699,7 @@ config("optimize") { } else { if (skia_enable_optimize_size) { cflags = [ "-Oz" ] - if (!is_android) { + if (!is_android && !is_mingw) { cflags += [ # Clang 15 turns PIE (Position-indendendent Executable) on by default. "-fno-PIE", @@ -761,7 +762,9 @@ config("executable") { "-rdynamic", "-Wl,-rpath,\$ORIGIN", ] - } else if (is_win) { + } else if (is_mingw) { + ldflags = [ "-mconsole" ] + } else if (is_msvc) { ldflags = [ "/SUBSYSTEM:CONSOLE", # Quiet "no subsystem specified; CONSOLE assumed". "/INCREMENTAL:NO", # Quiet warnings about failing to incrementally link diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn index 8eace3949baf..b010b3c9b034 100644 --- a/gn/toolchain/BUILD.gn +++ b/gn/toolchain/BUILD.gn @@ -46,7 +46,7 @@ declare_args() { } # For 'shell' see https://ninja-build.org/manual.html#ref_rule_command -if (host_os == "win") { +if (is_msvc) { shell = "cmd.exe /c " stamp = "$shell echo >" } else { @@ -304,8 +304,7 @@ template("gcc_like_toolchain") { } else { rspfile = "{{output}}.rsp" rspfile_content = "{{inputs}}" - rm_py = rebase_path("../rm.py") - command = "$shell python3 \"$rm_py\" \"{{output}}\" && $ar rcs {{output}} @$rspfile" + command = "$ar rcs {{output}} @$rspfile" } outputs = @@ -324,6 +323,8 @@ template("gcc_like_toolchain") { rpath = "-Wl,-soname,$soname" if (is_mac || is_ios) { rpath = "-Wl,-install_name,@rpath/$soname" + } else if (is_mingw) { + rpath = "" } rspfile = "{{output}}.rsp" @@ -341,12 +342,16 @@ template("gcc_like_toolchain") { _start_group = "" _end_group = "" } - - command = "$link -shared {{ldflags}} $_start_group @$rspfile {{frameworks}} {{solibs}} $_end_group {{libs}} $rpath -o {{output}}" - outputs = [ "{{root_out_dir}}/$soname" ] + soname_flags = "" + if (is_mingw) { + soname_flags = "-Wl,--out-implib=$soname.a" + } + command = "$link -shared $soname_flags {{ldflags}} $_start_group @$rspfile {{frameworks}} {{solibs}} {{libs}} $_end_group $rpath -o {{output}}" outputs = [ "{{root_out_dir}}/$soname" ] output_prefix = "lib" - if (is_mac || is_ios) { + if (is_mac || is_ios) { default_output_extension = ".dylib" + } else if (is_mingw) { + default_output_extension = ".dll" } else { default_output_extension = ".so" } diff --git a/include/gpu/ganesh/GrBackendSurface.h b/include/gpu/ganesh/GrBackendSurface.h index b7bce4e61c77..cd6415984216 100644 --- a/include/gpu/ganesh/GrBackendSurface.h +++ b/include/gpu/ganesh/GrBackendSurface.h @@ -18,6 +18,7 @@ #include "include/private/base/SkDebug.h" #include "include/private/gpu/ganesh/GrTypesPriv.h" +#define SK_DIRECT3D enum class SkTextureCompressionType; class GrBackendFormatData; class GrBackendTextureData; diff --git a/include/private/base/SkAttributes.h b/include/private/base/SkAttributes.h index ff1adaa9a7ea..53693f79059f 100644 --- a/include/private/base/SkAttributes.h +++ b/include/private/base/SkAttributes.h @@ -24,7 +24,7 @@ * SK_ALWAYS_INLINE void someMethod() { ... } // should always be inlined */ #if !defined(SK_ALWAYS_INLINE) -# if defined(SK_BUILD_FOR_WIN) +# if defined(_MSC_VER) # define SK_ALWAYS_INLINE __forceinline # else # define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline @@ -36,7 +36,7 @@ * you can use SK_NEVER_INLINE to prevent inlining. */ #if !defined(SK_NEVER_INLINE) -# if defined(SK_BUILD_FOR_WIN) +# if defined(_MSC_VER) # define SK_NEVER_INLINE __declspec(noinline) # else # define SK_NEVER_INLINE SK_ATTRIBUTE(noinline) diff --git a/modules/skcms/BUILD.gn b/modules/skcms/BUILD.gn index 5d037a94c93c..4dac835ace6b 100644 --- a/modules/skcms/BUILD.gn +++ b/modules/skcms/BUILD.gn @@ -33,7 +33,7 @@ template("arch") { arch("skcms_TransformHsw") { enabled = current_cpu == "x64" && target_os != "android" sources = skcms_TransformHsw - if (is_win) { + if (is_msvc) { if (is_clang) { cflags = [ "/clang:-mavx2", @@ -43,6 +43,8 @@ arch("skcms_TransformHsw") { } else { cflags = [ "/arch:AVX2" ] } + } else if (is_mingw) { + cflags = [ "-march=haswell" ] } else { cflags = [ "-mavx2", @@ -53,9 +55,9 @@ arch("skcms_TransformHsw") { } arch("skcms_TransformSkx") { - enabled = current_cpu == "x64" && target_os != "android" + enabled = current_cpu == "x64" && target_os != "android" && !is_mingw sources = skcms_TransformSkx - if (is_win) { + if (is_msvc) { if (is_clang) { cflags = [ "/clang:-mavx512f", @@ -90,6 +92,8 @@ static_library("skcms") { "SKCMS_DISABLE_HSW", "SKCMS_DISABLE_SKX", ] + } else if (is_mingw) { + defines = ["SKCMS_DISABLE_SKX"] } public = skcms_public_headers sources = skcms_public + skcms_TransformBaseline diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h index 2a2fd2cc4233..e90fe267ef50 100644 --- a/src/core/SkRasterPipeline.h +++ b/src/core/SkRasterPipeline.h @@ -26,7 +26,7 @@ enum SkColorType : int; struct SkImageInfo; struct skcms_TransferFunction; -#if __has_cpp_attribute(clang::musttail) && !defined(__EMSCRIPTEN__) && !defined(SK_CPU_ARM32) && \ +#if __has_cpp_attribute(clang::musttail) && defined(__clang__) && !defined(__EMSCRIPTEN__) && !defined(SK_CPU_ARM32) && \ !defined(SK_CPU_LOONGARCH) && !defined(SK_CPU_PPC) && \ !(defined(_WIN32) && defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)) // [[clang::musttail]] is disabled for the Android version of Skia running on Windows as it diff --git a/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h b/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h index bf5c483ac9b2..d882c08ebfc0 100644 --- a/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h +++ b/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h @@ -8,6 +8,7 @@ #ifndef GrD3DPipelineStateBuilder_DEFINED #define GrD3DPipelineStateBuilder_DEFINED +#include "src/gpu/ganesh/d3d/GrD3DRenderTarget.h" #include "src/gpu/SkSLToBackend.h" #include "src/gpu/ganesh/GrPipeline.h" #include "src/gpu/ganesh/GrSPIRVUniformHandler.h" diff --git a/src/gpu/ganesh/gl/GrGLContext.cpp b/src/gpu/ganesh/gl/GrGLContext.cpp index bf002451c08a..40a1e77e7fb6 100644 --- a/src/gpu/ganesh/gl/GrGLContext.cpp +++ b/src/gpu/ganesh/gl/GrGLContext.cpp @@ -19,14 +19,14 @@ //////////////////////////////////////////////////////////////////////////////// -std::unique_ptr GrGLContext::Make(sk_sp interface, +std::unique_ptr GrGLContext::Make(sk_sp iface, const GrContextOptions& options) { - if (!interface->validate()) { + if (!iface->validate()) { return nullptr; } ConstructorArgs args; - args.fDriverInfo = GrGLGetDriverInfo(interface.get()); + args.fDriverInfo = GrGLGetDriverInfo(iface.get()); if (args.fDriverInfo.fVersion == GR_GL_INVALID_VER) { return nullptr; } @@ -74,18 +74,18 @@ std::unique_ptr GrGLContext::Make(sk_sp interf // extension to be enabled, even when using ESSL3. Some devices appear to only support the ES2 // extension. As an extreme (optional) solution, we can fallback to using ES2 shading language // if we want to prioritize external texture support. skbug.com/40038974 - if (GR_IS_GR_GL_ES(interface->fStandard) && + if (GR_IS_GR_GL_ES(iface->fStandard) && options.fPreferExternalImagesOverES3 && !options.fDisableDriverCorrectnessWorkarounds && - interface->hasExtension("GL_OES_EGL_image_external") && + iface->hasExtension("GL_OES_EGL_image_external") && args.fGLSLGeneration >= SkSL::GLSLGeneration::k330 && - !interface->hasExtension("GL_OES_EGL_image_external_essl3") && - !interface->hasExtension("OES_EGL_image_external_essl3")) { + !iface->hasExtension("GL_OES_EGL_image_external_essl3") && + !iface->hasExtension("OES_EGL_image_external_essl3")) { args.fGLSLGeneration = SkSL::GLSLGeneration::k100es; } args.fContextOptions = &options; - args.fInterface = std::move(interface); + args.fInterface = std::move(iface); return std::unique_ptr(new GrGLContext(std::move(args))); } diff --git a/src/gpu/ganesh/gl/GrGLGpu.cpp b/src/gpu/ganesh/gl/GrGLGpu.cpp index a800de5d1269..726bad20b73f 100644 --- a/src/gpu/ganesh/gl/GrGLGpu.cpp +++ b/src/gpu/ganesh/gl/GrGLGpu.cpp @@ -380,7 +380,7 @@ class GrGLGpu::SamplerObjectCache { that.fID = 0; } - Sampler(GrGLuint id, const GrGLInterface* interface) : fID(id), fInterface(interface) {} + Sampler(GrGLuint id, const GrGLInterface* iface) : fID(id), fInterface(iface) {} ~Sampler() { if (fID) { @@ -412,25 +412,25 @@ class GrGLGpu::SamplerObjectCache { /////////////////////////////////////////////////////////////////////////////// -std::unique_ptr GrGLGpu::Make(sk_sp interface, +std::unique_ptr GrGLGpu::Make(sk_sp iface, const GrContextOptions& options, GrDirectContext* direct) { #if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE) - if (!interface) { - interface = GrGLMakeNativeInterface(); - if (!interface) { + if (!iface) { + iface = GrGLMakeNativeInterface(); + if (!iface) { return nullptr; } } #else - if (!interface) { + if (!iface) { return nullptr; } #endif #ifdef USE_NSIGHT const_cast(options).fSuppressPathRendering = true; #endif - auto glContext = GrGLContext::Make(std::move(interface), options); + auto glContext = GrGLContext::Make(std::move(iface), options); if (!glContext) { return nullptr; } @@ -1498,7 +1498,7 @@ static sk_sp return_null_texture() { } static GrGLTextureParameters::SamplerOverriddenState set_initial_texture_params( - const GrGLInterface* interface, + const GrGLInterface* iface, const GrGLCaps& caps, GrGLenum target) { // Some drivers like to know filter/wrap before seeing glTexImage2D. Some @@ -1509,10 +1509,10 @@ static GrGLTextureParameters::SamplerOverriddenState set_initial_texture_params( state.fMagFilter = GR_GL_NEAREST; state.fWrapS = GR_GL_CLAMP_TO_EDGE; state.fWrapT = GR_GL_CLAMP_TO_EDGE; - GR_GL_CALL(interface, TexParameteri(target, GR_GL_TEXTURE_MAG_FILTER, state.fMagFilter)); - GR_GL_CALL(interface, TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, state.fMinFilter)); - GR_GL_CALL(interface, TexParameteri(target, GR_GL_TEXTURE_WRAP_S, state.fWrapS)); - GR_GL_CALL(interface, TexParameteri(target, GR_GL_TEXTURE_WRAP_T, state.fWrapT)); + GR_GL_CALL(iface, TexParameteri(target, GR_GL_TEXTURE_MAG_FILTER, state.fMagFilter)); + GR_GL_CALL(iface, TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, state.fMinFilter)); + GR_GL_CALL(iface, TexParameteri(target, GR_GL_TEXTURE_WRAP_S, state.fWrapS)); + GR_GL_CALL(iface, TexParameteri(target, GR_GL_TEXTURE_WRAP_T, state.fWrapT)); return state; } @@ -3375,9 +3375,9 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { auto errorHandler = this->getContext()->priv().getShaderErrorHandler(); SkSL::NativeShader glsl[kGrShaderTypeCount]; SkSL::ProgramSettings settings; - SkSL::Program::Interface interface; + SkSL::Program::Interface iface; skgpu::SkSLToGLSL(shaderCaps, vertexSkSL, SkSL::ProgramKind::kVertex, settings, - &glsl[kVertex_GrShaderType], &interface, errorHandler); + &glsl[kVertex_GrShaderType], &iface, errorHandler); GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[progIdx].fProgram, GR_GL_VERTEX_SHADER, @@ -3385,7 +3385,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { /*shaderWasCached=*/false, fProgramCache->stats(), errorHandler); - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); if (!vshader) { // Just delete the program, no shaders to delete cleanup_program(this, &fCopyPrograms[progIdx].fProgram, nullptr, nullptr); @@ -3393,7 +3393,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { } skgpu::SkSLToGLSL(shaderCaps, fragmentSkSL, SkSL::ProgramKind::kFragment, settings, - &glsl[kFragment_GrShaderType], &interface, errorHandler); + &glsl[kFragment_GrShaderType], &iface, errorHandler); GrGLuint fshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[progIdx].fProgram, GR_GL_FRAGMENT_SHADER, @@ -3401,7 +3401,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { /*shaderWasCached=*/false, fProgramCache->stats(), errorHandler); - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); if (!fshader) { // Delete the program and previously compiled vertex shader cleanup_program(this, &fCopyPrograms[progIdx].fProgram, &vshader, nullptr); @@ -3559,10 +3559,10 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { auto errorHandler = this->getContext()->priv().getShaderErrorHandler(); SkSL::NativeShader glsl[kGrShaderTypeCount]; SkSL::ProgramSettings settings; - SkSL::Program::Interface interface; + SkSL::Program::Interface iface; skgpu::SkSLToGLSL(shaderCaps, vertexSkSL, SkSL::ProgramKind::kVertex, settings, - &glsl[kVertex_GrShaderType], &interface, errorHandler); + &glsl[kVertex_GrShaderType], &iface, errorHandler); GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fMipmapPrograms[progIdx].fProgram, GR_GL_VERTEX_SHADER, @@ -3570,14 +3570,14 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { /*shaderWasCached=*/false, fProgramCache->stats(), errorHandler); - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); if (!vshader) { cleanup_program(this, &fMipmapPrograms[progIdx].fProgram, nullptr, nullptr); return false; } skgpu::SkSLToGLSL(shaderCaps, fragmentSkSL, SkSL::ProgramKind::kFragment, settings, - &glsl[kFragment_GrShaderType], &interface, errorHandler); + &glsl[kFragment_GrShaderType], &iface, errorHandler); GrGLuint fshader = GrGLCompileAndAttachShader(*fGLContext, fMipmapPrograms[progIdx].fProgram, GR_GL_FRAGMENT_SHADER, @@ -3585,7 +3585,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { /*shaderWasCached=*/false, fProgramCache->stats(), errorHandler); - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); if (!fshader) { cleanup_program(this, &fMipmapPrograms[progIdx].fProgram, &vshader, nullptr); return false; diff --git a/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp index a4973a92bcc2..587237e23764 100644 --- a/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp @@ -155,8 +155,8 @@ void GrGLProgramBuilder::computeCountsAndStrides(GrGLuint programID, SkASSERT(fInstanceStride == geomProc.instanceStride()); } -void GrGLProgramBuilder::addInputVars(const SkSL::Program::Interface& interface) { - uint8_t useRTFlip = interface.fRTFlipUniform; +void GrGLProgramBuilder::addInputVars(const SkSL::Program::Interface& iface) { + uint8_t useRTFlip = iface.fRTFlipUniform; if (!this->gpu()->glCaps().shaderCaps()->fCanUseFragCoord) { useRTFlip &= ~SkSL::Program::Interface::kRTFlip_FragCoord; } @@ -170,7 +170,7 @@ static constexpr SkFourByteTag kSKSL_Tag = SkSetFourByteTag('S', 'K', 'S', 'L'); static constexpr SkFourByteTag kGLSL_Tag = SkSetFourByteTag('G', 'L', 'S', 'L'); static constexpr SkFourByteTag kGLPB_Tag = SkSetFourByteTag('G', 'L', 'P', 'B'); -void GrGLProgramBuilder::storeShaderInCache(const SkSL::Program::Interface& interface, +void GrGLProgramBuilder::storeShaderInCache(const SkSL::Program::Interface& iface, GrGLuint programID, const SkSL::NativeShader shaders[], bool isSkSL, @@ -189,7 +189,7 @@ void GrGLProgramBuilder::storeShaderInCache(const SkSL::Program::Interface& inte writer.writeInt(GrPersistentCacheUtils::GetCurrentVersion()); writer.writeUInt(kGLPB_Tag); - writer.writePad32(&interface, sizeof(interface)); + writer.writePad32(&iface, sizeof(iface)); SkAutoSMalloc<2048> binary(length); GrGLenum binaryFormat; @@ -215,7 +215,7 @@ void GrGLProgramBuilder::storeShaderInCache(const SkSL::Program::Interface& inte } auto data = GrPersistentCacheUtils::PackCachedShaders( - isSkSL ? kSKSL_Tag : kGLSL_Tag, shaders, &interface, 1, &meta); + isSkSL ? kSKSL_Tag : kGLSL_Tag, shaders, &iface, 1, &meta); this->gpu()->getContext()->priv().getPersistentCache()->store(*key, *data, description); } } @@ -251,7 +251,7 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr this->gpu()->getContext()->priv().options().fSharpenMipmappedTextures; settings.fFragColorIsInOut = this->fragColorIsInOut(); - SkSL::Program::Interface interface; + SkSL::Program::Interface iface; SkTDArray shadersToDelete; bool cached = fCached.get() != nullptr; @@ -281,7 +281,7 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr cached = false; break; } - reader.readPad32(&interface, sizeof(interface)); + reader.readPad32(&iface, sizeof(iface)); GrGLenum binaryFormat = reader.readUInt(); GrGLsizei length = reader.readInt(); const void* binary = reader.skip(length); @@ -300,7 +300,7 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr cached = GrGLCheckLinkStatus(fGpu, programID, /*shaderWasCached=*/true, /*errorHandler=*/nullptr, nullptr, nullptr); if (cached) { - this->addInputVars(interface); + this->addInputVars(iface); this->computeCountsAndStrides(programID, geomProc, false); } usedProgramBinaries = cached; @@ -310,13 +310,13 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr case kGLSL_Tag: // Source cache hit, we don't need to compile the SkSL->GLSL GrPersistentCacheUtils::UnpackCachedShaders( - &reader, glsl, /*areShadersBinary=*/false, &interface, 1); + &reader, glsl, /*areShadersBinary=*/false, &iface, 1); break; case kSKSL_Tag: // SkSL cache hit, this should only happen in tools overriding the generated SkSL if (GrPersistentCacheUtils::UnpackCachedShaders( - &reader, cached_sksl, /*areShadersBinary=*/false, &interface, 1)) { + &reader, cached_sksl, /*areShadersBinary=*/false, &iface, 1)) { for (int i = 0; i < kGrShaderTypeCount; ++i) { sksl[i] = &cached_sksl[i].fText; } @@ -349,14 +349,14 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr SkSL::ProgramKind::kFragment, settings, &glsl[kFragment_GrShaderType], - &interface, + &iface, errorHandler)) { cleanup_program(fGpu, programID, shadersToDelete); return nullptr; } } - this->addInputVars(interface); + this->addInputVars(iface); if (!this->compileAndAttachShaders(glsl[kFragment_GrShaderType], programID, GR_GL_FRAGMENT_SHADER, @@ -423,7 +423,7 @@ sk_sp GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr } isSkSL = true; } - this->storeShaderInCache(interface, programID, glsl, isSkSL, &settings); + this->storeShaderInCache(iface, programID, glsl, isSkSL, &settings); } return this->createProgram(programID); } @@ -484,9 +484,9 @@ bool GrGLProgramBuilder::PrecompileProgram(GrDirectContext* dContext, meta.fSettings = &settings; SkSL::NativeShader shaders[kGrShaderTypeCount]; - SkSL::Program::Interface interface; + SkSL::Program::Interface iface; if (!GrPersistentCacheUtils::UnpackCachedShaders( - &reader, shaders, /*areShadersBinary=*/false, &interface, 1, &meta)) { + &reader, shaders, /*areShadersBinary=*/false, &iface, 1, &meta)) { return false; } @@ -565,6 +565,6 @@ bool GrGLProgramBuilder::PrecompileProgram(GrDirectContext* dContext, cleanup_shaders(glGpu, shadersToDelete); precompiledProgram->fProgramID = programID; - precompiledProgram->fInterface = interface; + precompiledProgram->fInterface = iface; return true; } diff --git a/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp index 2c90b3d24c88..0c655341b87c 100644 --- a/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp +++ b/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp @@ -300,10 +300,10 @@ void GrGLSLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const } } -void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifier interface) { +void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifier iface) { SkASSERT(fProgramBuilder->shaderCaps()->fGLSLGeneration >= SkSL::GLSLGeneration::k330 || fProgramBuilder->shaderCaps()->mustEnableAdvBlendEqs()); - fLayoutParams[interface].push_back() = param; + fLayoutParams[iface].push_back() = param; } void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() { @@ -312,8 +312,8 @@ void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() { "out" }; - for (int interface = 0; interface <= kLastInterfaceQualifier; ++interface) { - const TArray& params = fLayoutParams[interface]; + for (int iface = 0; iface <= kLastInterfaceQualifier; ++iface) { + const TArray& params = fLayoutParams[iface]; if (params.empty()) { continue; } @@ -321,7 +321,7 @@ void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() { for (int i = 1; i < params.size(); ++i) { this->layoutQualifiers().appendf(", %s", params[i].c_str()); } - this->layoutQualifiers().appendf(") %s;\n", interfaceQualifierNames[interface]); + this->layoutQualifiers().appendf(") %s;\n", interfaceQualifierNames[iface]); } static_assert(0 == GrGLSLShaderBuilder::kIn_InterfaceQualifier); diff --git a/src/gpu/ganesh/vk/GrVkCaps.cpp b/src/gpu/ganesh/vk/GrVkCaps.cpp index 7c2465cb15aa..85d836040af2 100644 --- a/src/gpu/ganesh/vk/GrVkCaps.cpp +++ b/src/gpu/ganesh/vk/GrVkCaps.cpp @@ -744,23 +744,23 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, (uint32_t)INT_MAX); } -bool stencil_format_supported(const skgpu::VulkanInterface* interface, +bool stencil_format_supported(const skgpu::VulkanInterface* iface, VkPhysicalDevice physDev, VkFormat format) { VkFormatProperties props; memset(&props, 0, sizeof(VkFormatProperties)); - GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); + GR_VK_CALL(iface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optimalTilingFeatures); } -void GrVkCaps::initStencilFormat(const skgpu::VulkanInterface* interface, +void GrVkCaps::initStencilFormat(const skgpu::VulkanInterface* iface, VkPhysicalDevice physDev) { - if (stencil_format_supported(interface, physDev, VK_FORMAT_S8_UINT)) { + if (stencil_format_supported(iface, physDev, VK_FORMAT_S8_UINT)) { fPreferredStencilFormat = VK_FORMAT_S8_UINT; - } else if (stencil_format_supported(interface, physDev, VK_FORMAT_D24_UNORM_S8_UINT)) { + } else if (stencil_format_supported(iface, physDev, VK_FORMAT_D24_UNORM_S8_UINT)) { fPreferredStencilFormat = VK_FORMAT_D24_UNORM_S8_UINT; } else { - SkASSERT(stencil_format_supported(interface, physDev, VK_FORMAT_D32_SFLOAT_S8_UINT)); + SkASSERT(stencil_format_supported(iface, physDev, VK_FORMAT_D32_SFLOAT_S8_UINT)); fPreferredStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT; } } @@ -855,7 +855,7 @@ GrVkCaps::FormatInfo& GrVkCaps::getFormatInfo(VkFormat format) { } void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, - const skgpu::VulkanInterface* interface, + const skgpu::VulkanInterface* iface, VkPhysicalDevice physDev, const VkPhysicalDeviceProperties& properties, const VkPhysicalDeviceFeatures2& features, @@ -870,7 +870,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R8G8B8A8_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 2; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -899,7 +899,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R8_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 3; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -937,7 +937,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_B8G8R8A8_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 2; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -966,7 +966,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R5G6B5_UNORM_PACK16; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -985,7 +985,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_B5G6R5_UNORM_PACK16; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 2; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1013,7 +1013,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16G16B16A16_SFLOAT; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 3; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1049,7 +1049,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16_SFLOAT; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1070,7 +1070,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R8G8B8_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1090,7 +1090,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R8G8_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1109,7 +1109,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_A2B10G10R10_UNORM_PACK32; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 2; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1137,7 +1137,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_A2R10G10B10_UNORM_PACK32; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1163,7 +1163,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, if (rgba10x6Feature && rgba10x6Feature->formatRgba10x6WithoutYCbCrSampler) { constexpr VkFormat format = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1183,7 +1183,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_B4G4R4A4_UNORM_PACK16; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1205,7 +1205,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R4G4B4A4_UNORM_PACK16; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1224,7 +1224,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R8G8B8A8_SRGB; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1243,7 +1243,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 2; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1272,7 +1272,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16G16_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1291,7 +1291,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16G16B16A16_UNORM; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1310,7 +1310,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_R16G16_SFLOAT; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); @@ -1330,7 +1330,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, constexpr VkFormat format = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM; auto& info = this->getFormatInfo(format); if (fSupportsYcbcrConversion) { - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); } if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; @@ -1351,7 +1351,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, constexpr VkFormat format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; auto& info = this->getFormatInfo(format); if (fSupportsYcbcrConversion) { - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); } if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; @@ -1372,7 +1372,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, constexpr VkFormat format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16; auto& info = this->getFormatInfo(format); if (fSupportsYcbcrConversion) { - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); } if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { info.fColorTypeInfoCount = 1; @@ -1392,7 +1392,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); // Setting this to texel block size // No supported GrColorTypes. } @@ -1401,7 +1401,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_BC1_RGB_UNORM_BLOCK; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); // Setting this to texel block size // No supported GrColorTypes. } @@ -1410,7 +1410,7 @@ void GrVkCaps::initFormatTable(const GrContextOptions& contextOptions, { constexpr VkFormat format = VK_FORMAT_BC1_RGBA_UNORM_BLOCK; auto& info = this->getFormatInfo(format); - info.init(contextOptions, interface, physDev, properties, format); + info.init(contextOptions, iface, physDev, properties, format); // Setting this to texel block size // No supported GrColorTypes. } @@ -1472,7 +1472,7 @@ void GrVkCaps::FormatInfo::InitFormatFlags(VkFormatFeatureFlags vkFlags, uint16_ } void GrVkCaps::FormatInfo::initSampleCounts(const GrContextOptions& contextOptions, - const skgpu::VulkanInterface* interface, + const skgpu::VulkanInterface* iface, VkPhysicalDevice physDev, const VkPhysicalDeviceProperties& physProps, VkFormat format) { @@ -1481,7 +1481,7 @@ void GrVkCaps::FormatInfo::initSampleCounts(const GrContextOptions& contextOptio VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; VkImageFormatProperties properties; - GR_VK_CALL(interface, GetPhysicalDeviceImageFormatProperties(physDev, + GR_VK_CALL(iface, GetPhysicalDeviceImageFormatProperties(physDev, format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, @@ -1520,17 +1520,17 @@ void GrVkCaps::FormatInfo::initSampleCounts(const GrContextOptions& contextOptio } void GrVkCaps::FormatInfo::init(const GrContextOptions& contextOptions, - const skgpu::VulkanInterface* interface, + const skgpu::VulkanInterface* iface, VkPhysicalDevice physDev, const VkPhysicalDeviceProperties& properties, VkFormat format) { VkFormatProperties props; memset(&props, 0, sizeof(VkFormatProperties)); - GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); + GR_VK_CALL(iface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); InitFormatFlags(props.linearTilingFeatures, &fLinearFlags); InitFormatFlags(props.optimalTilingFeatures, &fOptimalFlags); if (fOptimalFlags & kRenderable_Flag) { - this->initSampleCounts(contextOptions, interface, physDev, properties, format); + this->initSampleCounts(contextOptions, iface, physDev, properties, format); } } diff --git a/src/gpu/ganesh/vk/GrVkGpu.cpp b/src/gpu/ganesh/vk/GrVkGpu.cpp index 55910cf03ec9..6bd410b42de5 100644 --- a/src/gpu/ganesh/vk/GrVkGpu.cpp +++ b/src/gpu/ganesh/vk/GrVkGpu.cpp @@ -111,16 +111,16 @@ std::unique_ptr GrVkGpu::Make(const skgpu::VulkanBackendContext& backendC uint32_t instanceVersion = 0; uint32_t physDevVersion = 0; - sk_sp interface = + sk_sp iface = skgpu::MakeInterface(backendContext, extensions, &instanceVersion, &physDevVersion); - if (!interface) { + if (!iface) { return nullptr; } sk_sp caps; if (backendContext.fDeviceFeatures2) { caps.reset(new GrVkCaps(options, - interface.get(), + iface.get(), backendContext.fPhysicalDevice, *backendContext.fDeviceFeatures2, instanceVersion, @@ -132,7 +132,7 @@ std::unique_ptr GrVkGpu::Make(const skgpu::VulkanBackendContext& backendC features2.pNext = nullptr; features2.features = *backendContext.fDeviceFeatures; caps.reset(new GrVkCaps(options, - interface.get(), + iface.get(), backendContext.fPhysicalDevice, features2, instanceVersion, @@ -143,7 +143,7 @@ std::unique_ptr GrVkGpu::Make(const skgpu::VulkanBackendContext& backendC VkPhysicalDeviceFeatures2 features; memset(&features, 0, sizeof(VkPhysicalDeviceFeatures2)); caps.reset(new GrVkCaps(options, - interface.get(), + iface.get(), backendContext.fPhysicalDevice, features, instanceVersion, @@ -174,7 +174,7 @@ std::unique_ptr GrVkGpu::Make(const skgpu::VulkanBackendContext& backendC std::unique_ptr vkGpu(new GrVkGpu(direct, backendContext, std::move(caps), - interface, + iface, instanceVersion, physDevVersion, std::move(memoryAllocator))); @@ -190,12 +190,12 @@ std::unique_ptr GrVkGpu::Make(const skgpu::VulkanBackendContext& backendC GrVkGpu::GrVkGpu(GrDirectContext* direct, const skgpu::VulkanBackendContext& backendContext, sk_sp caps, - sk_sp interface, + sk_sp iface, uint32_t instanceVersion, uint32_t physicalDeviceVersion, sk_sp memoryAllocator) : INHERITED(direct) - , fInterface(std::move(interface)) + , fInterface(std::move(iface)) , fMemoryAllocator(std::move(memoryAllocator)) , fVkCaps(std::move(caps)) , fPhysicalDevice(backendContext.fPhysicalDevice) @@ -826,9 +826,9 @@ bool GrVkGpu::uploadTexDataLinear(GrVkImage* texImage, }; VkSubresourceLayout layout; - const skgpu::VulkanInterface* interface = this->vkInterface(); + const skgpu::VulkanInterface* iface = this->vkInterface(); - GR_VK_CALL(interface, GetImageSubresourceLayout(fDevice, + GR_VK_CALL(iface, GetImageSubresourceLayout(fDevice, texImage->image(), &subres, &layout)); diff --git a/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp b/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp index 28925abf98f4..39f9609de75b 100644 --- a/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp +++ b/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp @@ -76,22 +76,22 @@ bool GrVkMSAALoadManager::createMSAALoadProgram(GrVkGpu* gpu) { SkSL::ProgramSettings settings; SkSL::NativeShader spirv; - SkSL::Program::Interface interface; + SkSL::Program::Interface iface; if (!GrCompileVkShaderModule(gpu, vertShaderText, VK_SHADER_STAGE_VERTEX_BIT, &fVertShaderModule, &fShaderStageInfo[0], settings, &spirv, - &interface)) { + &iface)) { this->destroyResources(gpu); return false; } - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); if (!GrCompileVkShaderModule(gpu, fragShaderText, VK_SHADER_STAGE_FRAGMENT_BIT, &fFragShaderModule, &fShaderStageInfo[1], settings, &spirv, - &interface)) { + &iface)) { this->destroyResources(gpu); return false; } - SkASSERT(interface == SkSL::Program::Interface()); + SkASSERT(iface == SkSL::Program::Interface()); VkDescriptorSetLayout dsLayout[GrVkUniformHandler::kDescSetCount]; diff --git a/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp index 8d822c4d7b7d..a92bec11d5f0 100644 --- a/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp +++ b/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp @@ -108,11 +108,11 @@ bool GrVkPipelineStateBuilder::installVkShaderModule(VkShaderStageFlagBits stage VkShaderModule* shaderModule, VkPipelineShaderStageCreateInfo* stageInfo, const SkSL::NativeShader& spirv, - SkSL::Program::Interface interface) { + SkSL::Program::Interface iface) { if (!GrInstallVkShaderModule(fGpu, spirv, stage, shaderModule, stageInfo)) { return false; } - if (interface.fRTFlipUniform != SkSL::Program::Interface::kRTFlip_None) { + if (iface.fRTFlipUniform != SkSL::Program::Interface::kRTFlip_None) { this->addRTFlipUniform(SKSL_RTFLIP_NAME); } return true; diff --git a/src/gpu/ganesh/vk/GrVkSemaphore.cpp b/src/gpu/ganesh/vk/GrVkSemaphore.cpp index 1488fe2573e9..3fbef405614b 100644 --- a/src/gpu/ganesh/vk/GrVkSemaphore.cpp +++ b/src/gpu/ganesh/vk/GrVkSemaphore.cpp @@ -28,8 +28,8 @@ std::unique_ptr GrVkSemaphore::Make(GrVkGpu* gpu, bool isOwned) { createInfo.flags = 0; VkSemaphore semaphore = VK_NULL_HANDLE; VkResult result; - GR_VK_CALL_RESULT(gpu, result, CreateSemaphore(gpu->device(), &createInfo, nullptr, - &semaphore)); + auto createSemaphore = gpu->vkInterface()->fFunctions.fCreateSemaphore; + result = createSemaphore(gpu->device(), &createInfo, nullptr, &semaphore); if (result != VK_SUCCESS) { return nullptr; } diff --git a/src/gpu/vk/vulkanmemoryallocator/BUILD.gn b/src/gpu/vk/vulkanmemoryallocator/BUILD.gn index 5a2d0586d226..a08e796c79cf 100644 --- a/src/gpu/vk/vulkanmemoryallocator/BUILD.gn +++ b/src/gpu/vk/vulkanmemoryallocator/BUILD.gn @@ -31,7 +31,7 @@ source_set("vulkanmemoryallocator") { ] # Warnings are just noise if we're not maintaining the code. - if (is_win) { + if (is_msvc) { cflags = [ "/w" ] } else { cflags = [ "-w" ] diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp index deaea1f48993..75bac7256fcf 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -49,6 +49,10 @@ #include #include +#if defined(__MINGW32__) +#define GetGlyphImageFormats GetGlyphImageFormats_ +#endif + namespace { static inline const constexpr bool kSkShowTextBlitCoverage = false; diff --git a/third_party/third_party.gni b/third_party/third_party.gni index cbcd16cf3891..1174cf69025f 100644 --- a/third_party/third_party.gni +++ b/third_party/third_party.gni @@ -92,7 +92,7 @@ template("third_party") { if (!defined(cflags)) { cflags = [] } - if (is_win) { + if (is_msvc) { cflags += [ "/w" ] } else { cflags += [ "-w" ]