mirror of
https://github.com/nomic-ai/kompute.git
synced 2026-05-11 08:59:59 +00:00
refrence parameter by const refrence, linked tothe original GLSL resources, fixed inlude
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user