Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f4d2a44

Browse files
author
Saman Sami
committed
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/+/31529 Tested-by: Saman Sami <samans@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
1 parent a453ba4 commit f4d2a44

13 files changed

Lines changed: 514 additions & 161 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ if(BUILD_VULKAN)
18241824
INCLUDE_DIRECTORIES "${VULKAN_INCLUDE_DIR}"
18251825
FOLDER "Vulkan"
18261826
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
1827-
COMPILE_DEFINITIONS "NO_SANITIZE_FUNCTION=;$<$<CONFIG:Debug>:DEBUGGER_WAIT_DIALOG>"
1827+
COMPILE_DEFINITIONS "VK_EXPORT=;NO_SANITIZE_FUNCTION=;$<$<CONFIG:Debug>:DEBUGGER_WAIT_DIALOG>"
18281828
PREFIX ""
18291829
)
18301830
set_shared_library_export_map(libvk_swiftshader ${SOURCE_DIR}/Vulkan)

build/Visual Studio 15 2017 Win64/libvk_swiftshader.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
<RuntimeTypeInfo>true</RuntimeTypeInfo>
7171
<UseFullPaths>false</UseFullPaths>
7272
<WarningLevel>Level3</WarningLevel>
73-
<PreprocessorDefinitions>WIN32;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Debug";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
73+
<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>
7474
<ObjectFileName>$(IntDir)</ObjectFileName>
7575
</ClCompile>
7676
<ResourceCompile>
77-
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Debug\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
77+
<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>
7878
<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>
7979
</ResourceCompile>
8080
<Midl>
@@ -132,13 +132,13 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
132132
<RuntimeTypeInfo>true</RuntimeTypeInfo>
133133
<UseFullPaths>false</UseFullPaths>
134134
<WarningLevel>Level3</WarningLevel>
135-
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR="Release";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
135+
<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>
136136
<ObjectFileName>$(IntDir)</ObjectFileName>
137137
<DebugInformationFormat>
138138
</DebugInformationFormat>
139139
</ClCompile>
140140
<ResourceCompile>
141-
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;NO_SANITIZE_FUNCTION=;_CRT_SECURE_NO_WARNINGS;_SBCS;WINVER=0x501;NOMINMAX;STRICT;CMAKE_INTDIR=\"Release\";libvk_swiftshader_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
141+
<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>
142142
<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>
143143
</ResourceCompile>
144144
<Midl>
@@ -365,4 +365,4 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
365365
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
366366
<ImportGroup Label="ExtensionTargets">
367367
</ImportGroup>
368-
</Project>
368+
</Project>

build_overrides/build.gni

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
build_with_chromium = false

src/Device/BUILD.gn

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("../swiftshader.gni")
16+
17+
swiftshader_source_set("Device") {
18+
sources = [
19+
"Blitter.cpp",
20+
"Blitter.hpp",
21+
"Clipper.cpp",
22+
"Clipper.hpp",
23+
"Color.cpp",
24+
"Color.hpp",
25+
"Config.cpp",
26+
"Config.hpp",
27+
"Context.cpp",
28+
"Context.hpp",
29+
"ETC_Decoder.cpp",
30+
"ETC_Decoder.hpp",
31+
"Matrix.cpp",
32+
"Matrix.hpp",
33+
"PixelProcessor.cpp",
34+
"PixelProcessor.hpp",
35+
"Plane.cpp",
36+
"Plane.hpp",
37+
"Point.cpp",
38+
"Point.hpp",
39+
"QuadRasterizer.cpp",
40+
"QuadRasterizer.hpp",
41+
"Renderer.cpp",
42+
"Renderer.hpp",
43+
"SetupProcessor.cpp",
44+
"SetupProcessor.hpp",
45+
"SwiftConfig.cpp",
46+
"SwiftConfig.hpp",
47+
"Vector.cpp",
48+
"Vector.hpp",
49+
"VertexProcessor.cpp",
50+
"VertexProcessor.hpp",
51+
]
52+
53+
include_dirs = [
54+
"..",
55+
"../../include",
56+
"../../third_party/SPIRV-Headers/include",
57+
]
58+
}

src/Pipeline/BUILD.gn

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("../swiftshader.gni")
16+
17+
swiftshader_source_set("Pipeline") {
18+
sources = [
19+
"ComputeProgram.cpp",
20+
"ComputeProgram.hpp",
21+
"Constants.cpp",
22+
"Constants.hpp",
23+
"PixelProgram.cpp",
24+
"PixelProgram.hpp",
25+
"PixelRoutine.cpp",
26+
"PixelRoutine.hpp",
27+
"SamplerCore.cpp",
28+
"SamplerCore.hpp",
29+
"SetupRoutine.cpp",
30+
"SetupRoutine.hpp",
31+
"ShaderCore.cpp",
32+
"ShaderCore.hpp",
33+
"SpirvShader.cpp",
34+
"SpirvShader.hpp",
35+
"SpirvShaderSampling.cpp",
36+
"SpirvShaderSampling.hpp",
37+
"SpirvShader_dbg.cpp",
38+
"SpirvShader_dbg.hpp",
39+
"VertexProgram.cpp",
40+
"VertexProgram.hpp",
41+
"VertexRoutine.cpp",
42+
"VertexRoutine.hpp",
43+
]
44+
45+
include_dirs = [
46+
"..",
47+
"../../include",
48+
"../../third_party/SPIRV-Headers/include",
49+
]
50+
}

0 commit comments

Comments
 (0)