From 2380221c8187a871ee92fe03be4c957839364155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 30 Sep 2016 20:03:16 -0700 Subject: [PATCH] shaderc: Added SPIR-V stub. --- scripts/bgfx.lua | 2 +- scripts/shaderc.lua | 4 ++++ tools/shaderc/shaderc.h | 1 + tools/shaderc/shaderc_spirv.cpp | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/shaderc/shaderc_spirv.cpp diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index da122f431..ce38efb72 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -10,7 +10,7 @@ function overridefiles(_srcPath, _dstPath, _files) for _, file in ipairs(_files) do file = path.getrelative(_srcPath, file) local filePath = path.join(BGFX_DIR, "../bgfx-ext", file) - if not os.isfile(filePath) then print(filePath .. " not found") return end + if not os.isfile(filePath) then return end table.insert(remove, path.join(_srcPath, file)) table.insert(add, filePath) diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index d38e3e70d..f6aae1a6e 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -118,4 +118,8 @@ project "shaderc" path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) + overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"), + }) + strip() diff --git a/tools/shaderc/shaderc.h b/tools/shaderc/shaderc.h index 0f8f18521..a91fe2783 100644 --- a/tools/shaderc/shaderc.h +++ b/tools/shaderc/shaderc.h @@ -132,6 +132,7 @@ namespace bgfx bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); bool compilePSSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); + bool compileSPIRVShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); } // namespace bgfx diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp new file mode 100644 index 000000000..768ec54fb --- /dev/null +++ b/tools/shaderc/shaderc_spirv.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "shaderc.h" + +namespace bgfx +{ + bool compileSPIRVShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + { + BX_UNUSED(_cmdLine, _version, _code, _writer); + fprintf(stderr, "SPIR-V compiler is not supported.\n"); + return false; + } + +} // namespace bgfx