[CodingStandard] Turn on Cpp11BracedListStyle in clang-format
Related work item: Github #24
This commit is contained in:
Родитель
2c45bad9e6
Коммит
e0a8f7f04a
|
@ -5,7 +5,7 @@ AllowShortLoopsOnASingleLine: false
|
|||
AlwaysBreakTemplateDeclarations: true
|
||||
BreakBeforeBraces: Allman
|
||||
ColumnLimit: 140
|
||||
Cpp11BracedListStyle: false
|
||||
Cpp11BracedListStyle: true
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: 2
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace ShaderConductor
|
|||
bool disableOptimizations = false; // Force to turn off optimizations. Ignore optimizationLevel below.
|
||||
|
||||
int optimizationLevel = 3; // 0 to 3, no optimization to most optimization
|
||||
ShaderModel shaderModel = { 6, 0 };
|
||||
ShaderModel shaderModel = {6, 0};
|
||||
|
||||
int shiftAllTexturesBindings;
|
||||
int shiftAllSamplersBindings;
|
||||
|
|
|
@ -444,7 +444,7 @@ namespace
|
|||
valueUtf16 = nullptr;
|
||||
}
|
||||
|
||||
dxcDefines.push_back({ nameUtf16, valueUtf16 });
|
||||
dxcDefines.push_back({nameUtf16, valueUtf16});
|
||||
}
|
||||
|
||||
CComPtr<IDxcBlobEncoding> sourceBlob;
|
||||
|
@ -473,7 +473,7 @@ namespace
|
|||
|
||||
if (options.enable16bitTypes)
|
||||
{
|
||||
if (options.shaderModel >= Compiler::ShaderModel{ 6, 2 })
|
||||
if (options.shaderModel >= Compiler::ShaderModel{6, 2})
|
||||
{
|
||||
dxcArgStrings.push_back(L"-enable-16bit-types");
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace
|
|||
void HlslToAnyTest(const std::string& name, const Compiler::SourceDesc& source, const Compiler::Options& options,
|
||||
const std::vector<Compiler::TargetDesc>& targets, const std::vector<bool>& expectSuccessFlags)
|
||||
{
|
||||
static const std::string extMap[] = { "dxil", "spv", "hlsl", "glsl", "essl", "msl", "msl" };
|
||||
static const std::string extMap[] = {"dxil", "spv", "hlsl", "glsl", "essl", "msl", "msl"};
|
||||
static_assert(sizeof(extMap) / sizeof(extMap[0]) == static_cast<uint32_t>(ShadingLanguage::NumShadingLanguages),
|
||||
"extMap doesn't match with the number of shading languages.");
|
||||
|
||||
|
@ -121,14 +121,14 @@ namespace
|
|||
std::vector<uint8_t> input = LoadFile(inputFileName, true);
|
||||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
const auto result = Compiler::Compile({ source.c_str(), inputFileName.c_str(), "", ShaderStage::PixelShader }, {}, target);
|
||||
const auto result = Compiler::Compile({source.c_str(), inputFileName.c_str(), "", ShaderStage::PixelShader}, {}, target);
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_FALSE(result.isText);
|
||||
|
||||
DestroyBlob(result.errorWarningMsg);
|
||||
|
||||
return { moduleName, result.target };
|
||||
return {moduleName, result.target};
|
||||
}
|
||||
|
||||
class TestBase : public testing::Test
|
||||
|
@ -290,7 +290,7 @@ namespace
|
|||
}
|
||||
|
||||
private:
|
||||
std::vector<MacroDefine> defines_ = { { "FIXED_VERTEX_RADIUS", "5.0" } };
|
||||
std::vector<MacroDefine> defines_ = {{"FIXED_VERTEX_RADIUS", "5.0"}};
|
||||
};
|
||||
|
||||
class HullShaderTest : public TestBase
|
||||
|
@ -389,8 +389,8 @@ namespace
|
|||
Compiler::Options options;
|
||||
options.packMatricesInRowMajor = false;
|
||||
|
||||
HlslToAnyTest("Transform_VS_ColumnMajor", { source.c_str(), fileName.c_str(), nullptr, ShaderStage::VertexShader }, options,
|
||||
{ { ShadingLanguage::Glsl, "300" } }, { true });
|
||||
HlslToAnyTest("Transform_VS_ColumnMajor", {source.c_str(), fileName.c_str(), nullptr, ShaderStage::VertexShader}, options,
|
||||
{{ShadingLanguage::Glsl, "300"}}, {true});
|
||||
}
|
||||
|
||||
TEST_F(VertexShaderTest, ToEssl)
|
||||
|
@ -516,7 +516,7 @@ namespace
|
|||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
const auto result =
|
||||
Compiler::Compile({ source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader }, {}, { ShadingLanguage::Glsl, "30" });
|
||||
Compiler::Compile({source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader}, {}, {ShadingLanguage::Glsl, "30"});
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_EQ(result.errorWarningMsg, nullptr);
|
||||
|
@ -537,7 +537,7 @@ namespace
|
|||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
const auto result =
|
||||
Compiler::Compile({ source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader }, {}, { ShadingLanguage::Glsl, "30" });
|
||||
Compiler::Compile({source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader}, {}, {ShadingLanguage::Glsl, "30"});
|
||||
|
||||
EXPECT_TRUE(result.hasError);
|
||||
const char* errorStr = reinterpret_cast<const char*>(result.errorWarningMsg->Data());
|
||||
|
@ -555,7 +555,7 @@ namespace
|
|||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
const auto result =
|
||||
Compiler::Compile({ source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader }, {}, { ShadingLanguage::Glsl, "30" });
|
||||
Compiler::Compile({source.c_str(), fileName.c_str(), "main", ShaderStage::PixelShader}, {}, {ShadingLanguage::Glsl, "30"});
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_EQ(result.errorWarningMsg, nullptr);
|
||||
|
@ -576,11 +576,11 @@ namespace
|
|||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
Compiler::Options option;
|
||||
option.shaderModel = { 6, 2 };
|
||||
option.shaderModel = {6, 2};
|
||||
option.enable16bitTypes = true;
|
||||
|
||||
const auto result = Compiler::Compile({ source.c_str(), fileName.c_str(), "DotHalfPS", ShaderStage::PixelShader }, option,
|
||||
{ ShadingLanguage::Glsl, "30" });
|
||||
const auto result = Compiler::Compile({source.c_str(), fileName.c_str(), "DotHalfPS", ShaderStage::PixelShader}, option,
|
||||
{ShadingLanguage::Glsl, "30"});
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_TRUE(result.isText);
|
||||
|
@ -600,11 +600,11 @@ namespace
|
|||
const std::string source = std::string(reinterpret_cast<char*>(input.data()), input.size());
|
||||
|
||||
Compiler::Options option;
|
||||
option.shaderModel = { 6, 2 };
|
||||
option.shaderModel = {6, 2};
|
||||
option.enable16bitTypes = true;
|
||||
|
||||
const auto result = Compiler::Compile({ source.c_str(), fileName.c_str(), "HalfOutParamPS", ShaderStage::PixelShader }, option,
|
||||
{ ShadingLanguage::Glsl, "30" });
|
||||
const auto result = Compiler::Compile({source.c_str(), fileName.c_str(), "HalfOutParamPS", ShaderStage::PixelShader}, option,
|
||||
{ShadingLanguage::Glsl, "30"});
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_TRUE(result.isText);
|
||||
|
@ -623,7 +623,7 @@ namespace
|
|||
GTEST_SKIP_("Link is not supported on this platform");
|
||||
}
|
||||
|
||||
const Compiler::TargetDesc target = { ShadingLanguage::Dxil, "", true };
|
||||
const Compiler::TargetDesc target = {ShadingLanguage::Dxil, "", true};
|
||||
const Compiler::ModuleDesc dxilModules[] = {
|
||||
CompileToModule("CalcLight", TEST_DATA_DIR "Input/CalcLight.hlsl", target),
|
||||
CompileToModule("CalcLightDiffuse", TEST_DATA_DIR "Input/CalcLightDiffuse.hlsl", target),
|
||||
|
@ -631,21 +631,21 @@ namespace
|
|||
};
|
||||
|
||||
const Compiler::ModuleDesc* testModules[][2] = {
|
||||
{ &dxilModules[0], &dxilModules[1] },
|
||||
{ &dxilModules[0], &dxilModules[2] },
|
||||
{&dxilModules[0], &dxilModules[1]},
|
||||
{&dxilModules[0], &dxilModules[2]},
|
||||
};
|
||||
|
||||
#ifdef NDEBUG
|
||||
const std::string expectedNames[] = { "CalcLight+Diffuse.Release.dxilasm", "CalcLight+DiffuseSpecular.Release.dxilasm" };
|
||||
const std::string expectedNames[] = {"CalcLight+Diffuse.Release.dxilasm", "CalcLight+DiffuseSpecular.Release.dxilasm"};
|
||||
#else
|
||||
const std::string expectedNames[] = { "CalcLight+Diffuse.Debug.dxilasm", "CalcLight+DiffuseSpecular.Debug.dxilasm" };
|
||||
const std::string expectedNames[] = {"CalcLight+Diffuse.Debug.dxilasm", "CalcLight+DiffuseSpecular.Debug.dxilasm"};
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
const auto linkedResult =
|
||||
Compiler::Link({ "main", ShaderStage::PixelShader, testModules[i], sizeof(testModules[i]) / sizeof(testModules[i][0]) }, {},
|
||||
{ ShadingLanguage::Dxil, "" });
|
||||
Compiler::Link({"main", ShaderStage::PixelShader, testModules[i], sizeof(testModules[i]) / sizeof(testModules[i][0])}, {},
|
||||
{ShadingLanguage::Dxil, ""});
|
||||
|
||||
EXPECT_FALSE(linkedResult.hasError);
|
||||
EXPECT_FALSE(linkedResult.isText);
|
||||
|
|
|
@ -145,7 +145,7 @@ int main(int argc, char** argv)
|
|||
std::string outputName;
|
||||
if (opts.count("output") == 0)
|
||||
{
|
||||
static const std::string extMap[] = { "dxil", "spv", "hlsl", "glsl", "essl", "msl", "msl" };
|
||||
static const std::string extMap[] = {"dxil", "spv", "hlsl", "glsl", "essl", "msl", "msl"};
|
||||
static_assert(sizeof(extMap) / sizeof(extMap[0]) == static_cast<uint32_t>(ShadingLanguage::NumShadingLanguages),
|
||||
"extMap doesn't match with the number of shading languages.");
|
||||
outputName = fileName + "." + extMap[static_cast<uint32_t>(targetDesc.language)];
|
||||
|
|
|
@ -45,7 +45,7 @@ void Compile(SourceDescription* source, OptionsDescription* optionsDesc, TargetD
|
|||
options.enableDebugInfo = optionsDesc->enableDebugInfo;
|
||||
options.disableOptimizations = optionsDesc->disableOptimizations;
|
||||
options.optimizationLevel = optionsDesc->optimizationLevel;
|
||||
options.shaderModel = { static_cast<uint8_t>(optionsDesc->shaderModel.major), static_cast<uint8_t>(optionsDesc->shaderModel.minor) };
|
||||
options.shaderModel = {static_cast<uint8_t>(optionsDesc->shaderModel.major), static_cast<uint8_t>(optionsDesc->shaderModel.minor)};
|
||||
options.shiftAllTexturesBindings = optionsDesc->shiftAllTexturesBindings;
|
||||
options.shiftAllSamplersBindings = optionsDesc->shiftAllSamplersBindings;
|
||||
options.shiftAllCBuffersBindings = optionsDesc->shiftAllCBuffersBindings;
|
||||
|
|
|
@ -52,7 +52,7 @@ struct OptionsDescription
|
|||
bool disableOptimizations = false; // Force to turn off optimizations. Ignore optimizationLevel below.
|
||||
int optimizationLevel = 3; // 0 to 3, no optimization to most optimization
|
||||
|
||||
ShaderModel shaderModel = { 6, 0 };
|
||||
ShaderModel shaderModel = {6, 0};
|
||||
|
||||
int shiftAllTexturesBindings;
|
||||
int shiftAllSamplersBindings;
|
||||
|
|
Загрузка…
Ссылка в новой задаче