diff --git a/StandAlone/DefaultResourceLimits.cpp b/StandAlone/DefaultResourceLimits.cpp index c34cb45589..66032de12e 100644 --- a/StandAlone/DefaultResourceLimits.cpp +++ b/StandAlone/DefaultResourceLimits.cpp @@ -134,7 +134,8 @@ const TBuiltInResource DefaultTBuiltInResource = { /* .generalConstantMatrixVectorIndexing = */ 1, }}; -std::string GetDefaultTBuiltInResourceString() { +std::string GetDefaultTBuiltInResourceString() +{ std::ostringstream ostream; ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n" diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 73b3e5e732..5e0b31e9d6 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -41,7 +41,8 @@ namespace { using CompileToAstTest = GlslangTest<::testing::TestWithParam>; -TEST_P(CompileToAstTest, FromFile) { +TEST_P(CompileToAstTest, FromFile) +{ loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), Semantics::OpenGL, Target::AST); } diff --git a/gtests/BuiltInResource.FromFile.cpp b/gtests/BuiltInResource.FromFile.cpp index 59ce63207f..c2d2b8b60b 100644 --- a/gtests/BuiltInResource.FromFile.cpp +++ b/gtests/BuiltInResource.FromFile.cpp @@ -44,7 +44,8 @@ namespace { using DefaultResourceTest = GlslangTest<::testing::Test>; -TEST_F(DefaultResourceTest, FromFile) { +TEST_F(DefaultResourceTest, FromFile) +{ const std::string path = GLSLANG_TEST_DIRECTORY "/baseResults/test.conf"; std::string expectedConfig; tryLoadFile(path, "expected resource limit", &expectedConfig); diff --git a/gtests/Initializer.h b/gtests/Initializer.h index 5a1679a637..e8fa30d1a4 100644 --- a/gtests/Initializer.h +++ b/gtests/Initializer.h @@ -53,7 +53,8 @@ namespace glslangtest { // gets fixed. class GlslangInitializer { public: - GlslangInitializer() : lastMessages(EShMsgDefault) { + GlslangInitializer() : lastMessages(EShMsgDefault) + { glslang::InitializeProcess(); } @@ -64,14 +65,16 @@ class GlslangInitializer { class InitializationToken { public: InitializationToken() : initializer(nullptr) {} - ~InitializationToken() { + ~InitializationToken() + { if (initializer) { initializer->release(); } } InitializationToken(InitializationToken&& other) - : initializer(other.initializer) { + : initializer(other.initializer) + { other.initializer = nullptr; } @@ -89,7 +92,8 @@ class GlslangInitializer { // exclusive until the Initialization Token has been destroyed. // Re-initializes glsl state iff the previous messages and the current // messages are incompatible. - InitializationToken acquire(EShMessages new_messages) { + InitializationToken acquire(EShMessages new_messages) + { stateLock.lock(); if ((lastMessages ^ new_messages) & diff --git a/gtests/Pp.FromFile.cpp b/gtests/Pp.FromFile.cpp index edfaa63511..cfd987ba8e 100644 --- a/gtests/Pp.FromFile.cpp +++ b/gtests/Pp.FromFile.cpp @@ -41,7 +41,8 @@ namespace { using PreprocessingTest = GlslangTest<::testing::TestWithParam>; -TEST_P(PreprocessingTest, FromFile) { +TEST_P(PreprocessingTest, FromFile) +{ loadFilePreprocessAndCheck(GLSLANG_TEST_DIRECTORY, GetParam()); } diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index bfba916077..14b066678f 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -46,14 +46,16 @@ using VulkanSemantics = GlslangTest<::testing::TestWithParam>; // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully // generate SPIR-V. -TEST_P(CompileToSpirvTest, FromFile) { +TEST_P(CompileToSpirvTest, FromFile) +{ loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), Semantics::Vulkan, Target::Spirv); } // GLSL-level Vulkan semantics test. Expected to error out before generating // SPIR-V. -TEST_P(VulkanSemantics, FromFile) { +TEST_P(VulkanSemantics, FromFile) +{ loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), Semantics::Vulkan, Target::Spirv); } diff --git a/gtests/TestFixture.cpp b/gtests/TestFixture.cpp index 24368a23d0..744fa558f3 100644 --- a/gtests/TestFixture.cpp +++ b/gtests/TestFixture.cpp @@ -37,7 +37,8 @@ namespace glslangtest { std::string FileNameAsCustomTestName( - const ::testing::TestParamInfo& info) { + const ::testing::TestParamInfo& info) +{ std::string name = info.param; // A valid test case suffix cannot have '.' and '-' inside. std::replace(name.begin(), name.end(), '.', '_'); @@ -45,7 +46,8 @@ std::string FileNameAsCustomTestName( return name; } -EShLanguage GetGlslLanguageForStage(const std::string& stage) { +EShLanguage GetGlslLanguageForStage(const std::string& stage) +{ if (stage == "vert") { return EShLangVertex; } else if (stage == "tesc") { @@ -65,7 +67,8 @@ EShLanguage GetGlslLanguageForStage(const std::string& stage) { } EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, - Target target) { + Target target) +{ EShMessages result = EShMsgDefault; switch (target) { @@ -88,7 +91,8 @@ EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, return result; } -std::pair ReadFile(const std::string& path) { +std::pair ReadFile(const std::string& path) +{ std::ifstream fstream(path, std::ios::in); if (fstream) { std::string contents; @@ -102,7 +106,8 @@ std::pair ReadFile(const std::string& path) { return std::make_pair(false, ""); } -bool WriteFile(const std::string& path, const std::string& contents) { +bool WriteFile(const std::string& path, const std::string& contents) +{ std::ofstream fstream(path, std::ios::out); if (!fstream) return false; fstream << contents; @@ -110,7 +115,8 @@ bool WriteFile(const std::string& path, const std::string& contents) { return true; } -std::string GetSuffix(const std::string& name) { +std::string GetSuffix(const std::string& name) +{ const size_t pos = name.rfind('.'); return (pos == std::string::npos) ? "" : name.substr(name.rfind('.') + 1); } diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index fe83c7a342..ea4b29b3fa 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -116,7 +116,8 @@ class GlslangTest : public GT { // Tries to load the contents from the file at the given |path|. On success, // writes the contents into |contents|. On failure, errors out. void tryLoadFile(const std::string& path, const std::string& tag, - std::string* contents) { + std::string* contents) + { bool fileReadOk; std::tie(fileReadOk, *contents) = ReadFile(path); ASSERT_TRUE(fileReadOk) << "Cannot open " << tag << " file: " << path; @@ -127,7 +128,8 @@ class GlslangTest : public GT { // |real| to the given file named as |fname| if update mode is on. void checkEqAndUpdateIfRequested(const std::string& expected, const std::string& real, - const std::string& fname) { + const std::string& fname) + { // In order to output the message we want under proper circumstances, we // need the following operator<< stuff. EXPECT_EQ(expected, real) @@ -164,7 +166,8 @@ class GlslangTest : public GT { // the result and returns disassembly text. GlslangResult compileGlsl(const std::string& source, const std::string& stage, Semantics semantics, - Target target) { + Target target) + { const char* shaderStrings = source.data(); const int shaderLengths = static_cast(source.size()); const EShLanguage language = GetGlslLanguageForStage(stage); @@ -203,7 +206,8 @@ class GlslangTest : public GT { void loadFileCompileAndCheck(const std::string& testDir, const std::string& testName, - Semantics semantics, Target target) { + Semantics semantics, Target target) + { const std::string inputFname = testDir + "/" + testName; const std::string expectedOutputFname = testDir + "/baseResults/" + testName + ".out"; @@ -242,7 +246,8 @@ class GlslangTest : public GT { // preprocessed shader, and warning messages. Otherwise, returns false, an // empty string, and error messages. std::tuple preprocessGlsl( - const std::string& source) { + const std::string& source) + { const char* shaderStrings = source.data(); const int shaderLengths = static_cast(source.size()); @@ -264,7 +269,8 @@ class GlslangTest : public GT { } void loadFilePreprocessAndCheck(const std::string& testDir, - const std::string& testName) { + const std::string& testName) + { const std::string inputFname = testDir + "/" + testName; const std::string expectedOutputFname = testDir + "/baseResults/" + testName + ".out"; diff --git a/gtests/main.cpp b/gtests/main.cpp index 5f5fe7a053..b9806aa255 100644 --- a/gtests/main.cpp +++ b/gtests/main.cpp @@ -39,7 +39,8 @@ #include "Initializer.h" #include "Settings.h" -int main(int argc, char** argv) { +int main(int argc, char** argv) +{ ::testing::InitGoogleTest(&argc, argv); std::unique_ptr initializer(