diff --git a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl index 626773f3647..cf4b5fb7d3b 100644 --- a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl +++ b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl @@ -68,7 +68,8 @@ using uvec4 = uint4; /* Compute decorators. */ #define TG threadgroup -#define barrier() threadgroup_barrier(mem_flags::mem_threadgroup | mem_flags::mem_device | mem_flags::mem_texture) +#define barrier() \ + threadgroup_barrier(mem_flags::mem_threadgroup | mem_flags::mem_device | mem_flags::mem_texture) #ifdef MTL_USE_WORKGROUP_SIZE /* Compute work-group size. */ @@ -472,7 +473,8 @@ inline vec _texelFetch_internal(thread _mtl_combined_image_sampler_1d_arra float w = tex.texture->get_width(); float h = tex.texture->get_array_size(); if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h) { + (texel.y + offset.y) < h) + { /* LODs not supported for 1d textures. This must be zero. */ return tex.texture->read(uint(texel.x + offset.x), uint(texel.y + offset.y), 0); } @@ -491,7 +493,8 @@ inline vec _texelFetch_internal(thread _mtl_combined_image_sampler_2dget_width() >> lod; float h = tex.texture->get_height() >> lod; if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h) { + (texel.y + offset.y) < h) + { return tex.texture->read(uint2(texel + offset), lod); } else { @@ -509,7 +512,8 @@ inline vec _texelFetch_internal(thread _mtl_combined_image_sampler_2d_arra float h = tex.texture->get_height() >> lod; float d = tex.texture->get_array_size(); if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) { + (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) + { return tex.texture->read(uint2(texel.xy + offset.xy), uint(texel.z + offset.z), lod); } else { @@ -528,7 +532,8 @@ inline vec _texelFetch_internal(thread _mtl_combined_image_sampler_3dget_height() >> lod; float d = tex.texture->get_depth() >> lod; if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) { + (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) + { return tex.texture->read(uint3(texel + offset), lod); } else { @@ -547,7 +552,8 @@ inline _msl_return_float _texelFetch_internal( float w = tex.texture->get_width() >> lod; float h = tex.texture->get_height() >> lod; if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h) { + (texel.y + offset.y) < h) + { _msl_return_float fl = {tex.texture->read(uint2(texel + offset), lod)}; return fl; } @@ -568,7 +574,8 @@ inline vec _texture_internal_samp(thread _mtl_combined_image_sampler_2d_ar float h = tex.texture->get_height() >> lod; float d = tex.texture->get_array_size(); if ((texel.x + offset.x) >= 0 && (texel.x + offset.x) < w && (texel.y + offset.y) >= 0 && - (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) { + (texel.y + offset.y) < h && (texel.z + offset.z) >= 0 && (texel.z + offset.z) < d) + { return tex.texture->read(uint2(texel.xy + offset.xy), uint(texel.z + offset.z), lod); } else { @@ -923,7 +930,8 @@ inline void _texture_write_internal(thread _mtl_combined_image_sampler_2d_array< float h = tex.texture->get_height(); float d = tex.texture->get_array_size(); if (_coord.x >= 0 && _coord.x < w && _coord.y >= 0 && _coord.y < h && _coord.z >= 0 && - _coord.z < d) { + _coord.z < d) + { tex.texture->write(value, uint2(_coord.xy), _coord.z); } } @@ -937,7 +945,8 @@ inline void _texture_write_internal(thread _mtl_combined_image_sampler_3d float h = tex.texture->get_height(); float d = tex.texture->get_depth(); if (_coord.x >= 0 && _coord.x < w && _coord.y >= 0 && _coord.y < h && _coord.z >= 0 && - _coord.z < d) { + _coord.z < d) + { tex.texture->write(value, uint3(_coord.xyz)); } } @@ -1577,20 +1586,19 @@ mat3x4 MAT3x4(vec4 a, vec4 b, vec4 c) return mat3x4(a, b, c); } mat3x4 MAT3x4(float a1, - float a2, - float a3, - float a4, - float b1, - float b2, - float b3, - float b4, - float c1, - float c2, - float c3, - float c4) + float a2, + float a3, + float a4, + float b1, + float b2, + float b3, + float b4, + float c1, + float c2, + float c3, + float c4) { - return mat3x4( - vec4(a1, a2, a3, a4), vec4(b1, b2, b3, b4), vec4(c1, c2, c3, c4)); + return mat3x4(vec4(a1, a2, a3, a4), vec4(b1, b2, b3, b4), vec4(c1, c2, c3, c4)); } mat3x4 MAT3x4(float f) { @@ -1598,14 +1606,11 @@ mat3x4 MAT3x4(float f) } mat3x4 MAT3x4(mat3 m) { - return mat3x4( - vec4(m[0].xyz, 0.0), vec4(m[1].xyz, 0.0), vec4(m[2].xyz, 0.0)); + return mat3x4(vec4(m[0].xyz, 0.0), vec4(m[1].xyz, 0.0), vec4(m[2].xyz, 0.0)); } mat3x4 MAT3x4(mat2 m) { - return mat3x4(vec4(m[0].xy, 0.0, 0.0), - vec4(m[1].xy, 0.0, 0.0), - vec4(0.0, 0.0, 1.0, 0.0)); + return mat3x4(vec4(m[0].xy, 0.0, 0.0), vec4(m[1].xy, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0)); } #define MAT2 MAT2x2 diff --git a/tools/utils_maintenance/clang_format_paths.py b/tools/utils_maintenance/clang_format_paths.py index 9c8499b8897..93d541c5262 100755 --- a/tools/utils_maintenance/clang_format_paths.py +++ b/tools/utils_maintenance/clang_format_paths.py @@ -37,7 +37,7 @@ extensions = ( ".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".hxx", ".m", ".mm", - ".osl", ".glsl", + ".osl", ".glsl", ".msl", ) extensions_only_retab = (