Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2019-06-21 17:02:22 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2019-06-21 17:02:22 +0300
commitb4e016374901f6cf95051d1147fc9f20d640f15d (patch)
tree1e6c26d9fd1c898d2d67b9d205b4fad282e736e9
parent2b11b331d66ce4b0571b51a4a060c1e2624a886e (diff)
Run format_all.sh.2019-06-21
-rw-r--r--spirv_cross.cpp3
-rw-r--r--spirv_glsl.cpp18
-rw-r--r--spirv_glsl.hpp3
-rw-r--r--spirv_msl.cpp38
-rw-r--r--spirv_msl.hpp6
5 files changed, 35 insertions, 33 deletions
diff --git a/spirv_cross.cpp b/spirv_cross.cpp
index 1bead6cd..4011c849 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 @@ bool Compiler::type_is_array_of_pointers(const SPIRType &type) const
// 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 cd76982c..abc05e1a 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -288,7 +288,7 @@ static uint32_t pls_format_to_components(PlsFormat format)
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 @@ std::string CompilerGLSL::convert_separate_image_to_expression(uint32_t id)
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 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
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 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
{
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 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
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 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
}
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 be51eb4e..45a8654c 100644
--- a/spirv_glsl.hpp
+++ b/spirv_glsl.hpp
@@ -263,8 +263,7 @@ protected:
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 b0f8262c..b3097ab8 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -1971,8 +1971,8 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch)
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 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
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 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
// 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 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
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 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
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 @@ uint32_t CompilerMSL::get_metal_resource_index(SPIRVariable &var, SPIRType::Base
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 @@ void CompilerMSL::remap_constexpr_sampler(uint32_t id, const MSLConstexprSampler
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 @@ size_t CompilerMSL::InternalHasher::operator()(const StageSetBinding &value) con
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 0a296061..5a059235 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 @@ protected:
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,