From f486142e367925c973d8921cd6f9b754a67c4b98 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 13 Nov 2017 09:52:35 +0100 Subject: [PATCH] Run format_all.sh. --- main.cpp | 10 +++++----- spirv_cpp.cpp | 5 +++-- spirv_cross.cpp | 16 ++++++++-------- spirv_glsl.cpp | 11 ++++++----- spirv_hlsl.cpp | 9 ++++++--- spirv_msl.cpp | 16 +++++++++------- 6 files changed, 37 insertions(+), 30 deletions(-) diff --git a/main.cpp b/main.cpp index 13d63a56..cb1abdc8 100644 --- a/main.cpp +++ b/main.cpp @@ -494,7 +494,7 @@ static void print_help() "[--flatten-multidimensional-arrays] [--no-420pack-extension] " "[--remap-variable-type ] " "[--rename-interface-variable ] " - "[--set-hlsl-vertex-input-semantic " + "[--set-hlsl-vertex-input-semantic " "\n"); } @@ -658,10 +658,10 @@ static int main_inner(int argc, char *argv[]) }); cbs.add("--remap", [&args](CLIParser &parser) { - string src = parser.next_string(); - string dst = parser.next_string(); - uint32_t components = parser.next_uint(); - args.remaps.push_back({ move(src), move(dst), components }); + string src = parser.next_string(); + string dst = parser.next_string(); + uint32_t components = parser.next_uint(); + args.remaps.push_back({ move(src), move(dst), components }); }); cbs.add("--remap-variable-type", [&args](CLIParser &parser) { diff --git a/spirv_cpp.cpp b/spirv_cpp.cpp index 9100a2ba..e65fb99c 100644 --- a/spirv_cpp.cpp +++ b/spirv_cpp.cpp @@ -171,8 +171,9 @@ void CompilerCPP::emit_resources() auto &type = get(var.basetype); if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassUniform && - !is_hidden_variable(var) && (meta[type.self].decoration.decoration_flags & - ((1ull << DecorationBlock) | (1ull << DecorationBufferBlock)))) + !is_hidden_variable(var) && + (meta[type.self].decoration.decoration_flags & + ((1ull << DecorationBlock) | (1ull << DecorationBufferBlock)))) { emit_buffer_block(var); } diff --git a/spirv_cross.cpp b/spirv_cross.cpp index e43b2dcb..70231c93 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -168,7 +168,7 @@ bool Compiler::block_is_pure(const SPIRBlock &block) case OpMemoryBarrier: return false; - // OpExtInst is potentially impure depending on extension, but GLSL builtins are at least pure. + // OpExtInst is potentially impure depending on extension, but GLSL builtins are at least pure. default: break; @@ -457,7 +457,7 @@ bool Compiler::is_hidden_variable(const SPIRVariable &var, bool include_builtins // Combined image samplers are always considered active as they are "magic" variables. if (find_if(begin(combined_image_samplers), end(combined_image_samplers), [&var](const CombinedImageSampler &samp) { return samp.combined_id == var.self; - }) != end(combined_image_samplers)) + }) != end(combined_image_samplers)) { return false; } @@ -2541,7 +2541,7 @@ SPIREntryPoint &Compiler::get_entry_point(const std::string &name) auto itr = find_if(begin(entry_points), end(entry_points), [&](const std::pair &entry) -> bool { return entry.second.orig_name == name; - }); + }); if (itr == end(entry_points)) SPIRV_CROSS_THROW("Entry point does not exist."); @@ -2554,7 +2554,7 @@ const SPIREntryPoint &Compiler::get_entry_point(const std::string &name) const auto itr = find_if(begin(entry_points), end(entry_points), [&](const std::pair &entry) -> bool { return entry.second.orig_name == name; - }); + }); if (itr == end(entry_points)) SPIRV_CROSS_THROW("Entry point does not exist."); @@ -2723,7 +2723,7 @@ void Compiler::CombinedImageSamplerHandler::register_combined_image_sampler(SPIR [¶m](const SPIRFunction::CombinedImageSamplerParameter &p) { return param.image_id == p.image_id && param.sampler_id == p.sampler_id && param.global_image == p.global_image && param.global_sampler == p.global_sampler; - }); + }); if (itr == end(caller.combined_parameters)) { @@ -2860,7 +2860,7 @@ bool Compiler::CombinedImageSamplerHandler::handle(Op opcode, const uint32_t *ar auto itr = find_if(begin(compiler.combined_image_samplers), end(compiler.combined_image_samplers), [image_id, sampler_id](const CombinedImageSampler &combined) { return combined.image_id == image_id && combined.sampler_id == sampler_id; - }); + }); if (itr == end(compiler.combined_image_samplers)) { @@ -3202,8 +3202,8 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) break; } - // Atomics shouldn't be able to access function-local variables. - // Some GLSL builtins access a pointer. + // Atomics shouldn't be able to access function-local variables. + // Some GLSL builtins access a pointer. default: break; diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index 51471edd..cf9d441e 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -2686,7 +2686,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) if (find_if(begin(header.declare_temporary), end(header.declare_temporary), [result_type, result_id](const pair &tmp) { return tmp.first == result_type && tmp.second == result_id; - }) == end(header.declare_temporary)) + }) == end(header.declare_temporary)) { header.declare_temporary.emplace_back(result_type, result_id); force_recompile = true; @@ -2913,8 +2913,9 @@ void CompilerGLSL::emit_quaternary_func_op(uint32_t result_type, uint32_t result uint32_t op2, uint32_t op3, const char *op) { bool forward = should_forward(op0) && should_forward(op1) && should_forward(op2) && should_forward(op3); - emit_op(result_type, result_id, join(op, "(", to_expression(op0), ", ", to_expression(op1), ", ", - to_expression(op2), ", ", to_expression(op3), ")"), + emit_op(result_type, result_id, + join(op, "(", to_expression(op0), ", ", to_expression(op1), ", ", to_expression(op2), ", ", + to_expression(op3), ")"), forward); inherit_expression_dependencies(result_id, op0); @@ -5882,8 +5883,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) register_read(ops[1], ops[2], should_forward(ops[2])); break; - // OpAtomicStore unimplemented. Not sure what would use that. - // OpAtomicLoad seems to only be relevant for atomic counters. + // OpAtomicStore unimplemented. Not sure what would use that. + // OpAtomicLoad seems to only be relevant for atomic counters. case OpAtomicIIncrement: forced_temporaries.insert(ops[1]); diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp index 2437e38b..cac6fda4 100644 --- a/spirv_hlsl.cpp +++ b/spirv_hlsl.cpp @@ -695,8 +695,8 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord } else { - statement(to_interpolation_qualifiers(get_decoration_mask(var.self)), variable_decl(type, name), - " : ", semantic, ";"); + statement(to_interpolation_qualifiers(get_decoration_mask(var.self)), variable_decl(type, name), " : ", + semantic, ";"); // Structs and arrays should consume more locations. uint32_t consumed_locations = type_to_consumed_locations(type); @@ -1064,7 +1064,10 @@ void CompilerHLSL::emit_resources() if (requires_op_fmod) { static const char *types[] = { - "float", "float2", "float3", "float4", + "float", + "float2", + "float3", + "float4", }; for (auto &type : types) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index f71e4e5a..a7d43ff3 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1510,7 +1510,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) emit_barrier(ops[0], ops[1], ops[2]); break; - // OpOuterProduct + // OpOuterProduct default: CompilerGLSL::emit_instruction(instruction); @@ -1815,10 +1815,10 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, break; } - // TODO: - // GLSLstd450InterpolateAtCentroid (centroid_no_perspective qualifier) - // GLSLstd450InterpolateAtSample (sample_no_perspective qualifier) - // GLSLstd450InterpolateAtOffset + // TODO: + // GLSLstd450InterpolateAtCentroid (centroid_no_perspective qualifier) + // GLSLstd450InterpolateAtSample (sample_no_perspective qualifier) + // GLSLstd450InterpolateAtOffset default: CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count); @@ -2703,11 +2703,13 @@ string CompilerMSL::ensure_valid_name(string name, string pfx) void CompilerMSL::replace_illegal_names() { static const unordered_set keywords = { - "kernel", "bias", + "kernel", + "bias", }; static const unordered_set illegal_func_names = { - "main", "saturate", + "main", + "saturate", }; for (auto &id : ids)