[Bf-blender-cvs] [1d2e4a26677] tmp-gpu-shader-descriptor-2: gpu_shader_3D_uniform_color.

Jeroen Bakker noreply at git.blender.org
Wed Jan 12 11:28:25 CET 2022


Commit: 1d2e4a266775f9b5fd219bc40a6ef8090d572009
Author: Jeroen Bakker
Date:   Wed Jan 12 10:09:23 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rB1d2e4a266775f9b5fd219bc40a6ef8090d572009

gpu_shader_3D_uniform_color.

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

M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/intern/gpu_shader_builtin.c
M	source/blender/gpu/opengl/gl_shader.cc
M	source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
M	source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh

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

diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index dd5f0a0f441..1be50af6b69 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -425,9 +425,9 @@ shaders/infos/gpu_shader_2D_image_rect_color_info.hh
 shaders/infos/gpu_shader_text_info.hh
 shaders/infos/gpu_shader_keyframe_shape_info.hh
 shaders/infos/gpu_shader_3D_flat_color_info.hh
-#shaders/infos/gpu_shader_3D_uniform_color_info.hh !Disabled due to world clipping
+shaders/infos/gpu_shader_3D_uniform_color_info.hh
 #shaders/infos/gpu_shader_3D_smooth_color_info.hh
-#shaders/infos/gpu_shader_3D_depth_only_info.hh
+shaders/infos/gpu_shader_3D_depth_only_info.hh
 #shaders/infos/gpu_shader_3D_polyline_info.hh !TODO
 #shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh
 #shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c
index a9067ea5968..9e98d2e9dea 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -221,12 +221,12 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
     [GPU_SHADER_3D_UNIFORM_COLOR] =
         {
             .name = "GPU_SHADER_3D_UNIFORM_COLOR",
-            .vert = datatoc_gpu_shader_3D_vert_glsl,
-            .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+            .create_info = "gpu_shader_3D_uniform_color",
+            .clipped_create_info = "gpu_shader_3D_uniform_color_clipped",
         },
     [GPU_SHADER_3D_FLAT_COLOR] = {.name = "GPU_SHADER_3D_FLAT_COLOR",
-                                  .create_info = "gpu_shader_3d_flat_color",
-                                  .clipped_create_info = "gpu_shader_3d_flat_color_clipped"},
+                                  .create_info = "gpu_shader_3D_flat_color",
+                                  .clipped_create_info = "gpu_shader_3D_flat_color_clipped"},
     [GPU_SHADER_3D_SMOOTH_COLOR] =
         {
             .name = "GPU_SHADER_3D_SMOOTH_COLOR",
@@ -234,8 +234,8 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
             .frag = datatoc_gpu_shader_3D_smooth_color_frag_glsl,
         },
     [GPU_SHADER_3D_DEPTH_ONLY] = {.name = "GPU_SHADER_3D_DEPTH_ONLY",
-                                  .create_info = "gpu_shader_3d_depth_only",
-                                  .clipped_create_info = "gpu_shader_3d_depth_only_clipped"},
+                                  .create_info = "gpu_shader_3D_depth_only",
+                                  .clipped_create_info = "gpu_shader_3D_depth_only_clipped"},
     [GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR] =
         {
             .name = "GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR",
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index f5caf0df3d3..e3d8d5f3b28 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -396,8 +396,6 @@ std::string GLShader::resources_declare(const ShaderCreateInfo &info) const
     ss << "uniform " << to_string(uniform.type) << " " << uniform.name << ";\n";
   }
   ss << "\n";
-  std::cout << "------------- resources_declare -------------\n";
-  std::cout << ss.str();
   return ss.str();
 }
 
@@ -415,8 +413,6 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con
     print_interface(ss, "out", *iface);
   }
   ss << "\n";
-  std::cout << "------------- vertex_interface_declare -------------\n";
-  std::cout << ss.str();
   return ss.str();
 }
 
@@ -447,8 +443,6 @@ std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) c
     ss << "out " << to_string(output.type) << " " << output.name << ";\n";
   }
   ss << "\n";
-  std::cout << "------------- fragment_interface_declare -------------\n";
-  std::cout << ss.str();
   return ss.str();
 }
 
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
index 7bcc3110950..1d7b7df49a8 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
@@ -1,3 +1,4 @@
+#pragma BLENDER_REQUIRE(gpu_shader_cfg_world_clip_lib.glsl)
 
 #ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
@@ -14,6 +15,6 @@ void main()
   gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
 
 #ifdef USE_WORLD_CLIP_PLANES
-  world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+  world_clip_planes_calc_clip_distance((clipPlanes.ModelMatrix * vec4(pos, 1.0)).xyz);
 #endif
 }
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
index c86e77f61ea..ac7e070221f 100644
--- a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh
@@ -11,7 +11,6 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
     .additional_info("gpu_srgb_to_framebuffer_space")
     .do_static_compilation(true);
 
-GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped)
+GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped)
     .additional_info("gpu_shader_3D_uniform_color")
-    .additional_info("gpu_clip_planes")
-    .do_static_compilation(true);
+    .additional_info("gpu_clip_planes");



More information about the Bf-blender-cvs mailing list