首先要看看vulkan是否支持你的GPU!!
windows7
vulkan1.0.17.0
vs2013, 官方現在推薦使用vs2013,雖然vs2015也可用,但是可能需要做一些適當的調整,整體來說,如果不是高手,使用vs2013會更順利
cmake3.6.0
更新顯卡驅動
首先安裝vulkan1.0.17.0 SDK,下載cmake,binary文件無需編譯和安裝,解壓即可
vulkan SDK安裝之後,如果顯卡支持,這時候,SDK裏的demo就可以直接運行了
然後是調試samples
我們按照SDK中的官方文檔 getting_started.html 中的指示來做
第一步,把cmake加入環境變量 ,比如我的是 D:\huizhang\cmake\cmake-3.6.0-rc3-win64-x64\bin;
第二步,把MSBuild.exe加入環境變量
從 Visual Studio 2013 開始,你可以在 MSBuild 文件夾中查找 MSBuild.exe(32 位操作系統上的 %ProgramFiles%\MSBuild,或者 64 位操作系統上的 %ProgramFiles(x86)%\MSBuild)。
在命令提示符處,鍵入 set PATH=%PATH%;%ProgramFiles%\MSBuild 或 set PATH=%PATH%;%ProgramFiles(x86)%\MSBuild。
或者,如果安裝了 Visual Studio,則可以使用“Visual Studio 命令提示”,其中有包括 MSBuild 文件夾的路徑。
也可以直接在環境變量裏把路徑複製粘貼;
第三步,按照SDK裏文檔getting_started.html中的說明,在PowerShell中使用命令行完成編譯。
即執行下面的命令:
首先編譯glslang和spirv-tools:
Make sure CMake, python and MSBuild are in your PATH. From a Powershell window, configure and build glslang and spirv-tools:
PS > cd C:\VulkanSDK\<version>\glslang
PS > mkdir build
PS > cd build
PS > cmake -G "Visual Studio 12 Win64" ..
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
PS > cd ..
PS > mkdir build32
PS > cd build32
PS > cmake -G "Visual Studio 12" ..
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
PS > cd ..
PS > cd C:\VulkanSDK\<version>\spirv-tools
PS > mkdir build
PS > cd build
PS > cmake -G "Visual Studio 12 Win64" ..
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet
PS > cd ..
PS > mkdir build32
PS > cd build32
PS > cmake -G "Visual Studio 12" ..
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /verbosity:quiet
PS > msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /verbosity:quiet
然後編譯samples:
Note that you must build glslang and spirv-tools before running cmake for the samples.
Configure the Vulkan Samples:
PS > cd C:\VulkanSDK\<version>\Samples
PS > mkdir build
PS > cd build
PS > cmake -G "Visual Studio 12 Win64" ..
PS > cd ..
PS > mkdir build32
PS > cd build32
PS > cmake -G "Visual Studio 12" ..
PS > cd ..
Open VULKAN_SAMPLES.sln
file in the appropriate build folder with Microsoft Visual Studio and build the solution. For 64-bit
samples, build using the solution in the "build" folder. For 32-bit samples, build using the solution in the "build32" folder.
現在開始吧!