diff --git a/BUILD.public b/BUILD.public index d20eb235ee..b184f726f1 100644 --- a/BUILD.public +++ b/BUILD.public @@ -84,6 +84,8 @@ BASE_SRCS_UNIX = glob( # Included in :opts_sse4 library. "src/opts/*SSE4*", "src/opts/*sse4*", + # Included in :opts_avx or :opts_avx2 + "src/opts/*avx*", "src/opts/SkBitmapProcState_opts_none.cpp", "src/opts/SkBlitMask_opts_none.cpp", "src/opts/SkBlitRow_opts_none.cpp", @@ -123,6 +125,7 @@ BASE_SRCS_ANDROID = glob( "src/opts/*ssse3*", "src/opts/*SSE4*", "src/opts/*sse4*", + "src/opts/*avx*", "src/opts/*x86*", "src/opts/SkBitmapProcState_opts_none.cpp", "src/opts/SkBlitMask_opts_none.cpp", @@ -165,6 +168,7 @@ BASE_SRCS_IOS = glob( "src/opts/*ssse3*", "src/opts/*SSE4*", "src/opts/*sse4*", + "src/opts/*avx*", "src/opts/*x86*", "src/opts/SkBitmapProcState_opts_none.cpp", "src/opts/SkBlitMask_opts_none.cpp", @@ -212,6 +216,18 @@ SSE4_SRCS = glob( ], ) +AVX_SRCS = glob( + [ + "src/opts/*_avx.cpp", + ], +) + +AVX2_SRCS = glob( + [ + "src/opts/*_avx2.cpp", + ], +) + BASE_HDRS = glob( [ "include/**/*.h", @@ -229,6 +245,8 @@ BASE_HDRS = glob( # Dependencies. BASE_DEPS_UNIX = [ + ":opts_avx2", + ":opts_avx", ":opts_sse4", ":opts_ssse3", ] @@ -424,6 +442,24 @@ cc_library( deps = EXTERNAL_DEPS_ALL, ) +cc_library( + name = "opts_avx", + srcs = AVX_SRCS, + copts = COPTS + ["-mavx"], + defines = DEFINES, + includes = INCLUDES, + deps = EXTERNAL_DEPS_ALL, +) + +cc_library( + name = "opts_avx2", + srcs = AVX2_SRCS, + copts = COPTS + ["-mavx2"], + defines = DEFINES, + includes = INCLUDES, + deps = EXTERNAL_DEPS_ALL, +) + # If you need Ganesh (GPU) support in Skia, please contact skia-team@google.com # for help. cc_library( diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 2de051b3fc..fcbce4ff5c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -114,11 +114,15 @@ endif() remove_srcs(../src/gpu/gl/angle/*) # TODO remove_srcs(../src/codec/* ../src/android/*) # TODO: Requires Chromium's libjpeg-turbo, and incompatible giflib. -# Certain files must be compiled with support for SSSE3 or SSE4.1 intrinsics. +# Certain files must be compiled with support for SSSE3, SSE4.1, AVX, or AVX2 intrinsics. file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp) file (GLOB_RECURSE sse41_srcs ../src/*sse4*.cpp ../src/*SSE4*.cpp) +file (GLOB_RECURSE avx_srcs ../src/*_avx.cpp) +file (GLOB_RECURSE avx2_srcs ../src/*_avx2.cpp) set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3) set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1) +set_source_files_properties(${avx_srcs} PROPERTIES COMPILE_FLAGS -mavx) +set_source_files_properties(${avx2_srcs} PROPERTIES COMPILE_FLAGS -mavx2) # Detect our optional dependencies. # If we can't find them, don't build the parts of Skia that use them.