[Bf-blender-cvs] [2e6d1150a7b] temp-lineart-embree: GPU: ShaderBuilder: Skip shader compilation for unsupported shaders.

Clément Foucault noreply at git.blender.org
Sat Mar 26 17:11:01 CET 2022


Commit: 2e6d1150a7b1a37de3c0acccccb008ba11b33494
Author: Clément Foucault
Date:   Sat Mar 26 11:51:23 2022 +0100
Branches: temp-lineart-embree
https://developer.blender.org/rB2e6d1150a7b1a37de3c0acccccb008ba11b33494

GPU: ShaderBuilder: Skip shader compilation for unsupported shaders.

===================================================================

M	source/blender/gpu/intern/gpu_shader_create_info.cc
M	source/blender/gpu/opengl/gl_shader.cc

===================================================================

diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc
index aef1984687d..0d26f17ede5 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.cc
+++ b/source/blender/gpu/intern/gpu_shader_create_info.cc
@@ -264,9 +264,14 @@ bool gpu_shader_create_info_compile_all()
 {
   using namespace blender::gpu;
   int success = 0;
+  int skipped = 0;
   int total = 0;
   for (ShaderCreateInfo *info : g_create_infos->values()) {
     if (info->do_static_compilation_) {
+      if (GPU_compute_shader_support() == false && info->compute_source_ != nullptr) {
+        skipped++;
+        continue;
+      }
       total++;
       GPUShader *shader = GPU_shader_create_from_info(
           reinterpret_cast<const GPUShaderCreateInfo *>(info));
@@ -322,12 +327,11 @@ bool gpu_shader_create_info_compile_all()
       GPU_shader_free(shader);
     }
   }
-  printf("===============================\n");
-  printf("Shader Test compilation result: \n");
-  printf("%d Total\n", total);
-  printf("%d Passed\n", success);
-  printf("%d Failed\n", total - success);
-  printf("===============================\n");
+  printf("Shader Test compilation result: %d / %d passed", success, total);
+  if (skipped > 0) {
+    printf(" (skipped %d for compatibility reasons)", skipped);
+  }
+  printf("\n");
   return success == total;
 }
 
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index 5a55a2e8020..71428633d79 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -868,7 +868,7 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *>
 {
   GLuint shader = glCreateShader(gl_stage);
   if (shader == 0) {
-    fprintf(stderr, "GLShader: Error: Could not create shader object.");
+    fprintf(stderr, "GLShader: Error: Could not create shader object.\n");
     return 0;
   }



More information about the Bf-blender-cvs mailing list