diff --git a/src/Shader.cpp b/src/Shader.cpp index 9ca2e85..cdcd66e 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -9,7 +9,7 @@ Shader::compile_sources(const std::vector& sources, const std::vector& files, const std::string& entryPoint, std::vector> definitions, - const TBuiltInResource resources) { + const TBuiltInResource& resources) { // Initialize glslang library. glslang::InitializeProcess(); @@ -90,7 +90,7 @@ std::vector Shader::compile_source(const std::string& source, const std::string& entryPoint, std::vector> definitions, - const TBuiltInResource resource) { + const TBuiltInResource& resource) { return compile_sources({source}, std::vector({}), entryPoint, definitions, resource); } diff --git a/src/include/kompute/Shader.hpp b/src/include/kompute/Shader.hpp index 5f840b0..bb76dbb 100644 --- a/src/include/kompute/Shader.hpp +++ b/src/include/kompute/Shader.hpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include "kompute/Core.hpp" @@ -36,7 +36,7 @@ public: const std::vector& files = {}, const std::string& entryPoint = "main", std::vector> definitions = {}, - const TBuiltInResource resources = defaultResource); + const TBuiltInResource& resources = defaultResource); /** * Compile a single glslang source from string value. Currently this function @@ -55,10 +55,12 @@ public: const std::string& source, const std::string& entryPoint = "main", std::vector> definitions = {}, - const TBuiltInResource resources = defaultResource); + const TBuiltInResource& resources = defaultResource); private: // The default resource limit for the GLSL compiler, can be overwritten + // Has been adobted by: + // https://github.com/KhronosGroup/glslang/blob/master/StandAlone/ResourceLimits.cpp static constexpr TBuiltInResource defaultResource = { /* .MaxLights = */ 0, /* .MaxClipPlanes = */ 0,