diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.cc | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_builtin.c | 8 |
3 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 97b9b26ba2a..d2716b46124 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -69,6 +69,7 @@ GPUShader *GPU_shader_create_ex(const char *vertcode, int tf_count, const char *shname); GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info); +GPUShader *GPU_shader_create_from_info_name(const char *info_name); struct GPU_ShaderCreateFromArray_Params { const char **vert, **geom, **frag, **defs; diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 3b41e804fd4..8c97f423800 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -249,6 +249,18 @@ GPUShader *GPU_shader_create_compute(const char *computecode, shname); } +GPUShader *GPU_shader_create_from_info_name(const char *info_name) +{ + using namespace blender::gpu::shader; + const GPUShaderCreateInfo *_info = gpu_shader_create_info_get(info_name); + const ShaderCreateInfo &info = *reinterpret_cast<const ShaderCreateInfo *>(_info); + if (!info.do_static_compilation_) { + printf("Warning: Trying to compile \"%s\" which was not marked for static compilation.\n", + info.name_.c_str()); + } + return GPU_shader_create_from_info(_info); +} + GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info) { using namespace blender::gpu::shader; diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c index 9c8dbf8401f..6b1163fdc78 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.c +++ b/source/blender/gpu/intern/gpu_shader_builtin.c @@ -41,9 +41,6 @@ #include "GPU_texture.h" #include "GPU_uniform_buffer.h" -/* TODO(jbakker): Need a better way to retrieve create_infos. */ -#include "gpu_shader_create_info_private.hh" - /* Adjust these constants as needed. */ #define MAX_DEFINE_LENGTH 256 #define MAX_EXT_DEFINE_LENGTH 512 @@ -366,7 +363,7 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, /* common case */ if (sh_cfg == GPU_SHADER_CFG_DEFAULT) { if (stages->create_info != NULL) { - *sh_p = GPU_shader_create_from_info(gpu_shader_create_info_get(stages->create_info)); + *sh_p = GPU_shader_create_from_info_name(stages->create_info); } else { *sh_p = GPU_shader_create_from_arrays_named( @@ -392,8 +389,7 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR)); /* In rare cases geometry shaders calculate clipping themselves. */ if (stages->clipped_create_info != NULL) { - *sh_p = GPU_shader_create_from_info( - gpu_shader_create_info_get(stages->clipped_create_info)); + *sh_p = GPU_shader_create_from_info_name(stages->clipped_create_info); } else { const char *world_clip_lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl; |