diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-30 14:55:13 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-30 17:44:58 +0300 |
commit | da741013a1e1b2e7c4f61a9486588253a457afd2 (patch) | |
tree | b491c53eadf1fcc07e2a326d000b1c94fbf07f48 /source/blender/gpu/intern/gpu_shader.cc | |
parent | 55401fbb3d0daa82c999e388c2b5b87e7113b091 (diff) |
EEVEE: GLSL refactor/cleanup
- add the use of DRWShaderLibrary to EEVEE's glsl codebase to reduce code
complexity and duplication.
- split bsdf_common_lib.glsl into multiple sub library which are now shared
with other engines.
- the surface shader code is now more organised and have its own files.
- change default world to use a material nodetree and make lookdev shader
more clear.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D8306
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index bd3cad31093..2b54e733bf5 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -341,7 +341,7 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, gpu_shader_standard_extensions(standard_extensions); if (vertexcode) { - const char *source[6]; + const char *source[7]; /* custom limit, may be too small, beware */ int num_source = 0; @@ -352,6 +352,9 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, source[num_source++] = standard_extensions; source[num_source++] = standard_defines; + if (geocode) { + source[num_source++] = "#define USE_GEOMETRY_SHADER\n"; + } if (defines) { source[num_source++] = defines; } @@ -375,7 +378,7 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, } if (fragcode) { - const char *source[7]; + const char *source[8]; int num_source = 0; source[num_source++] = gpu_shader_version(); @@ -385,6 +388,9 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, source[num_source++] = standard_extensions; source[num_source++] = standard_defines; + if (geocode) { + source[num_source++] = "#define USE_GEOMETRY_SHADER\n"; + } if (defines) { source[num_source++] = defines; } @@ -453,6 +459,9 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, if (!status) { glGetProgramInfoLog(shader->program, sizeof(log), &length, log); /* print attached shaders in pipeline order */ + if (defines) { + shader_print_errors("linking", log, &defines, 1); + } if (vertexcode) { shader_print_errors("linking", log, &vertexcode, 1); } |