[Bf-blender-cvs] [2ebcb7fab3e] master: Cleanup: make format and fix warning

Jacques Lucke noreply at git.blender.org
Tue Mar 22 13:44:25 CET 2022


Commit: 2ebcb7fab3e237b7d00de3088c34780cd24f397b
Author: Jacques Lucke
Date:   Tue Mar 22 13:44:15 2022 +0100
Branches: master
https://developer.blender.org/rB2ebcb7fab3e237b7d00de3088c34780cd24f397b

Cleanup: make format and fix warning

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

M	source/blender/gpu/GPU_context.h
M	source/blender/gpu/GPU_platform.h
M	source/blender/gpu/intern/gpu_context.cc
M	source/blender/gpu/intern/gpu_platform.cc
M	source/blender/gpu/metal/mtl_backend.mm
M	source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_text_vert.glsl
M	source/blender/gpu/shaders/material/gpu_shader_material_light_falloff.glsl

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

diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index 453c117501d..f3b7f8c29bf 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -47,11 +47,12 @@ void GPU_context_main_lock(void);
 void GPU_context_main_unlock(void);
 
 /* GPU Begin/end work blocks */
-void GPU_render_begin();
-void GPU_render_end();
+void GPU_render_begin(void);
+void GPU_render_end(void);
 
-/* For operations which need to run exactly once per frame -- even if there are no render updates. */
-void GPU_render_step();
+/* For operations which need to run exactly once per frame -- even if there are no render updates.
+ */
+void GPU_render_step(void);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/gpu/GPU_platform.h b/source/blender/gpu/GPU_platform.h
index bd20d0c7db1..d999216c7ff 100644
--- a/source/blender/gpu/GPU_platform.h
+++ b/source/blender/gpu/GPU_platform.h
@@ -58,10 +58,13 @@ extern "C" {
 #endif
 
 /* GPU Types */
-/* TODO: Verify all use-cases of GPU_type_matches to determine which graphics API it should apply to, and replace
- * with `GPU_type_matches_ex` where appropriate. */
+/* TODO: Verify all use-cases of GPU_type_matches to determine which graphics API it should apply
+ * to, and replace with `GPU_type_matches_ex` where appropriate. */
 bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver);
-bool GPU_type_matches_ex(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver, eGPUBackendType backend);
+bool GPU_type_matches_ex(eGPUDeviceType device,
+                         eGPUOSType os,
+                         eGPUDriverType driver,
+                         eGPUBackendType backend);
 
 eGPUSupportLevel GPU_platform_support_level(void);
 const char *GPU_platform_vendor(void);
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index 5b40d3850a5..c6eaf7defdc 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -14,7 +14,7 @@
 
 /* TODO: Create cmake option. */
 #if WITH_OPENGL
-  #define WITH_OPENGL_BACKEND 1
+#  define WITH_OPENGL_BACKEND 1
 #endif
 
 #include "BLI_assert.h"
@@ -152,18 +152,21 @@ void GPU_context_main_unlock()
  * Used for global autoreleasepool flushing in Metal
  * \{ */
 
-void GPU_render_begin() {
-  GPUBackend* backend = GPUBackend::get();
+void GPU_render_begin()
+{
+  GPUBackend *backend = GPUBackend::get();
   BLI_assert(backend);
   backend->render_begin();
 }
-void GPU_render_end() {
-  GPUBackend* backend = GPUBackend::get();
+void GPU_render_end()
+{
+  GPUBackend *backend = GPUBackend::get();
   BLI_assert(backend);
   backend->render_end();
 }
-void GPU_render_step() {
-  GPUBackend* backend = GPUBackend::get();
+void GPU_render_step()
+{
+  GPUBackend *backend = GPUBackend::get();
   BLI_assert(backend);
   backend->render_step();
 }
@@ -229,7 +232,7 @@ void GPU_backend_exit()
 
 eGPUBackendType GPU_backend_get_type()
 {
-  
+
 #ifdef WITH_OPENGL_BACKEND
   if (g_backend && dynamic_cast<GLBackend *>(g_backend) != nullptr) {
     return GPU_BACKEND_OPENGL;
diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc
index 8d4e80abd97..d108dd468a0 100644
--- a/source/blender/gpu/intern/gpu_platform.cc
+++ b/source/blender/gpu/intern/gpu_platform.cc
@@ -148,10 +148,14 @@ bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType drive
   return GPU_type_matches_ex(device, os, driver, GPU_BACKEND_ANY);
 }
 
-bool GPU_type_matches_ex(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver, eGPUBackendType backend)
+bool GPU_type_matches_ex(eGPUDeviceType device,
+                         eGPUOSType os,
+                         eGPUDriverType driver,
+                         eGPUBackendType backend)
 {
   BLI_assert(GPG.initialized);
-  return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver) && (GPG.backend & backend);
+  return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver) &&
+         (GPG.backend & backend);
 }
 
 /** \} */
diff --git a/source/blender/gpu/metal/mtl_backend.mm b/source/blender/gpu/metal/mtl_backend.mm
index c4a35218158..35be99be686 100644
--- a/source/blender/gpu/metal/mtl_backend.mm
+++ b/source/blender/gpu/metal/mtl_backend.mm
@@ -318,7 +318,7 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
 
   /* Initialise Capabilities. */
   MTLBackend::capabilities.supports_argument_buffers_tier2 = ([device argumentBuffersSupport] ==
-                                                                MTLArgumentBuffersTier2);
+                                                              MTLArgumentBuffersTier2);
   MTLBackend::capabilities.supports_family_mac1 = [device supportsFamily:MTLGPUFamilyMac1];
   MTLBackend::capabilities.supports_family_mac2 = [device supportsFamily:MTLGPUFamilyMac2];
   MTLBackend::capabilities.supports_family_mac_catalyst1 = [device
@@ -347,7 +347,7 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
 
   /* Conservative uniform data limit is 4KB per-stage -- This is the limit of setBytes.
    * MTLBuffer path is also supported but not as efficient. */
-  GCaps.max_uniforms_vert = 1024; 
+  GCaps.max_uniforms_vert = 1024;
   GCaps.max_uniforms_frag = 1024;
 
   GCaps.max_batch_indices = 1 << 31;
@@ -364,7 +364,7 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
   GCaps.shader_storage_buffer_objects_support =
       false; /* TODO(Metal): implement Storage Buffer support.*/
 
-  /* Maximum buffer bindings: 31. Consider required slot for uniforms/UBOs/Vertex attributes. 
+  /* Maximum buffer bindings: 31. Consider required slot for uniforms/UBOs/Vertex attributes.
    * Can use argument buffers if a higher limit is required. */
   GCaps.max_shader_storage_buffer_bindings = 24;
 
@@ -373,11 +373,13 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
     GCaps.max_work_group_count[1] = 65535;
     GCaps.max_work_group_count[2] = 65535;
 
-    /* In Metal, total_thread_count is 512 or 1024, such that 
+    /* In Metal, total_thread_count is 512 or 1024, such that
      * threadgroup `width*height*depth <= total_thread_count` */
-    unsigned int max_threads_per_threadgroup_per_dim = 
-        ([device supportsFamily:MTLGPUFamilyApple4] || 
-          MTLBackend::capabilities.supports_family_mac1) ? 1024 : 512;
+    unsigned int max_threads_per_threadgroup_per_dim =
+        ([device supportsFamily:MTLGPUFamilyApple4] ||
+         MTLBackend::capabilities.supports_family_mac1) ?
+            1024 :
+            512;
     GCaps.max_work_group_size[0] = max_threads_per_threadgroup_per_dim;
     GCaps.max_work_group_size[1] = max_threads_per_threadgroup_per_dim;
     GCaps.max_work_group_size[2] = max_threads_per_threadgroup_per_dim;
@@ -394,7 +396,8 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
   GCaps.broken_amd_driver = false;
 
   /* Metal related workarounds. */
-  /* Minimum per-vertex stride is 4 bytes in Metal. A bound vertex buffer must contribute atleast 4 bytes per vertex. */
+  /* Minimum per-vertex stride is 4 bytes in Metal. A bound vertex buffer must contribute atleast 4
+   * bytes per vertex. */
   GCaps.minimum_per_vertex_stride = 4;
 }
 
diff --git a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
index aa182eb52be..d77f073b7de 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
@@ -34,7 +34,7 @@ void main()
 {
   fragColor = texture(image_texture, texCoord_interp.xy);
   vec4 overlay_col = texture(overlays_texture, texCoord_interp.xy);
-  
+
   if (overlay) {
     fragColor = clamp(fragColor, 0.0, 1.0);
     fragColor *= 1.0 - overlay_col.a;
diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
index 4221e426a3e..63d73733c2f 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
@@ -28,8 +28,9 @@ void main()
   vec2 interp_offset = float(interp_size) / abs(pos.zw - pos.xy);
   texCoord_interp = mix(-interp_offset, 1.0 + interp_offset, quad);
 
-  vec2 final_pos = mix(
-      vec2(ivec2(pos.xy) + ivec2(-interp_size, interp_size)), vec2(ivec2(pos.zw) + ivec2(interp_size, -interp_size)), quad);
+  vec2 final_pos = mix(vec2(ivec2(pos.xy) + ivec2(-interp_size, interp_size)),
+                       vec2(ivec2(pos.zw) + ivec2(interp_size, -interp_size)),
+                       quad);
 
   gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 0.0, 1.0);
 }
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_light_falloff.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_light_falloff.glsl
index e1c7a00646f..92762db5ff4 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_light_falloff.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_light_falloff.glsl
@@ -1,5 +1,8 @@
-void node_light_falloff(
-    float strength, float tsmooth, out float quadratic, out float linear, out float falloff_constant)
+void node_light_falloff(float strength,
+                        float tsmooth,
+                        out float quadratic,
+                        out float linear,
+                        out float falloff_constant)
 {
   quadratic = strength;
   linear = strength;



More information about the Bf-blender-cvs mailing list