Commit 51b2800b by Nicolas Capens Committed by Nicolas Capens

Support launching PowerVR samples from Visual Studio using SwiftShader

On Windows placing the vulkan-1.dll next to the executables suffices for them to load SwiftShader instead of the system's Vulkan ICD loader (if present). Also make warnings-as-errors only affect our own projects, and put things into project folders. Bug: b/141361933 Change-Id: Ibdf8bcb992aa484d4bebaaf52ae77a8ced61709a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40788 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent a095711c
...@@ -252,7 +252,6 @@ if (SWIFTSHADER_BUILD_PVR) ...@@ -252,7 +252,6 @@ if (SWIFTSHADER_BUILD_PVR)
execute_process(COMMAND git submodule update --init ${CMAKE_CURRENT_SOURCE_DIR}/third_party/PowerVR_Examples) execute_process(COMMAND git submodule update --init ${CMAKE_CURRENT_SOURCE_DIR}/third_party/PowerVR_Examples)
endif() endif()
set(PVR_BUILD_EXAMPLES ON CACHE BOOL "Build the PowerVR SDK Examples" FORCE) set(PVR_BUILD_EXAMPLES ON CACHE BOOL "Build the PowerVR SDK Examples" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/PowerVR_Examples)
endif() endif()
########################################################### ###########################################################
...@@ -379,7 +378,9 @@ if(MSVC) ...@@ -379,7 +378,9 @@ if(MSVC)
set_cpp_flag("/DEBUG:FASTLINK" RELWITHDEBINFO) set_cpp_flag("/DEBUG:FASTLINK" RELWITHDEBINFO)
if(SWIFTSHADER_WARNINGS_AS_ERRORS) if(SWIFTSHADER_WARNINGS_AS_ERRORS)
set_cpp_flag("/WX") # Treat all warnings as errors list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"/WX" # Treat all warnings as errors
)
endif() endif()
# Disable specific warnings # Disable specific warnings
...@@ -409,7 +410,9 @@ if(MSVC) ...@@ -409,7 +410,9 @@ if(MSVC)
"/we5038" # data member 'member1' will be initialized after data member 'member2' data member 'member' will be initialized after base class 'base_class' "/we5038" # data member 'member1' will be initialized after data member 'member2' data member 'member' will be initialized after base class 'base_class'
) )
else() else()
set_cpp_flag("-fno-exceptions") list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-fno-exceptions"
)
# Explicitly enable these warnings. # Explicitly enable these warnings.
list(APPEND SWIFTSHADER_COMPILE_OPTIONS list(APPEND SWIFTSHADER_COMPILE_OPTIONS
...@@ -509,7 +512,7 @@ else() ...@@ -509,7 +512,7 @@ else()
endif() endif()
if(SWIFTSHADER_WARNINGS_AS_ERRORS) if(SWIFTSHADER_WARNINGS_AS_ERRORS)
set_cpp_flag("-Werror") # Treat all warnings as errors list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-Werror") # Treat all warnings as errors
endif() endif()
if(SWIFTSHADER_DCHECK_ALWAYS_ON) if(SWIFTSHADER_DCHECK_ALWAYS_ON)
...@@ -1622,7 +1625,6 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero") ...@@ -1622,7 +1625,6 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero")
file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST
${SUBZERO_LLVM_DIR}/*.cpp ${SUBZERO_LLVM_DIR}/*.cpp
${SUBZERO_LLVM_DIR}/*.c
${SUBZERO_LLVM_DIR}/*.h ${SUBZERO_LLVM_DIR}/*.h
) )
...@@ -2158,6 +2160,12 @@ if(SWIFTSHADER_BUILD_VULKAN) ...@@ -2158,6 +2160,12 @@ if(SWIFTSHADER_BUILD_VULKAN)
list(APPEND VULKAN_INCLUDE_DIR "${SPIRV-Headers_SOURCE_DIR}/include") list(APPEND VULKAN_INCLUDE_DIR "${SPIRV-Headers_SOURCE_DIR}/include")
add_subdirectory(third_party/SPIRV-Tools) add_subdirectory(third_party/SPIRV-Tools)
set_target_properties(core_tables PROPERTIES FOLDER "SPIRV-Tools build")
set_target_properties(enum_string_mapping PROPERTIES FOLDER "SPIRV-Tools build")
set_target_properties(extinst_tables PROPERTIES FOLDER "SPIRV-Tools build")
set_target_properties(spirv-tools-pkg-config PROPERTIES FOLDER "SPIRV-Tools build")
set_target_properties(spirv-tools-shared-pkg-config PROPERTIES FOLDER "SPIRV-Tools build")
endif() endif()
# Copy the OpenCLDebugInfo100.h header that's generated by SPIRV-Tools # Copy the OpenCLDebugInfo100.h header that's generated by SPIRV-Tools
...@@ -2171,6 +2179,7 @@ if(SWIFTSHADER_BUILD_VULKAN) ...@@ -2171,6 +2179,7 @@ if(SWIFTSHADER_BUILD_VULKAN)
${spirv-tools_BINARY_DIR}/OpenCLDebugInfo100.h ${spirv-tools_BINARY_DIR}/OpenCLDebugInfo100.h
${SPIRV_TOOLS_EXT_INC_DIR}/spirv-tools/ext/OpenCLDebugInfo100.h ${SPIRV_TOOLS_EXT_INC_DIR}/spirv-tools/ext/OpenCLDebugInfo100.h
) )
set_target_properties(spirv_tools_ext_includes PROPERTIES FOLDER "SPIRV-Tools build")
list(APPEND VULKAN_INCLUDE_DIR "${SPIRV_TOOLS_EXT_INC_DIR}") list(APPEND VULKAN_INCLUDE_DIR "${SPIRV_TOOLS_EXT_INC_DIR}")
add_dependencies(vk_swiftshader spirv_tools_ext_includes) add_dependencies(vk_swiftshader spirv_tools_ext_includes)
...@@ -2402,3 +2411,111 @@ if(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN) ...@@ -2402,3 +2411,111 @@ if(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN)
target_link_libraries(vk-unittests ${OS_LIBS} SPIRV-Tools) target_link_libraries(vk-unittests ${OS_LIBS} SPIRV-Tools)
endif(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN) endif(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN)
if(SWIFTSHADER_BUILD_PVR)
if(UNIX AND NOT APPLE)
set(PVR_WINDOW_SYSTEM XCB)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/PowerVR_Examples)
if(WIN32)
# Copy the 'loader' library to the bin/ directory
# where the PowerVR executables are placed.
add_custom_command(
TARGET vk_swiftshader
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:vk_swiftshader> ${CMAKE_BINARY_DIR}/bin/${VULKAN_API_LIBRARY_NAME}
)
endif()
# Samples known to work well
set(PVR_VULKAN_TARGET_GOOD
VulkanBumpmap
VulkanGlass
VulkanGnomeHorde
VulkanHelloAPI
VulkanImageBasedLighting
VulkanMultiSampling
VulkanSkinning
)
set(PVR_VULKAN_TARGET_OTHER
VulkanDeferredShading
VulkanDeferredShadingPFX
VulkanExampleUI
VulkanGameOfLife
VulkanGaussianBlur
VulkanIBLMapsGenerator
VulkanIMGTextureFilterCubic
VulkanIntroducingPVRShell
VulkanIntroducingPVRUtils
VulkanIntroducingPVRVk
VulkanIntroducingUIRenderer
VulkanMultithreading
VulkanNavigation2D
VulkanNavigation3D
VulkanParticleSystem
VulkanPostProcessing
VulkanPVRScopeExample
VulkanPVRScopeRemote
)
set(PVR_TARGET_OTHER
glslang
glslangValidator
glslang-default-resource-limits
OGLCompiler
OSDependent
OpenCLMatrixMultiplication
OpenGLESDeferredShading
OpenGLESGaussianBlur
OpenGLESHelloAPI
OpenGLESImageBasedLighting
OpenGLESIMGFramebufferDownsample
OpenGLESIMGTextureFilterCubic
OpenGLESIntroducingPVRCamera
OpenGLESIntroducingPVRShell
OpenGLESIntroducingPVRUtils
OpenGLESIntroducingUIRenderer
OpenGLESMultiviewVR
OpenGLESNavigation2D
OpenGLESNavigation3D
OpenGLESOpenCLExample
OpenGLESParticleSystem
OpenGLESPostProcessing
OpenGLESPVRScopeExample
OpenGLESPVRScopeRemote
OpenGLESSkinning
pugixml
PVRAssets
PVRCamera
PVRCore
PVRPfx
PVRShell
PVRUtilsGles
PVRUtilsVk
PVRVk
SPIRV
spirv-remap
SPVRemapper
uninstall
)
set(PVR_VULKAN_TARGET
${PVR_VULKAN_TARGET_GOOD}
${PVR_VULKAN_TARGET_OTHER}
)
foreach(pvr_target ${PVR_VULKAN_TARGET})
add_dependencies(${pvr_target} vk_swiftshader)
endforeach()
foreach(pvr_target ${PVR_VULKAN_TARGET_GOOD})
set_target_properties(${pvr_target} PROPERTIES FOLDER Samples)
endforeach()
foreach(pvr_target ${PVR_TARGET_OTHER} ${PVR_VULKAN_TARGET_OTHER})
set_target_properties(${pvr_target} PROPERTIES FOLDER Samples/PowerVR-Build)
endforeach()
endif()
\ No newline at end of file
...@@ -10,7 +10,13 @@ ...@@ -10,7 +10,13 @@
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "-v", "buildCommandArgs": "-v",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"variables": [] "variables": [
{
"name": "REACTOR_BACKEND",
"value": "Subzero",
"type": "STRING"
}
]
}, },
{ {
"name": "x86-Debug", "name": "x86-Debug",
...@@ -46,7 +52,18 @@ ...@@ -46,7 +52,18 @@
"buildCommandArgs": "-v", "buildCommandArgs": "-v",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [] "variables": [
{
"name": "SWIFTSHADER_BUILD_PVR",
"value": "True",
"type": "BOOL"
},
{
"name": "REACTOR_BACKEND",
"value": "Subzero",
"type": "STRING"
}
]
} }
] ]
} }
\ No newline at end of file
...@@ -265,11 +265,11 @@ if (use_swiftshader_with_subzero) { ...@@ -265,11 +265,11 @@ if (use_swiftshader_with_subzero) {
"$subzero_llvm_dir/lib/Support/circular_raw_ostream.cpp", "$subzero_llvm_dir/lib/Support/circular_raw_ostream.cpp",
"$subzero_llvm_dir/lib/Support/raw_os_ostream.cpp", "$subzero_llvm_dir/lib/Support/raw_os_ostream.cpp",
"$subzero_llvm_dir/lib/Support/raw_ostream.cpp", "$subzero_llvm_dir/lib/Support/raw_ostream.cpp",
"$subzero_llvm_dir/lib/Support/regcomp.c", "$subzero_llvm_dir/lib/Support/regcomp.cpp",
"$subzero_llvm_dir/lib/Support/regerror.c", "$subzero_llvm_dir/lib/Support/regerror.cpp",
"$subzero_llvm_dir/lib/Support/regexec.c", "$subzero_llvm_dir/lib/Support/regexec.cpp",
"$subzero_llvm_dir/lib/Support/regfree.c", "$subzero_llvm_dir/lib/Support/regfree.cpp",
"$subzero_llvm_dir/lib/Support/regstrlcpy.c", "$subzero_llvm_dir/lib/Support/regstrlcpy.cpp",
] ]
if (current_cpu == "x64") { if (current_cpu == "x64") {
......
...@@ -174,12 +174,12 @@ ...@@ -174,12 +174,12 @@
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Program.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Program.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\raw_ostream.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\raw_ostream.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\raw_os_ostream.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\raw_os_ostream.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regcomp.c" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regcomp.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regerror.c" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regerror.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Regex.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Regex.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regexec.c" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regexec.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regfree.c" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regfree.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regstrlcpy.c" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regstrlcpy.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Signals.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\Signals.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\SmallPtrSet.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\SmallPtrSet.cpp" />
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\SmallVector.cpp" /> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\SmallVector.cpp" />
......
...@@ -138,19 +138,19 @@ ...@@ -138,19 +138,19 @@
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\NativeFormatting.cpp"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\NativeFormatting.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regerror.c"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regerror.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regfree.c"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regfree.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regstrlcpy.c"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regstrlcpy.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regcomp.c"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regcomp.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regexec.c"> <ClCompile Include="..\..\third_party\llvm-subzero\lib\Support\regexec.cpp">
<Filter>Source Files\Support</Filter> <Filter>Source Files\Support</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
#include "VkBuffer.hpp" #include "VkBuffer.hpp"
#include "VkDevice.hpp" #include "VkDevice.hpp"
#include "VkDeviceMemory.hpp" #include "VkDeviceMemory.hpp"
#include "Device/ASTC_Decoder.hpp"
#include "Device/BC_Decoder.hpp" #include "Device/BC_Decoder.hpp"
#include "Device/Blitter.hpp" #include "Device/Blitter.hpp"
#include "Device/ETC_Decoder.hpp" #include "Device/ETC_Decoder.hpp"
#include "Device/ASTC_Decoder.hpp"
#ifdef __ANDROID__ #ifdef __ANDROID__
# include "System/GrallocAndroid.hpp" # include "System/GrallocAndroid.hpp"
......
Subproject commit c1605c99281797e5cd4c8439e1bc679706bbb311 Subproject commit f42d5525ae2775c6faf13f4b224d81a5ecd290d0
...@@ -59,12 +59,12 @@ cc_library_static { ...@@ -59,12 +59,12 @@ cc_library_static {
"lib/Support/Program.cpp", "lib/Support/Program.cpp",
"lib/Support/raw_os_ostream.cpp", "lib/Support/raw_os_ostream.cpp",
"lib/Support/raw_ostream.cpp", "lib/Support/raw_ostream.cpp",
"lib/Support/regcomp.c", "lib/Support/regcomp.cpp",
"lib/Support/regerror.c", "lib/Support/regerror.cpp",
"lib/Support/Regex.cpp", "lib/Support/Regex.cpp",
"lib/Support/regexec.c", "lib/Support/regexec.cpp",
"lib/Support/regfree.c", "lib/Support/regfree.cpp",
"lib/Support/regstrlcpy.c", "lib/Support/regstrlcpy.cpp",
"lib/Support/Signals.cpp", "lib/Support/Signals.cpp",
"lib/Support/SmallPtrSet.cpp", "lib/Support/SmallPtrSet.cpp",
"lib/Support/SmallVector.cpp", "lib/Support/SmallVector.cpp",
......
...@@ -1085,12 +1085,12 @@ allocset(struct parse *p) ...@@ -1085,12 +1085,12 @@ allocset(struct parse *p)
ptr = (cset *)realloc((char *)p->g->sets, nc * sizeof(cset)); ptr = (cset *)realloc((char *)p->g->sets, nc * sizeof(cset));
if (ptr == NULL) if (ptr == NULL)
goto nomem; goto nomem;
p->g->sets = ptr; p->g->sets = (cset *)ptr;
ptr = (uch *)realloc((char *)p->g->setbits, nbytes); ptr = (uch *)realloc((char *)p->g->setbits, nbytes);
if (ptr == NULL) if (ptr == NULL)
goto nomem; goto nomem;
p->g->setbits = ptr; p->g->setbits = (uch *)ptr;
for (i = 0; i < no; i++) for (i = 0; i < no; i++)
p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT); p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
...@@ -1223,7 +1223,7 @@ mcadd( struct parse *p, cset *cs, const char *cp) ...@@ -1223,7 +1223,7 @@ mcadd( struct parse *p, cset *cs, const char *cp)
SETERROR(REG_ESPACE); SETERROR(REG_ESPACE);
return; return;
} }
cs->multis = np; cs->multis = (char *)np;
llvm_strlcpy(cs->multis + oldend - 1, cp, cs->smultis - oldend + 1); llvm_strlcpy(cs->multis + oldend - 1, cp, cs->smultis - oldend + 1);
} }
...@@ -1523,7 +1523,7 @@ findmust(struct parse *p, struct re_guts *g) ...@@ -1523,7 +1523,7 @@ findmust(struct parse *p, struct re_guts *g)
return; return;
/* turn it into a character string */ /* turn it into a character string */
g->must = malloc((size_t)g->mlen + 1); g->must = (char *)malloc((size_t)g->mlen + 1);
if (g->must == NULL) { /* argh; just forget it */ if (g->must == NULL) { /* argh; just forget it */
g->mlen = 0; g->mlen = 0;
return; return;
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
#define ASSIGN(d, s) memmove(d, s, m->g->nstates) #define ASSIGN(d, s) memmove(d, s, m->g->nstates)
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) #define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
#define STATEVARS long vn; char *space #define STATEVARS long vn; char *space
#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ #define STATESETUP(m, nv) { (m)->space = static_cast<decltype((m)->space)>(malloc((nv)*(m)->g->nstates)); \
if ((m)->space == NULL) return(REG_ESPACE); \ if ((m)->space == NULL) return(REG_ESPACE); \
(m)->vn = 0; } (m)->vn = 0; }
#define STATETEARDOWN(m) { free((m)->space); } #define STATETEARDOWN(m) { free((m)->space); }
......
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