diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-04-13 12:55:37 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-04-13 12:55:37 +0300 |
commit | 3a88f151c49f820ebb1589377958b397b1d9b96c (patch) | |
tree | 27e8574205506df23ca30d08c46006ac0fae19ae /source/blender/gpu/intern/gpu_shader.cc | |
parent | 402845744f9de6f2ae08aaa80347323fe6ca5684 (diff) |
Cleanup: Proper printing of a string
Print it as a "%s" so that possible percentage symbols in the
error message does not cause issues.
Use proper assert (assert(true) is a no-op).
Also use `empty()` instead of `length()`.
Reviewed with Clement in real life.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 227525bd5d3..76b3402435a 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -283,10 +283,10 @@ GPUShader *GPU_shader_create_from_info(const GPUShaderCreateInfo *_info) GPU_debug_group_begin(GPU_DEBUG_SHADER_COMPILATION_GROUP); - std::string error = info.check_error(); - if (error.length()) { - printf(error.c_str()); - BLI_assert(true); + const std::string error = info.check_error(); + if (!error.empty()) { + printf("%s\n", error.c_str()); + BLI_assert(false); } Shader *shader = GPUBackend::get()->shader_alloc(info.name_.c_str()); |