Fix Visual Studio build of VulkanUnitTests
- Make VulkanUnitTests depend on SPIRV-Tools.
- Build Vulkan DLLs but don't link statically with VulkanUnitTests.
- Don't use Unicode character set.
- Statically link runtime library.
- Fix narrowing conversion from 'VkCommandBufferUsageFlagBits' to
'VkCommandBufferUsageFlags'.
Bug swiftshader:125
Change-Id: I7dbdc25c829cc76b5e05cd57cd9f85bf2d4e0903
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26948
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/SwiftShader.sln b/SwiftShader.sln
index 2cc35c1..6ac7b82 100644
--- a/SwiftShader.sln
+++ b/SwiftShader.sln
@@ -258,13 +258,16 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vulkan", "src\Vulkan\vulkan.vcxproj", "{E1C34B66-C942-4B9A-B8C3-9A12625650D3}"
ProjectSection(ProjectDependencies) = postProject
- {6ABDA7CD-3BBA-3190-AE38-B0BBE6CB9327} = {6ABDA7CD-3BBA-3190-AE38-B0BBE6CB9327}
{EF1AF598-E402-38F1-A74A-35F18A1EC1CC} = {EF1AF598-E402-38F1-A74A-35F18A1EC1CC}
+ {6ABDA7CD-3BBA-3190-AE38-B0BBE6CB9327} = {6ABDA7CD-3BBA-3190-AE38-B0BBE6CB9327}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactorUnitTests", "src\Reactor\ReactorUnitTests.vcxproj", "{4EC107AB-89E8-4A0B-8366-B3E81085AE07}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VulkanUnitTests", "tests\VulkanUnitTests\VulkanUnitTests.vcxproj", "{16E1EBC1-BB6B-4A82-A1A3-5A69AC8D58FE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {E1C34B66-C942-4B9A-B8C3-9A12625650D3} = {E1C34B66-C942-4B9A-B8C3-9A12625650D3}
+ EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SPIRV-Tools", "SPIRV-Tools", "{ABF69E39-C15E-4DAC-A27E-3480DE2C0CF0}"
EndProject
diff --git a/tests/VulkanUnitTests/Device.cpp b/tests/VulkanUnitTests/Device.cpp
index 1fcc8b8..fd2ad95 100644
--- a/tests/VulkanUnitTests/Device.cpp
+++ b/tests/VulkanUnitTests/Device.cpp
@@ -358,7 +358,7 @@
}
VkResult Device::BeginCommandBuffer(
- VkCommandBufferUsageFlagBits usage, VkCommandBuffer commandBuffer) const
+ VkCommandBufferUsageFlags usage, VkCommandBuffer commandBuffer) const
{
VkCommandBufferBeginInfo info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType
diff --git a/tests/VulkanUnitTests/Device.hpp b/tests/VulkanUnitTests/Device.hpp
index a235f61..f38ce9f 100644
--- a/tests/VulkanUnitTests/Device.hpp
+++ b/tests/VulkanUnitTests/Device.hpp
@@ -101,7 +101,7 @@
VkResult AllocateCommandBuffer(VkCommandPool pool, VkCommandBuffer* out) const;
// BeginCommandBuffer begins writing to commandBuffer.
- VkResult BeginCommandBuffer(VkCommandBufferUsageFlagBits usage, VkCommandBuffer commandBuffer) const;
+ VkResult BeginCommandBuffer(VkCommandBufferUsageFlags usage, VkCommandBuffer commandBuffer) const;
// QueueSubmitAndWait submits the given command buffer and waits for it to
// complete.
diff --git a/tests/VulkanUnitTests/VulkanUnitTests.vcxproj b/tests/VulkanUnitTests/VulkanUnitTests.vcxproj
index 460c99a..92cddba 100644
--- a/tests/VulkanUnitTests/VulkanUnitTests.vcxproj
+++ b/tests/VulkanUnitTests/VulkanUnitTests.vcxproj
@@ -21,14 +21,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -67,6 +67,7 @@
</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors>
<AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -88,6 +89,7 @@
</ForcedIncludeFiles>
<TreatSpecificWarningsAsErrors>4018;5038;4838</TreatSpecificWarningsAsErrors>
<AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -104,16 +106,16 @@
<ClCompile Include="unittests.cpp" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\src\Vulkan\vulkan.vcxproj">
- <Project>{e1c34b66-c942-4b9a-b8c3-9a12625650d3}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<ClInclude Include="Device.hpp" />
<ClInclude Include="Driver.hpp" />
<ClInclude Include="VkGlobalFuncs.hpp" />
<ClInclude Include="VkInstanceFuncs.hpp" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\build\Visual Studio 15 2017 Win64\third_party\SPIRV-Tools\source\SPIRV-Tools.vcxproj">
+ <Project>{ef1af598-e402-38f1-a74a-35f18a1ec1cc}</Project>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/tests/VulkanUnitTests/VulkanUnitTests.vcxproj.filters b/tests/VulkanUnitTests/VulkanUnitTests.vcxproj.filters
index ea4f8f0..a61ecbe 100644
--- a/tests/VulkanUnitTests/VulkanUnitTests.vcxproj.filters
+++ b/tests/VulkanUnitTests/VulkanUnitTests.vcxproj.filters
@@ -27,6 +27,9 @@
<ClCompile Include="Driver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Device.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Driver.hpp">
@@ -38,5 +41,8 @@
<ClInclude Include="VkInstanceFuncs.hpp">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="Device.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file