From 5ea59bd11b8d12ef40f3318d39ca4d95432ac432 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 23 May 2016 13:30:02 +0200 Subject: [PATCH] Non-functional: Update formatting. --- include/spirv_cross/barrier.hpp | 2 +- include/spirv_cross/external_interface.h | 3 +- include/spirv_cross/internal_interface.hpp | 10 +++--- include/spirv_cross/thread_group.hpp | 41 +++++++++------------- spirv_common.hpp | 3 +- spirv_cross.cpp | 7 ++-- spirv_cross.hpp | 10 +++--- spirv_glsl.cpp | 37 ++++++++----------- spirv_glsl.hpp | 2 +- spirv_msl.cpp | 3 +- spirv_msl.hpp | 2 +- 11 files changed, 50 insertions(+), 70 deletions(-) diff --git a/include/spirv_cross/barrier.hpp b/include/spirv_cross/barrier.hpp index 0d77b862..db7cd87e 100644 --- a/include/spirv_cross/barrier.hpp +++ b/include/spirv_cross/barrier.hpp @@ -17,8 +17,8 @@ #ifndef SPIRV_CROSS_BARRIER_HPP #define SPIRV_CROSS_BARRIER_HPP -#include #include +#include namespace spirv_cross { diff --git a/include/spirv_cross/external_interface.h b/include/spirv_cross/external_interface.h index a0067fc1..3e7b1f8b 100644 --- a/include/spirv_cross/external_interface.h +++ b/include/spirv_cross/external_interface.h @@ -44,8 +44,7 @@ void spirv_cross_set_resource(spirv_cross_shader_t *thiz, unsigned set, unsigned const struct spirv_cross_interface *spirv_cross_get_interface(void); -typedef enum spirv_cross_builtin -{ +typedef enum spirv_cross_builtin { SPIRV_CROSS_BUILTIN_POSITION = 0, SPIRV_CROSS_BUILTIN_FRAG_COORD = 1, SPIRV_CROSS_BUILTIN_WORK_GROUP_ID = 2, diff --git a/include/spirv_cross/internal_interface.hpp b/include/spirv_cross/internal_interface.hpp index c3cbdcd5..3b53aa1a 100644 --- a/include/spirv_cross/internal_interface.hpp +++ b/include/spirv_cross/internal_interface.hpp @@ -29,13 +29,13 @@ #include +#include "barrier.hpp" +#include "external_interface.h" +#include "image.hpp" +#include "sampler.hpp" +#include "thread_group.hpp" #include #include -#include "external_interface.h" -#include "barrier.hpp" -#include "thread_group.hpp" -#include "sampler.hpp" -#include "image.hpp" namespace internal { diff --git a/include/spirv_cross/thread_group.hpp b/include/spirv_cross/thread_group.hpp index 81a9bf36..7aab9595 100644 --- a/include/spirv_cross/thread_group.hpp +++ b/include/spirv_cross/thread_group.hpp @@ -17,9 +17,9 @@ #ifndef SPIRV_CROSS_THREAD_GROUP_HPP #define SPIRV_CROSS_THREAD_GROUP_HPP -#include #include #include +#include namespace spirv_cross { @@ -58,36 +58,29 @@ private: void start(T *impl) { - worker = std::thread([impl, this] - { - for (;;) - { - { - std::unique_lock l{ lock }; - cond.wait(l, [this] - { - return state != Idle; - }); - if (state == Dying) - break; - } + worker = std::thread([impl, this] { + for (;;) + { + { + std::unique_lock l{ lock }; + cond.wait(l, [this] { return state != Idle; }); + if (state == Dying) + break; + } - impl->main(); + impl->main(); - std::lock_guard l{ lock }; - state = Idle; - cond.notify_one(); - } - }); + std::lock_guard l{ lock }; + state = Idle; + cond.notify_one(); + } + }); } void wait() { std::unique_lock l{ lock }; - cond.wait(l, [this] - { - return state == Idle; - }); + cond.wait(l, [this] { return state == Idle; }); } void run() diff --git a/spirv_common.hpp b/spirv_common.hpp index 1ae15c31..7de8aa18 100644 --- a/spirv_common.hpp +++ b/spirv_common.hpp @@ -478,8 +478,7 @@ struct SPIRConstant : IVariant type = TypeConstant }; - union Constant - { + union Constant { uint32_t u32; int32_t i32; float f32; diff --git a/spirv_cross.cpp b/spirv_cross.cpp index fbb397ca..e9a1a67d 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -16,8 +16,8 @@ #include "spirv_cross.hpp" #include "GLSL.std.450.h" -#include #include +#include #include using namespace std; @@ -523,10 +523,7 @@ void Compiler::parse() // Endian-swap if we need to. if (s[0] == swap_endian(MagicNumber)) - transform(begin(spirv), end(spirv), begin(spirv), [](uint32_t c) - { - return swap_endian(c); - }); + transform(begin(spirv), end(spirv), begin(spirv), [](uint32_t c) { return swap_endian(c); }); if (s[0] != MagicNumber || !is_valid_spirv_version(s[1])) throw CompilerError("Invalid SPIRV format."); diff --git a/spirv_cross.hpp b/spirv_cross.hpp index 8ee7422a..28b04abc 100644 --- a/spirv_cross.hpp +++ b/spirv_cross.hpp @@ -18,13 +18,13 @@ #define SPIRV_CROSS_HPP #include "spirv.hpp" -#include -#include -#include #include -#include -#include +#include +#include #include +#include +#include +#include #include "spirv_common.hpp" diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index 3241a8e0..271c21ac 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -1312,8 +1312,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) { auto &header = get(current_continue_block->loop_dominator); if (find_if(begin(header.declare_temporary), end(header.declare_temporary), - [result_type, result_id](const pair &tmp) - { + [result_type, result_id](const pair &tmp) { return tmp.first == result_type && tmp.second == result_id; }) == end(header.declare_temporary)) { @@ -1546,8 +1545,7 @@ void CompilerGLSL::emit_mix_op(uint32_t result_type, uint32_t id, uint32_t left, expr = join(to_expression(lerp), " ? ", to_expression(right), " : ", to_expression(left)); else { - auto swiz = [this](uint32_t expression, uint32_t i) - { + auto swiz = [this](uint32_t expression, uint32_t i) { return join(to_expression(expression), ".", index_to_swizzle(i)); }; @@ -1686,8 +1684,7 @@ void CompilerGLSL::emit_texture_op(const Instruction &i) length--; } - auto test = [&](uint32_t &v, uint32_t flag) - { + auto test = [&](uint32_t &v, uint32_t flag) { if (length && (flags & flag)) { v = *opt++; @@ -1736,8 +1733,7 @@ void CompilerGLSL::emit_texture_op(const Instruction &i) expr += to_expression(img); bool swizz_func = backend.swizzle_is_function; - auto swizzle = [swizz_func](uint32_t comps, uint32_t in_comps) -> const char * - { + auto swizzle = [swizz_func](uint32_t comps, uint32_t in_comps) -> const char * { if (comps == in_comps) return ""; @@ -2993,7 +2989,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; case OpFDiv: - BOP(/ ); + BOP(/); break; case OpShiftRightLogical: @@ -3062,7 +3058,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; case OpLogicalOr: - BOP(|| ); + BOP(||); break; case OpLogicalAnd: @@ -3088,7 +3084,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(equal); else - BOP(== ); + BOP(==); break; } @@ -3107,7 +3103,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(notEqual); else - BOP(!= ); + BOP(!=); break; } @@ -3127,7 +3123,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(greaterThan); else - BOP(> ); + BOP(>); break; } @@ -3147,7 +3143,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(greaterThanEqual); else - BOP(>= ); + BOP(>=); break; } @@ -3167,7 +3163,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(lessThan); else - BOP(< ); + BOP(<); break; } @@ -3187,7 +3183,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (expression_type(ops[2]).vecsize > 1) BFOP(lessThanEqual); else - BOP(<= ); + BOP(<=); break; } @@ -3460,10 +3456,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) { // PLS input could have different number of components than what the SPIR expects, swizzle to // the appropriate vector size. - auto itr = find_if(begin(pls_inputs), end(pls_inputs), [var](const PlsRemap &pls) - { - return pls.id == var->self; - }); + auto itr = + find_if(begin(pls_inputs), end(pls_inputs), [var](const PlsRemap &pls) { return pls.id == var->self; }); if (itr == end(pls_inputs)) throw CompilerError("Found PLS remap for OpImageRead, but ID is not a PLS input ..."); @@ -4285,8 +4279,7 @@ void CompilerGLSL::propagate_loop_dominators(const SPIRBlock &block) { uint32_t dominator = block.merge == SPIRBlock::MergeLoop ? block.self : block.loop_dominator; - auto set_dominator = [this](uint32_t self, uint32_t new_dominator) - { + auto set_dominator = [this](uint32_t self, uint32_t new_dominator) { auto &dominated_block = this->get(self); // If we already have a loop dominator, we're trying to break out to merge targets diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index 93b6a7b6..5332b3ee 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -19,8 +19,8 @@ #include "spirv_cross.hpp" #include -#include #include +#include #include namespace spirv_cross diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 51eabf01..e1dc474a 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -595,8 +595,7 @@ void CompilerMSL::emit_texture_op(const Instruction &i) length--; } - auto test = [&](uint32_t &v, uint32_t flag) - { + auto test = [&](uint32_t &v, uint32_t flag) { if (length && (flags & flag)) { v = *opt++; diff --git a/spirv_msl.hpp b/spirv_msl.hpp index d379c98a..0837e630 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -18,8 +18,8 @@ #define SPIRV_MSL_HPP #include "spirv_glsl.hpp" -#include #include +#include namespace spirv_cross {