Skip to content

Commit

Permalink
Run format_all.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKristian-Work committed Apr 4, 2018
1 parent 1d082e9 commit 382101b
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion format_all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

for file in spirv_*.{cpp,hpp} include/spirv_cross/*.{hpp,h} samples/cpp/*.cpp main.cpp
#for file in spirv_*.{cpp,hpp} include/spirv_cross/*.{hpp,h} samples/cpp/*.cpp main.cpp
for file in spirv_*.{cpp,hpp} main.cpp
do
echo "Formatting file: $file ..."
clang-format -style=file -i $file
Expand Down
2 changes: 1 addition & 1 deletion spirv_cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,4 @@ void DominatorBuilder::lift_continue_block_dominator()
if (back_edge_dominator)
dominator = cfg.get_function().entry_block;
}
}
} // namespace spirv_cross
2 changes: 1 addition & 1 deletion spirv_cfg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ class DominatorBuilder
const CFG &cfg;
uint32_t dominator = 0;
};
}
} // namespace spirv_cross

#endif
4 changes: 2 additions & 2 deletions spirv_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void join_helper(std::ostringstream &stream, T &&t, Ts &&... ts)
stream << std::forward<T>(t);
join_helper(stream, std::forward<Ts>(ts)...);
}
}
} // namespace inner

class Bitset
{
Expand Down Expand Up @@ -1257,6 +1257,6 @@ static inline bool type_is_floating_point(const SPIRType &type)
{
return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double;
}
}
} // namespace spirv_cross

#endif
2 changes: 1 addition & 1 deletion spirv_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ class CompilerCPP : public CompilerGLSL

std::string interface_name;
};
}
} // namespace spirv_cross

#endif
2 changes: 1 addition & 1 deletion spirv_cross.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,6 @@ class Compiler
void fixup_type_alias();
bool type_is_block_like(const SPIRType &type) const;
};
}
} // namespace spirv_cross

#endif
2 changes: 1 addition & 1 deletion spirv_cross_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ void rename_interface_variable(spirv_cross::Compiler &compiler, const std::vecto
compiler.set_name(v.id, name);
}
}
}
} // namespace spirv_cross_util
2 changes: 1 addition & 1 deletion spirv_glsl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,6 @@ class CompilerGLSL : public Compiler
}
}
};
}
} // namespace spirv_cross

#endif
4 changes: 2 additions & 2 deletions spirv_hlsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1996,8 +1996,8 @@ void CompilerHLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
{
// Manufacture automatic sampler arg for SampledImage texture
decl += ", ";
decl +=
join(arg_type.image.depth ? "SamplerComparisonState " : "SamplerState ", to_sampler_expression(arg.id), type_to_array_glsl(arg_type));
decl += join(arg_type.image.depth ? "SamplerComparisonState " : "SamplerState ",
to_sampler_expression(arg.id), type_to_array_glsl(arg_type));
}

if (&arg != &func.arguments.back())
Expand Down
2 changes: 1 addition & 1 deletion spirv_hlsl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,6 @@ class CompilerHLSL : public CompilerGLSL
// when translating push constant ranges.
std::vector<RootConstants> root_constants_layout;
};
}
} // namespace spirv_cross

#endif
13 changes: 6 additions & 7 deletions spirv_msl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3224,10 +3224,8 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
auto &type = expression_type(arg.id);
bool constref = !arg.alias_global_variable && (!type.pointer || arg.write_count == 0);

bool type_is_image =
type.basetype == SPIRType::Image ||
type.basetype == SPIRType::SampledImage ||
type.basetype == SPIRType::Sampler;
bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage ||
type.basetype == SPIRType::Sampler;

// Arrays of images/samplers in MSL are always const.
if (!type.array.empty() && type_is_image)
Expand Down Expand Up @@ -3464,8 +3462,8 @@ std::string CompilerMSL::sampler_type(const SPIRType &type)
parent = &get<SPIRType>(parent->parent_type);
parent = &get<SPIRType>(parent->parent_type);

uint32_t array_size = type.array_size_literal.back() ?
type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
uint32_t array_size =
type.array_size_literal.back() ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();

if (array_size == 0)
SPIRV_CROSS_THROW("Unsized array of samplers is not supported in MSL.");
Expand All @@ -3486,7 +3484,8 @@ string CompilerMSL::image_type_glsl(const SPIRType &type, uint32_t id)
parent = &get<SPIRType>(parent->parent_type);
parent = &get<SPIRType>(parent->parent_type);

uint32_t array_size = type.array_size_literal.back() ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
uint32_t array_size =
type.array_size_literal.back() ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
if (array_size == 0)
SPIRV_CROSS_THROW("Unsized array of images is not supported in MSL.");
return join("array<", image_type_glsl(*parent, id), ", ", array_size, ">");
Expand Down
5 changes: 3 additions & 2 deletions spirv_msl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class CompilerMSL : public CompilerGLSL
// Options for compiling to Metal Shading Language
struct Options
{
typedef enum {
typedef enum
{
iOS,
macOS,
} Platform;
Expand Down Expand Up @@ -346,6 +347,6 @@ class CompilerMSL : public CompilerGLSL
SortAspect sort_aspect;
};
};
}
} // namespace spirv_cross

#endif

0 comments on commit 382101b

Please sign in to comment.