fix issue with shader compiler
parent
5ad77763dc
commit
20a8974f9b
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
set(BLT_GRAPHICS_VERSION 0.9.3)
|
||||
set(BLT_GRAPHICS_VERSION 0.9.4)
|
||||
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
||||
|
||||
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
||||
|
|
|
@ -152,6 +152,7 @@ namespace blt::gfx
|
|||
|
||||
static unsigned int createShader(const std::string& source, int type);
|
||||
|
||||
static std::string loadShader(std::string_view file);
|
||||
public:
|
||||
/**
|
||||
* Creates a shader
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0ec0548661bbacbe7849b37c4019693dbfb47279
|
||||
Subproject commit 9db3f120489ff27aa560e488d82b5ae0d64019df
|
|
@ -93,6 +93,7 @@ namespace blt::gfx
|
|||
// loads the shader code for later complication and uploading into the graphics card
|
||||
// TODO: defines can be added here by sending them as additional strings. No need to edit the source string
|
||||
glShaderSource(shaderID, 1, &shader_code, nullptr);
|
||||
|
||||
// Compile it
|
||||
glCompileShader(shaderID);
|
||||
|
||||
|
@ -129,8 +130,8 @@ namespace blt::gfx
|
|||
if (!load_as_string)
|
||||
{
|
||||
// BLT provides a recursive file loader for glsl shaders. It's pretty much just a recursive function looking for include statements.
|
||||
vertex_source = blt::fs::loadShaderFile(vertex);
|
||||
fragment_source = blt::fs::loadShaderFile(fragment);
|
||||
vertex_source = loadShader(vertex);
|
||||
fragment_source = loadShader(fragment);
|
||||
} else
|
||||
{
|
||||
vertex_source = removeEmptyFirstLines(vertex_source);
|
||||
|
@ -221,6 +222,15 @@ namespace blt::gfx
|
|||
move.programID = -1;
|
||||
}
|
||||
|
||||
std::string shader_t::loadShader(std::string_view file)
|
||||
{
|
||||
auto lines = blt::fs::recursiveInclude(file);
|
||||
std::string str;
|
||||
for (const auto& v : lines)
|
||||
str += v;
|
||||
return str;
|
||||
}
|
||||
|
||||
shader_base_t& shader_base_t::setBool(const std::string& name, bool value)
|
||||
{
|
||||
if (auto i = getUniformLocation(name))
|
||||
|
|
Loading…
Reference in New Issue