Run format_all.sh.
diff --git a/spirv_cross.cpp b/spirv_cross.cpp
index 1bead6c..4011c84 100644
--- a/spirv_cross.cpp
+++ b/spirv_cross.cpp
@@ -17,8 +17,8 @@
#include "spirv_cross.hpp"
#include "GLSL.std.450.h"
#include "spirv_cfg.hpp"
-#include "spirv_parser.hpp"
#include "spirv_common.hpp"
+#include "spirv_parser.hpp"
#include <algorithm>
#include <cstring>
#include <utility>
@@ -4406,4 +4406,3 @@
// If parent type has same pointer depth, we must have an array of pointers.
return type.pointer_depth == get<SPIRType>(type.parent_type).pointer_depth;
}
-
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index cd76982..abc05e1 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -288,7 +288,7 @@
static const char *vector_swizzle(int vecsize, int index)
{
- static const char * const swizzle[4][4] = {
+ static const char *const swizzle[4][4] = {
{ ".x", ".y", ".z", ".w" },
{ ".xy", ".yz", ".zw", nullptr },
{ ".xyz", ".yzw", nullptr, nullptr },
@@ -4885,7 +4885,8 @@
string CompilerGLSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather,
bool is_proj, uint32_t coord, uint32_t coord_components, uint32_t dref,
uint32_t grad_x, uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset,
- uint32_t bias, uint32_t comp, uint32_t sample, uint32_t /*minlod*/, bool *p_forward)
+ uint32_t bias, uint32_t comp, uint32_t sample, uint32_t /*minlod*/,
+ bool *p_forward)
{
string farg_str;
if (is_fetch)
@@ -11488,8 +11489,8 @@
case SPIRBlock::MultiSelect:
{
auto &type = expression_type(block.condition);
- bool unsigned_case = type.basetype == SPIRType::UInt || type.basetype == SPIRType::UShort ||
- type.basetype == SPIRType::UByte;
+ bool unsigned_case =
+ type.basetype == SPIRType::UInt || type.basetype == SPIRType::UShort || type.basetype == SPIRType::UByte;
if (block.merge == SPIRBlock::MergeNone)
SPIRV_CROSS_THROW("Switch statement is not structured");
@@ -11609,7 +11610,8 @@
{
auto &negative_literals = case_constructs[block_declaration_order[j]];
for (auto &case_label : negative_literals)
- conditions.push_back(join(to_enclosed_expression(block.condition), " != ", to_case_label(case_label, unsigned_case)));
+ conditions.push_back(join(to_enclosed_expression(block.condition),
+ " != ", to_case_label(case_label, unsigned_case)));
}
statement("if (", merge(conditions, " && "), ")");
@@ -11622,7 +11624,8 @@
SmallVector<string> conditions;
conditions.reserve(literals.size());
for (auto &case_label : literals)
- conditions.push_back(join(to_enclosed_expression(block.condition), " == ", to_case_label(case_label, unsigned_case)));
+ conditions.push_back(join(to_enclosed_expression(block.condition),
+ " == ", to_case_label(case_label, unsigned_case)));
statement("if (", merge(conditions, " || "), ")");
begin_scope();
flush_phi(block.self, target_block);
@@ -11658,7 +11661,8 @@
}
auto &case_block = get<SPIRBlock>(target_block);
- if (i + 1 < num_blocks && execution_is_direct_branch(case_block, get<SPIRBlock>(block_declaration_order[i + 1])))
+ if (i + 1 < num_blocks &&
+ execution_is_direct_branch(case_block, get<SPIRBlock>(block_declaration_order[i + 1])))
{
// We will fall through here, so just terminate the block chain early.
// We still need to deal with Phi potentially.
diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp
index be51eb4..45a8654 100644
--- a/spirv_glsl.hpp
+++ b/spirv_glsl.hpp
@@ -263,8 +263,7 @@
bool is_proj, uint32_t coord, uint32_t coord_components, uint32_t dref,
uint32_t grad_x, uint32_t grad_y, uint32_t lod, uint32_t coffset,
uint32_t offset, uint32_t bias, uint32_t comp, uint32_t sample,
- uint32_t minlod,
- bool *p_forward);
+ uint32_t minlod, bool *p_forward);
virtual void emit_buffer_block(const SPIRVariable &type);
virtual void emit_push_constant_block(const SPIRVariable &var);
virtual void emit_uniform(const SPIRVariable &var);
diff --git a/spirv_msl.cpp b/spirv_msl.cpp
index b0f8262..b3097ab 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -1971,8 +1971,8 @@
bool is_interface_block_builtin =
(bi_type == BuiltInPosition || bi_type == BuiltInPointSize || bi_type == BuiltInClipDistance ||
bi_type == BuiltInCullDistance || bi_type == BuiltInLayer || bi_type == BuiltInViewportIndex ||
- bi_type == BuiltInBaryCoordNV || bi_type == BuiltInBaryCoordNoPerspNV ||
- bi_type == BuiltInFragDepth || bi_type == BuiltInFragStencilRefEXT || bi_type == BuiltInSampleMask) ||
+ bi_type == BuiltInBaryCoordNV || bi_type == BuiltInBaryCoordNoPerspNV || bi_type == BuiltInFragDepth ||
+ bi_type == BuiltInFragStencilRefEXT || bi_type == BuiltInSampleMask) ||
(get_execution_model() == ExecutionModelTessellationEvaluation &&
(bi_type == BuiltInTessLevelOuter || bi_type == BuiltInTessLevelInner));
@@ -3872,11 +3872,11 @@
auto store_type = texel_type;
store_type.vecsize = 4;
- statement(join(
- to_expression(img_id), ".write(", remap_swizzle(store_type, texel_type.vecsize, to_expression(texel_id)),
- ", ",
- to_function_args(img_id, img_type, true, false, false, coord_id, 0, 0, 0, 0, lod, 0, 0, 0, 0, 0, 0, &forward),
- ");"));
+ statement(join(to_expression(img_id), ".write(",
+ remap_swizzle(store_type, texel_type.vecsize, to_expression(texel_id)), ", ",
+ to_function_args(img_id, img_type, true, false, false, coord_id, 0, 0, 0, 0, lod, 0, 0, 0, 0, 0,
+ 0, &forward),
+ ");"));
if (p_var && variable_storage_is_aliased(*p_var))
flush_all_aliased_variables();
@@ -3947,12 +3947,10 @@
// the reported LOD based on the sampler. NEAREST miplevel should
// round the LOD, but LINEAR miplevel should not round.
// Let's hope this does not become an issue ...
- statement(to_expression(id), ".x = ",
- image_expr, ".calculate_clamped_lod(",
- sampler_expr, ", ", to_expression(coord_id), ");");
- statement(to_expression(id), ".y = ",
- image_expr, ".calculate_unclamped_lod(",
- sampler_expr, ", ", to_expression(coord_id), ");");
+ statement(to_expression(id), ".x = ", image_expr, ".calculate_clamped_lod(", sampler_expr, ", ",
+ to_expression(coord_id), ");");
+ statement(to_expression(id), ".y = ", image_expr, ".calculate_unclamped_lod(", sampler_expr, ", ",
+ to_expression(coord_id), ");");
register_control_dependent_expression(id);
break;
}
@@ -5492,8 +5490,8 @@
bool is_builtin = is_member_builtin(type, index, &builtin);
if (has_extended_member_decoration(type.self, index, SPIRVCrossDecorationResourceIndexPrimary))
- return join(" [[id(", get_extended_member_decoration(type.self, index, SPIRVCrossDecorationResourceIndexPrimary),
- ")]]");
+ return join(" [[id(",
+ get_extended_member_decoration(type.self, index, SPIRVCrossDecorationResourceIndexPrimary), ")]]");
// Vertex function inputs
if (execution.model == ExecutionModelVertex && type.storage == StorageClassInput)
@@ -5664,7 +5662,8 @@
has_member_decoration(type.self, index, DecorationNoPerspective))
{
// NoPerspective is baked into the builtin type.
- SPIRV_CROSS_THROW("Flat, Centroid, Sample, NoPerspective decorations are not supported for BaryCoord inputs.");
+ SPIRV_CROSS_THROW(
+ "Flat, Centroid, Sample, NoPerspective decorations are not supported for BaryCoord inputs.");
}
}
@@ -6510,7 +6509,8 @@
auto itr = resource_bindings.find({ execution.model, var_desc_set, var_binding });
auto resource_decoration = var_type.basetype == SPIRType::SampledImage && basetype == SPIRType::Sampler ?
- SPIRVCrossDecorationResourceIndexSecondary : SPIRVCrossDecorationResourceIndexPrimary;
+ SPIRVCrossDecorationResourceIndexSecondary :
+ SPIRVCrossDecorationResourceIndexPrimary;
if (itr != end(resource_bindings))
{
@@ -8489,7 +8489,8 @@
constexpr_samplers_by_id[id] = sampler;
}
-void CompilerMSL::remap_constexpr_sampler_by_binding(uint32_t desc_set, uint32_t binding, const MSLConstexprSampler &sampler)
+void CompilerMSL::remap_constexpr_sampler_by_binding(uint32_t desc_set, uint32_t binding,
+ const MSLConstexprSampler &sampler)
{
constexpr_samplers_by_binding[{ desc_set, binding }] = sampler;
}
@@ -8872,4 +8873,3 @@
auto tmp_hash = (hash_model * 0x10001b31) ^ hash_set;
return (tmp_hash * 0x10001b31) ^ value.binding;
}
-
diff --git a/spirv_msl.hpp b/spirv_msl.hpp
index 0a29606..5a05923 100644
--- a/spirv_msl.hpp
+++ b/spirv_msl.hpp
@@ -20,9 +20,9 @@
#include "spirv_glsl.hpp"
#include <map>
#include <set>
+#include <stddef.h>
#include <unordered_map>
#include <unordered_set>
-#include <stddef.h>
namespace SPIRV_CROSS_NAMESPACE
{
@@ -410,8 +410,8 @@
std::string to_func_call_arg(uint32_t id) override;
std::string to_name(uint32_t id, bool allow_alias = true) const override;
std::string to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
- bool has_array_offsets, bool has_offset, bool has_grad, bool has_dref,
- uint32_t lod, uint32_t minlod) override;
+ bool has_array_offsets, bool has_offset, bool has_grad, bool has_dref, uint32_t lod,
+ uint32_t minlod) override;
std::string to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
uint32_t coord, uint32_t coord_components, uint32_t dref, uint32_t grad_x,
uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,