diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-01-21 14:50:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-01-21 14:54:41 +0300 |
commit | ba4de7f1a58430c0e6153612bd585e3642d06b2d (patch) | |
tree | b1ef92c91868dd21131c638b6aa4c0d99acaa3e3 /source/blender | |
parent | f8d040cb7020e20d0a5ed0f5d69e0f2df74bedeb (diff) |
GPUShader: Add GPU_VERTEX/FRAGMENT/GEOMETRY_SHADER defines
This makes it possible to have some code specific to each shader inside a
shader library.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 0c1ea0d97d5..7739feacbf0 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -361,7 +361,7 @@ GPUShader *GPU_shader_create_ex( #endif /* At least a vertex shader and a fragment shader are required. */ - // BLI_assert((fragcode != NULL) && (vertexcode != NULL)); + BLI_assert((fragcode != NULL) && (vertexcode != NULL)); if (vertexcode) shader->vertex = glCreateShader(GL_VERTEX_SHADER); @@ -386,11 +386,12 @@ GPUShader *GPU_shader_create_ex( gpu_shader_standard_extensions(standard_extensions); if (vertexcode) { - const char *source[5]; + const char *source[6]; /* custom limit, may be too small, beware */ int num_source = 0; source[num_source++] = gpu_shader_version(); + source[num_source++] = "#define GPU_VERTEX_SHADER\n"; source[num_source++] = standard_extensions; source[num_source++] = standard_defines; @@ -419,6 +420,7 @@ GPUShader *GPU_shader_create_ex( int num_source = 0; source[num_source++] = gpu_shader_version(); + source[num_source++] = "#define GPU_FRAGMENT_SHADER\n"; source[num_source++] = standard_extensions; source[num_source++] = standard_defines; @@ -448,6 +450,7 @@ GPUShader *GPU_shader_create_ex( int num_source = 0; source[num_source++] = gpu_shader_version(); + source[num_source++] = "#define GPU_GEOMETRY_SHADER\n"; source[num_source++] = standard_extensions; source[num_source++] = standard_defines; |