Compute shader glsl prefix;

This commit is contained in:
bjorn 2018-08-08 18:05:29 -07:00
parent 98e518683a
commit e371359193
3 changed files with 5 additions and 1 deletions

View File

@ -1521,7 +1521,7 @@ Shader* lovrShaderCreateCompute(const char* source) {
if (!shader) return NULL;
lovrAssert(GLAD_GL_ARB_compute_shader, "Compute shaders are not supported on this system");
const char* sources[] = { source, lovrShaderComputeSuffix };
const char* sources[] = { lovrShaderComputePrefix, source, lovrShaderComputeSuffix };
GLuint computeShader = compileShader(GL_COMPUTE_SHADER, sources, sizeof(sources) / sizeof(sources[0]));
GLuint program = glCreateProgram();
glAttachShader(program, computeShader);

View File

@ -115,6 +115,9 @@ const char* lovrShaderFragmentSuffix = ""
"#endif \n"
"}";
const char* lovrShaderComputePrefix = ""
"#version 420 \n";
const char* lovrShaderComputeSuffix = ""
"void main() { \n"
" compute(); \n"

View File

@ -7,6 +7,7 @@ extern const char* lovrShaderVertexPrefix;
extern const char* lovrShaderVertexSuffix;
extern const char* lovrShaderFragmentPrefix;
extern const char* lovrShaderFragmentSuffix;
extern const char* lovrShaderComputePrefix;
extern const char* lovrShaderComputeSuffix;
extern const char* lovrDefaultVertexShader;
extern const char* lovrDefaultFragmentShader;