aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Shader.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-09-08 14:52:17 +0800
committerchai <chaifix@163.com>2018-09-08 14:52:17 +0800
commit7c3609b04eabc79db0c0b245a155fc3c5e875053 (patch)
tree9333f727863c8fed738bd16eaf6d9e2f0d4f53b5 /src/libjin/Graphics/Shader.cpp
parent1ccc798ca383fc941d624751293ed88e012900d1 (diff)
*update
Diffstat (limited to 'src/libjin/Graphics/Shader.cpp')
-rw-r--r--src/libjin/Graphics/Shader.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libjin/Graphics/Shader.cpp b/src/libjin/Graphics/Shader.cpp
index ae64c7e..7f849a6 100644
--- a/src/libjin/Graphics/Shader.cpp
+++ b/src/libjin/Graphics/Shader.cpp
@@ -3,11 +3,14 @@
#include "../utils/macros.h"
#include "Shader.h"
+#include "../Filesystem/Buffer.h"
namespace jin
{
namespace graphics
{
+ using namespace jin::filesystem;
+
#include "base.shader.h"
/*
@@ -55,11 +58,10 @@ namespace graphics
: currentTextureUnit(DEFAULT_TEXTURE_UNIT)
{
int size = strlen(program) + SHADER_FORMAT_SIZE;
- char* fs = (char*)alloca(size);
- memset(fs, 0, size);
- formatShader(fs, program);
+ Buffer b = Buffer(size);
+ formatShader((char*)b.data, program);
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(shader, 1, (const GLchar**)&fs, NULL);
+ glShaderSource(shader, 1, (const GLchar**)&b.data, NULL);
glCompileShader(shader);
GLint success;
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);