refrence parameter by const refrence, linked tothe original GLSL resources, fixed inlude

This commit is contained in:
aliPMPAINT
2021-02-27 11:22:49 +03:30
parent f60e71dd0b
commit 3cad95c2b6
2 changed files with 7 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ Shader::compile_sources(const std::vector<std::string>& sources,
const std::vector<std::string>& files,
const std::string& entryPoint,
std::vector<std::pair<std::string,std::string>> definitions,
const TBuiltInResource resources) {
const TBuiltInResource& resources) {
// Initialize glslang library.
glslang::InitializeProcess();
@@ -90,7 +90,7 @@ std::vector<uint32_t>
Shader::compile_source(const std::string& source,
const std::string& entryPoint,
std::vector<std::pair<std::string,std::string>> definitions,
const TBuiltInResource resource) {
const TBuiltInResource& resource) {
return compile_sources({source}, std::vector<std::string>({}), entryPoint, definitions, resource);
}

View File

@@ -6,7 +6,7 @@
#include <glslang/Include/ResourceLimits.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>
#include <SPIRV/GlslangToSpv.h>
#include "kompute/Core.hpp"
@@ -36,7 +36,7 @@ public:
const std::vector<std::string>& files = {},
const std::string& entryPoint = "main",
std::vector<std::pair<std::string,std::string>> 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<std::pair<std::string,std::string>> 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,