Updated compilesource in godot examples
Signed-off-by: Alejandro Saucedo <axsauze@gmail.com>
This commit is contained in:
parent
d932b2f8ea
commit
ea983cb64d
2 changed files with 14 additions and 4 deletions
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
#include "KomputeSummatorNode.h"
|
||||
|
||||
static std::vector<uint32_t>
|
||||
static
|
||||
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;
|
||||
|
|
@ -16,6 +20,7 @@ compileSource(
|
|||
return {(uint32_t*)buffer.data(), (uint32_t*)(buffer.data() + buffer.size())};
|
||||
}
|
||||
|
||||
|
||||
KomputeSummatorNode::KomputeSummatorNode() {
|
||||
this->_init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@
|
|||
|
||||
#include "KomputeSummator.hpp"
|
||||
|
||||
static std::vector<uint32_t>
|
||||
static
|
||||
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;
|
||||
|
|
@ -17,6 +21,7 @@ compileSource(
|
|||
return {(uint32_t*)buffer.data(), (uint32_t*)(buffer.data() + buffer.size())};
|
||||
}
|
||||
|
||||
|
||||
namespace godot {
|
||||
|
||||
KomputeSummator::KomputeSummator() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue