Merge pull request #241 from KomputeProject/240_win_helpers

Extend shader helper functions in tests to support windows
This commit is contained in:
Alejandro Saucedo 2021-09-12 07:30:55 +01:00 committed by GitHub
commit fab1bafd67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View file

@ -187,4 +187,5 @@ release/
swiftshader/
vk_swiftshader_icd.json
tmp_kp_shader.comp.spv
tmp_kp_shader.comp

View file

@ -118,10 +118,11 @@ vs_cmake:
-DKOMPUTE_OPT_INSTALL=1 \
-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=0 \
-DKOMPUTE_OPT_BUILD_TESTS=1 \
-DKOMPUTE_OPT_BUILD_DOCS=1 \
-DKOMPUTE_OPT_BUILD_SHADERS=1 \
-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 \
-DKOMPUTE_OPT_ENABLE_SPDLOG=1 \
-DKOMPUTE_OPT_CODE_COVERAGE=0 \
-DKOMPUTE_OPT_BUILD_DOCS=0 \
-G "Visual Studio 16 2019"
vs_build_all:

View file

@ -20,7 +20,10 @@ std::vector<uint32_t>
compileSource(
const std::string& source)
{
if (system(std::string("glslangValidator --stdin -S comp -V -o tmp_kp_shader.comp.spv << END\n" + source + "\nEND").c_str()))
std::ofstream fileOut("tmp_kp_shader.comp");
fileOut << source;
fileOut.close();
if (system(std::string("glslangValidator -V tmp_kp_shader.comp -o tmp_kp_shader.comp.spv").c_str()))
throw std::runtime_error("Error running glslangValidator command");
std::ifstream fileStream("tmp_kp_shader.comp.spv", std::ios::binary);
std::vector<char> buffer;