Commit f4d2a446 by Saman Sami

Add gn files for Vulkan Swiftshader

gn files are tested on linux only. Test: * Built GL Swiftshader using ninja on Linux, Mac, and Windows. * Built and ran viz_unittests on Linux, Mac, and Windows. * Built Chromium ToT on Linux, Android, Mac. * Built Chromium + Vulkan Swiftshader on Linux by applying crrev.com/c/1615710 and ran viz_unittests with --enable-vulkan Bug: chromium:963988 Change-Id: Ic1529b8be0b508786863e03722acf610045a98ca Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31529Tested-by: 's avatarSaman Sami <samans@chromium.org> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent a453ba42
...@@ -1824,7 +1824,7 @@ if(BUILD_VULKAN) ...@@ -1824,7 +1824,7 @@ if(BUILD_VULKAN)
INCLUDE_DIRECTORIES "${VULKAN_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${VULKAN_INCLUDE_DIR}"
FOLDER "Vulkan" FOLDER "Vulkan"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}" COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
COMPILE_DEFINITIONS "NO_SANITIZE_FUNCTION=;$<$<CONFIG:Debug>:DEBUGGER_WAIT_DIALOG>" COMPILE_DEFINITIONS "VK_EXPORT=;NO_SANITIZE_FUNCTION=;$<$<CONFIG:Debug>:DEBUGGER_WAIT_DIALOG>"
PREFIX "" PREFIX ""
) )
set_shared_library_export_map(libvk_swiftshader ${SOURCE_DIR}/Vulkan) set_shared_library_export_map(libvk_swiftshader ${SOURCE_DIR}/Vulkan)
......
...@@ -70,11 +70,11 @@ ...@@ -70,11 +70,11 @@
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<UseFullPaths>false</UseFullPaths> <UseFullPaths>false</UseFullPaths>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Debug";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=;WIN32;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Debug";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)</ObjectFileName> <ObjectFileName>$(IntDir)</ObjectFileName>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Debug\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=;WIN32;_DEBUG;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Debug\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)src;$(SolutionDir)include;$(SolutionDir)third_party\llvm-7.0\configs\windows\include;$(SolutionDir)third_party\llvm-7.0\llvm\include;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\include;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\IR;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Transforms\InstCombine;$(SolutionDir)third_party\libbacktrace\src;$(SolutionDir)third_party\libbacktrace\config\windows\include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;$(SolutionDir)include;$(SolutionDir)third_party\llvm-7.0\configs\windows\include;$(SolutionDir)third_party\llvm-7.0\llvm\include;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\include;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\IR;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Transforms\InstCombine;$(SolutionDir)third_party\libbacktrace\src;$(SolutionDir)third_party\libbacktrace\config\windows\include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Midl> <Midl>
...@@ -132,13 +132,13 @@ if %errorlevel% neq 0 goto :VCEnd</Command> ...@@ -132,13 +132,13 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<UseFullPaths>false</UseFullPaths> <UseFullPaths>false</UseFullPaths>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Release";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Release";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)</ObjectFileName> <ObjectFileName>$(IntDir)</ObjectFileName>
<DebugInformationFormat> <DebugInformationFormat>
</DebugInformationFormat> </DebugInformationFormat>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Release\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=;WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Release\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)src;$(SolutionDir)include;$(SolutionDir)third_party\llvm-7.0\configs\windows\include;$(SolutionDir)third_party\llvm-7.0\llvm\include;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\include;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\IR;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Transforms\InstCombine;$(SolutionDir)third_party\libbacktrace\src;$(SolutionDir)third_party\libbacktrace\config\windows\include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;$(SolutionDir)include;$(SolutionDir)third_party\llvm-7.0\configs\windows\include;$(SolutionDir)third_party\llvm-7.0\llvm\include;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\llvm\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\include;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\IR;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\AArch64;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\ARM;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\Mips;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Target\X86;$(SolutionDir)third_party\llvm-7.0\configs\common\lib\Transforms\InstCombine;$(SolutionDir)third_party\libbacktrace\src;$(SolutionDir)third_party\libbacktrace\config\windows\include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Midl> <Midl>
...@@ -365,4 +365,4 @@ if %errorlevel% neq 0 goto :VCEnd</Command> ...@@ -365,4 +365,4 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
\ No newline at end of file
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
build_with_chromium = false
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
swiftshader_source_set("Device") {
sources = [
"Blitter.cpp",
"Blitter.hpp",
"Clipper.cpp",
"Clipper.hpp",
"Color.cpp",
"Color.hpp",
"Config.cpp",
"Config.hpp",
"Context.cpp",
"Context.hpp",
"ETC_Decoder.cpp",
"ETC_Decoder.hpp",
"Matrix.cpp",
"Matrix.hpp",
"PixelProcessor.cpp",
"PixelProcessor.hpp",
"Plane.cpp",
"Plane.hpp",
"Point.cpp",
"Point.hpp",
"QuadRasterizer.cpp",
"QuadRasterizer.hpp",
"Renderer.cpp",
"Renderer.hpp",
"SetupProcessor.cpp",
"SetupProcessor.hpp",
"SwiftConfig.cpp",
"SwiftConfig.hpp",
"Vector.cpp",
"Vector.hpp",
"VertexProcessor.cpp",
"VertexProcessor.hpp",
]
include_dirs = [
"..",
"../../include",
"../../third_party/SPIRV-Headers/include",
]
}
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
swiftshader_source_set("Pipeline") {
sources = [
"ComputeProgram.cpp",
"ComputeProgram.hpp",
"Constants.cpp",
"Constants.hpp",
"PixelProgram.cpp",
"PixelProgram.hpp",
"PixelRoutine.cpp",
"PixelRoutine.hpp",
"SamplerCore.cpp",
"SamplerCore.hpp",
"SetupRoutine.cpp",
"SetupRoutine.hpp",
"ShaderCore.cpp",
"ShaderCore.hpp",
"SpirvShader.cpp",
"SpirvShader.hpp",
"SpirvShaderSampling.cpp",
"SpirvShaderSampling.hpp",
"SpirvShader_dbg.cpp",
"SpirvShader_dbg.hpp",
"VertexProgram.cpp",
"VertexProgram.hpp",
"VertexRoutine.cpp",
"VertexRoutine.hpp",
]
include_dirs = [
"..",
"../../include",
"../../third_party/SPIRV-Headers/include",
]
}
...@@ -18,170 +18,184 @@ declare_args() { ...@@ -18,170 +18,184 @@ declare_args() {
# Subzero produces smaller binaries, but doesn't support ARM64 and MIPS64. # Subzero produces smaller binaries, but doesn't support ARM64 and MIPS64.
use_swiftshader_with_subzero = use_swiftshader_with_subzero =
target_cpu != "arm64" && target_cpu != "mips64el" target_cpu != "arm64" && target_cpu != "mips64el"
supports_llvm = is_linux || is_fuchsia || is_win || is_android
} }
# Need a separate config to ensure the warnings are added to the end. config("swiftshader_reactor_private_config") {
config("swiftshader_subzero_common_private_config") {
defines = [
"ALLOW_DUMP=0",
"ALLOW_TIMERS=0",
"ALLOW_LLVM_CL=0",
"ALLOW_LLVM_IR=0",
"ALLOW_LLVM_IR_AS_INPUT=0",
"ALLOW_MINIMAL_BUILD=0",
"ALLOW_WASM=0",
"ICE_THREAD_LOCAL_HACK=0",
]
if (is_win) { if (is_win) {
defines += [ "SUBZERO_USE_MICROSOFT_ABI" ] cflags = [
} "/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm)
if (target_cpu == "x64") {
defines += [
"SZTARGET=X8664",
"SUBZERO_TARGET=X8664",
]
} else if (target_cpu == "x86") {
defines += [
"SZTARGET=X8632",
"SUBZERO_TARGET=X8632",
]
} else if (target_cpu == "mipsel") {
defines += [
"SZTARGET=MIPS32",
"SUBZERO_TARGET=MIPS32",
] ]
} else if (target_cpu == "arm") { } else {
defines += [ cflags = [ "-Wno-unused-local-typedef" ]
"SZTARGET=ARM32", defines = [
"SUBZERO_TARGET=ARM32", "__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
] ]
if (target_cpu == "x86" || target_cpu == "x64") {
cflags += [ "-msse2" ]
}
} }
}
include_dirs = [ swiftshader_source_set("swiftshader_reactor_base") {
"../../third_party/subzero", deps = [
"../../third_party/subzero/pnacl-llvm/include/", "../OpenGL/common:swiftshader_opengl_common",
"../../third_party/llvm-subzero/include/",
] ]
if (is_win) { sources = [
include_dirs += [ "../../third_party/llvm-subzero/build/Windows/include/" ] "Debug.cpp",
} else if (is_linux) { "ExecutableMemory.cpp",
include_dirs += [ "../../third_party/llvm-subzero/build/Linux/include/" ] "Reactor.cpp",
} else if (is_fuchsia) { "Routine.cpp",
include_dirs += [ "../../third_party/llvm-subzero/build/Fuchsia/include/" ] ]
} else if (is_mac) {
include_dirs += [ "../../third_party/llvm-subzero/build/MacOS/include/" ]
}
} }
config("swiftshader_subzero_private_config") { if (use_swiftshader_with_subzero) {
cflags = [] # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_subzero_common_private_config") {
if (is_win) { defines = [
cflags += [ "ALLOW_DUMP=0",
"/wd4005", "ALLOW_TIMERS=0",
"/wd4018", "ALLOW_LLVM_CL=0",
"/wd4141", "ALLOW_LLVM_IR=0",
"/wd4146", "ALLOW_LLVM_IR_AS_INPUT=0",
"/wd4245", # conversion from int to unsigned int (llvm) "ALLOW_MINIMAL_BUILD=0",
"/wd4267", "ALLOW_WASM=0",
"/wd4291", "ICE_THREAD_LOCAL_HACK=0",
"/wd4310",
"/wd4334",
"/wd4389",
"/wd4701",
"/wd4702",
"/wd4703",
"/wd4706",
"/wd4800",
] ]
if (!is_debug) { if (is_win) {
cflags += [ "/wd4718" ] defines += [ "SUBZERO_USE_MICROSOFT_ABI" ]
} }
if (is_clang) { if (target_cpu == "x64") {
if (is_debug) { defines += [
cflags += [ "-Wno-sign-compare" ] "SZTARGET=X8664",
} "SUBZERO_TARGET=X8664",
]
} else if (target_cpu == "x86") {
defines += [
"SZTARGET=X8632",
"SUBZERO_TARGET=X8632",
]
} else if (target_cpu == "mipsel") {
defines += [
"SZTARGET=MIPS32",
"SUBZERO_TARGET=MIPS32",
]
} else if (target_cpu == "arm") {
defines += [
"SZTARGET=ARM32",
"SUBZERO_TARGET=ARM32",
]
} }
} else if (is_linux || is_mac || is_fuchsia) {
cflags += [ "-Wno-macro-redefined" ]
}
if (is_clang) { include_dirs = [
cflags += [ "../../third_party/subzero",
"-Wno-header-hygiene", "../../third_party/subzero/pnacl-llvm/include/",
"-Wno-enum-compare-switch", "../../third_party/llvm-subzero/include/",
"-Wno-unused-lambda-capture",
] ]
}
if (is_fuchsia) { if (is_win) {
cflags += [ "-Wno-error" ] include_dirs +=
[ "../../third_party/llvm-subzero/build/Windows/include/" ]
} else if (is_linux) {
include_dirs += [ "../../third_party/llvm-subzero/build/Linux/include/" ]
} else if (is_fuchsia) {
include_dirs +=
[ "../../third_party/llvm-subzero/build/Fuchsia/include/" ]
} else if (is_mac) {
include_dirs += [ "../../third_party/llvm-subzero/build/MacOS/include/" ]
}
} }
}
config("swiftshader_reactor_with_subzero_private_config") {
cflags = []
if (is_win) { config("swiftshader_subzero_private_config") {
cflags += [ cflags = []
"/wd4141",
"/wd4146",
"/wd4245", # conversion from int to unsigned int (llvm)
"/wd4267",
"/wd4291",
"/wd4309",
"/wd4702",
"/wd4800",
]
if (use_swiftshader_with_subzero) { if (is_win) {
cflags += [ cflags += [
"/wd4018", # signed/unsigned mismatch (llvm) "/wd4005",
"/wd4310", # cast truncates constant value (llvm) "/wd4018",
"/wd4141",
"/wd4146",
"/wd4245", # conversion from int to unsigned int (llvm)
"/wd4267",
"/wd4291",
"/wd4310",
"/wd4334",
"/wd4389",
"/wd4701",
"/wd4702",
"/wd4703",
"/wd4706",
"/wd4800",
] ]
if (!is_debug) {
cflags += [ "/wd4718" ]
}
if (is_clang) {
if (is_debug) {
cflags += [ "-Wno-sign-compare" ]
}
}
} else if (is_linux || is_mac || is_fuchsia) {
cflags += [ "-Wno-macro-redefined" ]
} }
if (is_clang) { if (is_clang) {
if (is_debug) { cflags += [
cflags += [ "-Wno-sign-compare" ] "-Wno-header-hygiene",
} "-Wno-enum-compare-switch",
"-Wno-unused-lambda-capture",
]
} }
}
if (is_clang) { if (is_fuchsia) {
cflags += [ "-Wno-header-hygiene" ] cflags += [ "-Wno-error" ]
}
} }
if (is_fuchsia) { config("swiftshader_reactor_with_subzero_private_config") {
cflags += [ "-Wno-error" ] cflags = []
}
}
config("swiftshader_reactor_private_config") { if (is_win) {
if (is_win) { cflags += [
cflags = [ "/wd4141",
"/wd4201", # nameless struct/union "/wd4146",
"/wd4245", # conversion from int to unsigned int (llvm) "/wd4245", # conversion from int to unsigned int (llvm)
] "/wd4267",
} else { "/wd4291",
cflags = [ "-Wno-unused-local-typedef" ] "/wd4309",
defines = [ "/wd4702",
"__STDC_CONSTANT_MACROS", "/wd4800",
"__STDC_LIMIT_MACROS", ]
]
if (target_cpu == "x86" || target_cpu == "x64") { cflags += [
cflags += [ "-msse2" ] "/wd4018", # signed/unsigned mismatch (llvm)
"/wd4310", # cast truncates constant value (llvm)
]
if (is_clang) {
if (is_debug) {
cflags += [ "-Wno-sign-compare" ]
}
}
}
if (is_clang) {
cflags += [ "-Wno-header-hygiene" ]
}
if (is_fuchsia) {
cflags += [ "-Wno-error" ]
} }
} }
}
if (use_swiftshader_with_subzero) {
swiftshader_source_set("swiftshader_subzero") { swiftshader_source_set("swiftshader_subzero") {
subzero_dir = "../../third_party/subzero" subzero_dir = "../../third_party/subzero"
subzero_llvm_dir = "../../third_party/llvm-subzero" subzero_llvm_dir = "../../third_party/llvm-subzero"
...@@ -286,24 +300,13 @@ if (use_swiftshader_with_subzero) { ...@@ -286,24 +300,13 @@ if (use_swiftshader_with_subzero) {
":swiftshader_subzero_private_config", ":swiftshader_subzero_private_config",
] ]
} }
} swiftshader_source_set("swiftshader_subzero_reactor") {
deps = [
swiftshader_source_set("swiftshader_reactor") { ":swiftshader_reactor_base",
deps = [ ":swiftshader_subzero",
"../OpenGL/common:swiftshader_opengl_common", ]
]
sources = [
"Reactor.cpp",
"Routine.cpp",
"Debug.cpp",
"ExecutableMemory.cpp",
]
if (use_swiftshader_with_subzero) {
deps += [ ":swiftshader_subzero" ]
sources += [ sources = [
"Optimizer.cpp", "Optimizer.cpp",
"SubzeroReactor.cpp", "SubzeroReactor.cpp",
] ]
...@@ -312,18 +315,22 @@ swiftshader_source_set("swiftshader_reactor") { ...@@ -312,18 +315,22 @@ swiftshader_source_set("swiftshader_reactor") {
":swiftshader_subzero_common_private_config", ":swiftshader_subzero_common_private_config",
":swiftshader_reactor_with_subzero_private_config", ":swiftshader_reactor_with_subzero_private_config",
] ]
}
}
include_dirs = [ if (supports_llvm) {
] swiftshader_source_set("swiftshader_llvm_reactor") {
} else {
llvm7_dir = "../../third_party/llvm-7.0" llvm7_dir = "../../third_party/llvm-7.0"
deps += [ "$llvm7_dir:swiftshader_llvm" ] deps = [
":swiftshader_reactor_base",
"$llvm7_dir:swiftshader_llvm",
]
sources += [ sources = [
"CPUID.cpp",
"LLVMReactor.cpp", "LLVMReactor.cpp",
"LLVMRoutine.cpp", "LLVMRoutine.cpp",
"CPUID.cpp",
] ]
configs = [ ":swiftshader_reactor_private_config" ] configs = [ ":swiftshader_reactor_private_config" ]
...@@ -346,3 +353,15 @@ swiftshader_source_set("swiftshader_reactor") { ...@@ -346,3 +353,15 @@ swiftshader_source_set("swiftshader_reactor") {
} }
} }
} }
swiftshader_source_set("swiftshader_reactor") {
if (use_swiftshader_with_subzero) {
deps = [
":swiftshader_subzero_reactor",
]
} else {
deps = [
":swiftshader_llvm_reactor",
]
}
}
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
swiftshader_source_set("System") {
sources = [
"CPUID.cpp",
"CPUID.hpp",
"Configurator.cpp",
"Configurator.hpp",
"Debug.cpp",
"Debug.hpp",
"Half.cpp",
"Half.hpp",
"Math.cpp",
"Math.hpp",
"Memory.cpp",
"Memory.hpp",
"Resource.cpp",
"Resource.hpp",
"Socket.cpp",
"Socket.hpp",
"Thread.cpp",
"Thread.hpp",
"Timer.cpp",
"Timer.hpp",
]
include_dirs = [ ".." ]
}
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("../swiftshader.gni")
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libvulkan_private_config") {
defines = [
"VK_USE_PLATFORM_XLIB_KHR",
"VK_EXPORT=__attribute__((visibility(\"default\")))",
]
cflags = [
"-Wno-unused-private-field",
"-Wno-switch",
]
}
swiftshader_shared_library("swiftshader_libvulkan") {
sources = [
"Version.h",
"VkBuffer.cpp",
"VkBuffer.hpp",
"VkBufferView.cpp",
"VkBufferView.hpp",
"VkCommandBuffer.cpp",
"VkCommandBuffer.hpp",
"VkCommandPool.cpp",
"VkCommandPool.hpp",
"VkConfig.h",
"VkDebug.cpp",
"VkDebug.hpp",
"VkDescriptorPool.cpp",
"VkDescriptorPool.hpp",
"VkDescriptorSet.hpp",
"VkDescriptorSetLayout.cpp",
"VkDescriptorSetLayout.hpp",
"VkDescriptorUpdateTemplate.cpp",
"VkDescriptorUpdateTemplate.hpp",
"VkDestroy.h",
"VkDevice.cpp",
"VkDevice.hpp",
"VkDeviceMemory.cpp",
"VkDeviceMemory.hpp",
"VkEvent.hpp",
"VkFence.hpp",
"VkFormat.cpp",
"VkFormat.h",
"VkFramebuffer.cpp",
"VkFramebuffer.hpp",
"VkGetProcAddress.cpp",
"VkGetProcAddress.h",
"VkImage.cpp",
"VkImage.hpp",
"VkImageView.cpp",
"VkImageView.hpp",
"VkInstance.cpp",
"VkInstance.hpp",
"VkMemory.cpp",
"VkMemory.h",
"VkObject.hpp",
"VkPhysicalDevice.cpp",
"VkPhysicalDevice.hpp",
"VkPipeline.cpp",
"VkPipeline.hpp",
"VkPipelineCache.cpp",
"VkPipelineCache.hpp",
"VkPipelineLayout.cpp",
"VkPipelineLayout.hpp",
"VkPromotedExtensions.cpp",
"VkQueryPool.cpp",
"VkQueryPool.hpp",
"VkQueue.cpp",
"VkQueue.hpp",
"VkRenderPass.cpp",
"VkRenderPass.hpp",
"VkSampler.cpp",
"VkSampler.hpp",
"VkSemaphore.hpp",
"VkShaderModule.cpp",
"VkShaderModule.hpp",
"Vulkan.rc",
"VulkanPlatform.h",
"libVulkan.cpp",
"libvk_swiftshader.def",
"libvk_swiftshader.lds",
"main.cpp",
"resource.h",
]
configs = [ ":swiftshader_libvulkan_private_config" ]
output_name = "libvulkan"
output_dir = "$root_out_dir/swiftshader"
ldflags = [ "-Wl,--version-script=" +
rebase_path("libvk_swiftshader.lds", root_build_dir) ]
deps = [
"../Device",
"../Pipeline",
"../Reactor:swiftshader_llvm_reactor",
"../System",
"../WSI",
]
include_dirs = [
"..",
"../../include",
"../../third_party/SPIRV-Headers/include",
]
if (build_with_chromium) {
deps += [ "//third_party/SPIRV-Tools/src:SPIRV-Tools" ]
include_dirs += [ "//third_party/SPIRV-Tools/src/include" ]
} else {
deps += [ "../../third_party/SPIRV-Tools" ]
include_dirs += [ "../../third_party/SPIRV-Tools/include" ]
}
}
...@@ -342,7 +342,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice ...@@ -342,7 +342,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice
*pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties(); *pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties();
} }
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName) VK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName)
{ {
TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName); TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName);
......
{ {
global: global:
vkGetInstanceProcAddr;
# Loader-ICD interface functions # Loader-ICD interface functions
vk_icdGetInstanceProcAddr; vk_icdGetInstanceProcAddr;
vk_icdNegotiateLoaderICDInterfaceVersion; vk_icdNegotiateLoaderICDInterfaceVersion;
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions>
<TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors> <TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors>
...@@ -88,7 +88,7 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy ...@@ -88,7 +88,7 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)include;$(SolutionDir)third_party\SPIRV-Headers\include;$(SolutionDir)third_party\SPIRV-Tools\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DEBUGGER_WAIT_DIALOG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>VK_EXPORT=;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DEBUGGER_WAIT_DIALOG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions>
<TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors> <TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors>
...@@ -309,4 +309,4 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy ...@@ -309,4 +309,4 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
\ No newline at end of file
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../swiftshader.gni")
swiftshader_source_set("WSI") {
sources = [
"VkSurfaceKHR.cpp",
"VkSurfaceKHR.hpp",
"VkSwapchainKHR.cpp",
"VkSwapchainKHR.hpp",
"XlibSurfaceKHR.cpp",
"XlibSurfaceKHR.hpp",
"libX11.cpp",
"libX11.hpp",
]
include_dirs = [
"..",
"../../include",
"../../third_party/SPIRV-Headers/include",
]
}
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "Vulkan/VkImage.hpp" #include "Vulkan/VkImage.hpp"
#include "libX11.hpp" #include "libX11.hpp"
#include "VkSurfaceKHR.hpp" #include "VkSurfaceKHR.hpp"
#include "vulkan/vulkan_xlib.h"
#include <map> #include <map>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment