Non-functional: Update formatting.
This commit is contained in:
parent
efaf75e620
commit
5ea59bd11b
@ -17,8 +17,8 @@
|
||||
#ifndef SPIRV_CROSS_BARRIER_HPP
|
||||
#define SPIRV_CROSS_BARRIER_HPP
|
||||
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
namespace spirv_cross
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -29,13 +29,13 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "barrier.hpp"
|
||||
#include "external_interface.h"
|
||||
#include "image.hpp"
|
||||
#include "sampler.hpp"
|
||||
#include "thread_group.hpp"
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include "external_interface.h"
|
||||
#include "barrier.hpp"
|
||||
#include "thread_group.hpp"
|
||||
#include "sampler.hpp"
|
||||
#include "image.hpp"
|
||||
|
||||
namespace internal
|
||||
{
|
||||
|
@ -17,9 +17,9 @@
|
||||
#ifndef SPIRV_CROSS_THREAD_GROUP_HPP
|
||||
#define SPIRV_CROSS_THREAD_GROUP_HPP
|
||||
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
namespace spirv_cross
|
||||
{
|
||||
@ -58,36 +58,29 @@ private:
|
||||
|
||||
void start(T *impl)
|
||||
{
|
||||
worker = std::thread([impl, this]
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
{
|
||||
std::unique_lock<std::mutex> l{ lock };
|
||||
cond.wait(l, [this]
|
||||
{
|
||||
return state != Idle;
|
||||
});
|
||||
if (state == Dying)
|
||||
break;
|
||||
}
|
||||
worker = std::thread([impl, this] {
|
||||
for (;;)
|
||||
{
|
||||
{
|
||||
std::unique_lock<std::mutex> l{ lock };
|
||||
cond.wait(l, [this] { return state != Idle; });
|
||||
if (state == Dying)
|
||||
break;
|
||||
}
|
||||
|
||||
impl->main();
|
||||
impl->main();
|
||||
|
||||
std::lock_guard<std::mutex> l{ lock };
|
||||
state = Idle;
|
||||
cond.notify_one();
|
||||
}
|
||||
});
|
||||
std::lock_guard<std::mutex> l{ lock };
|
||||
state = Idle;
|
||||
cond.notify_one();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void wait()
|
||||
{
|
||||
std::unique_lock<std::mutex> l{ lock };
|
||||
cond.wait(l, [this]
|
||||
{
|
||||
return state == Idle;
|
||||
});
|
||||
cond.wait(l, [this] { return state == Idle; });
|
||||
}
|
||||
|
||||
void run()
|
||||
|
@ -478,8 +478,7 @@ struct SPIRConstant : IVariant
|
||||
type = TypeConstant
|
||||
};
|
||||
|
||||
union Constant
|
||||
{
|
||||
union Constant {
|
||||
uint32_t u32;
|
||||
int32_t i32;
|
||||
float f32;
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#include "spirv_cross.hpp"
|
||||
#include "GLSL.std.450.h"
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
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.");
|
||||
|
@ -18,13 +18,13 @@
|
||||
#define SPIRV_CROSS_HPP
|
||||
|
||||
#include "spirv.hpp"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <unordered_set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "spirv_common.hpp"
|
||||
|
||||
|
@ -1312,8 +1312,7 @@ string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id)
|
||||
{
|
||||
auto &header = get<SPIRBlock>(current_continue_block->loop_dominator);
|
||||
if (find_if(begin(header.declare_temporary), end(header.declare_temporary),
|
||||
[result_type, result_id](const pair<uint32_t, uint32_t> &tmp)
|
||||
{
|
||||
[result_type, result_id](const pair<uint32_t, uint32_t> &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<SPIRBlock>(self);
|
||||
|
||||
// If we already have a loop dominator, we're trying to break out to merge targets
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include "spirv_cross.hpp"
|
||||
#include <sstream>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
namespace spirv_cross
|
||||
|
@ -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++;
|
||||
|
@ -18,8 +18,8 @@
|
||||
#define SPIRV_MSL_HPP
|
||||
|
||||
#include "spirv_glsl.hpp"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user