Skip to content

Commit a5a6099

Browse files
authored
Merge pull request #20 from slangbot/format-6500-cheneym2/spvlink2
Format code for PR #6500
2 parents 8bccaf8 + c01c497 commit a5a6099

9 files changed

+53
-35
lines changed

include/slang.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ typedef uint32_t SlangSizeT;
10101010
EmitReflectionJSON, // bool
10111011
SaveGLSLModuleBinSource,
10121012

1013-
SkipDownstreamLinking, // bool, experimental
1013+
SkipDownstreamLinking, // bool, experimental
10141014
CountOf,
10151015
};
10161016

source/compiler-core/slang-downstream-compiler.h

+12-9
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,18 @@ class IDownstreamCompiler : public ICastable
344344
/// True if underlying compiler uses file system to communicate source
345345
virtual SLANG_NO_THROW bool SLANG_MCALL isFileBased() = 0;
346346

347-
virtual SLANG_NO_THROW int SLANG_MCALL
348-
link(const uint32_t** modules, const uint32_t* moduleSizes,
349-
const uint32_t moduleCount,
350-
IArtifact** outArtifact) {
351-
SLANG_UNREFERENCED_PARAMETER(modules);
352-
SLANG_UNREFERENCED_PARAMETER(moduleSizes);
353-
SLANG_UNREFERENCED_PARAMETER(moduleCount);
354-
SLANG_UNREFERENCED_PARAMETER(outArtifact);
355-
return 0;}
347+
virtual SLANG_NO_THROW int SLANG_MCALL link(
348+
const uint32_t** modules,
349+
const uint32_t* moduleSizes,
350+
const uint32_t moduleCount,
351+
IArtifact** outArtifact)
352+
{
353+
SLANG_UNREFERENCED_PARAMETER(modules);
354+
SLANG_UNREFERENCED_PARAMETER(moduleSizes);
355+
SLANG_UNREFERENCED_PARAMETER(moduleCount);
356+
SLANG_UNREFERENCED_PARAMETER(outArtifact);
357+
return 0;
358+
}
356359
};
357360

358361
class DownstreamCompilerBase : public ComBaseObject, public IDownstreamCompiler

source/compiler-core/slang-glslang-compiler.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ class GlslangDownstreamCompiler : public DownstreamCompilerBase
4949
validate(const uint32_t* contents, int contentsSize) SLANG_OVERRIDE;
5050
virtual SLANG_NO_THROW SlangResult SLANG_MCALL
5151
disassemble(const uint32_t* contents, int contentsSize) SLANG_OVERRIDE;
52-
int link(const uint32_t** modules, const uint32_t* moduleSizes,
53-
const uint32_t moduleCount,
54-
IArtifact** outArtifact) SLANG_OVERRIDE;
52+
int link(
53+
const uint32_t** modules,
54+
const uint32_t* moduleSizes,
55+
const uint32_t moduleCount,
56+
IArtifact** outArtifact) SLANG_OVERRIDE;
5557

5658
/// Must be called before use
5759
SlangResult init(ISlangSharedLibrary* library);
@@ -328,9 +330,11 @@ SlangResult GlslangDownstreamCompiler::disassemble(const uint32_t* contents, int
328330
return SLANG_FAIL;
329331
}
330332

331-
SlangResult GlslangDownstreamCompiler::link(const uint32_t** modules, const uint32_t* moduleSizes,
332-
const uint32_t moduleCount,
333-
IArtifact** outArtifact)
333+
SlangResult GlslangDownstreamCompiler::link(
334+
const uint32_t** modules,
335+
const uint32_t* moduleSizes,
336+
const uint32_t moduleCount,
337+
IArtifact** outArtifact)
334338
{
335339
glslang_LinkRequest request;
336340
memset(&request, 0, sizeof(request));

source/slang/slang-compiler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1384,8 +1384,8 @@ enum class PassThroughMode : SlangPassThroughIntegral
13841384
LLVM = SLANG_PASS_THROUGH_LLVM, ///< LLVM 'compiler'
13851385
SpirvOpt = SLANG_PASS_THROUGH_SPIRV_OPT, ///< pass thorugh spirv to spirv-opt
13861386
MetalC = SLANG_PASS_THROUGH_METAL,
1387-
Tint = SLANG_PASS_THROUGH_TINT, ///< pass through spirv to Tint API
1388-
SpirvLink = SLANG_PASS_THROUGH_SPIRV_LINK, ///< pass through spirv to spirv-link
1387+
Tint = SLANG_PASS_THROUGH_TINT, ///< pass through spirv to Tint API
1388+
SpirvLink = SLANG_PASS_THROUGH_SPIRV_LINK, ///< pass through spirv to spirv-link
13891389
CountOf = SLANG_PASS_THROUGH_COUNT_OF,
13901390
};
13911391
void printDiagnosticArg(StringBuilder& sb, PassThroughMode val);

source/slang/slang-emit.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -2134,8 +2134,7 @@ SlangResult emitSPIRVForEntryPointsDirectly(
21342134
}
21352135
}
21362136
}
2137-
}
2138-
);
2137+
});
21392138

21402139
SLANG_ASSERT(int(spirv.getCount()) % 4 == 0);
21412140
SLANG_ASSERT(spirvFiles.size() == spirvSizes.size());
@@ -2144,15 +2143,15 @@ SlangResult emitSPIRVForEntryPointsDirectly(
21442143
(const uint32_t*)spirvSizes.data(),
21452144
(uint32_t)spirvFiles.size(),
21462145
linkedArtifact.writeRef());
2147-
2146+
21482147
if (linkresult != SLANG_OK)
21492148
{
21502149
return SLANG_FAIL;
21512150
}
21522151

21532152
ComPtr<ISlangBlob> blob;
21542153
linkedArtifact->loadBlob(ArtifactKeep::No, blob.writeRef());
2155-
2154+
21562155
artifact = _Move(linkedArtifact);
21572156
}
21582157

tools/gfx-unit-test/gfx-test-util.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ Slang::Result loadComputeProgram(
119119
if (precompilationMode == PrecompilationMode::ExternalLink)
120120
{
121121
programDesc.downstreamLinkMode = gfx::IShaderProgram::DownstreamLinkMode::Deferred;
122-
} else {
122+
}
123+
else
124+
{
123125
programDesc.downstreamLinkMode = gfx::IShaderProgram::DownstreamLinkMode::None;
124126
}
125127

tools/gfx-unit-test/gfx-test-util.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
namespace gfx_test
99
{
10-
enum class PrecompilationMode
11-
{
12-
None,
13-
SlangIR,
14-
InternalLink,
15-
ExternalLink,
16-
};
10+
enum class PrecompilationMode
11+
{
12+
None,
13+
SlangIR,
14+
InternalLink,
15+
ExternalLink,
16+
};
1717
/// Helper function for print out diagnostic messages output by Slang compiler.
1818
void diagnoseIfNeeded(slang::IBlob* diagnosticsBlob);
1919

tools/gfx-unit-test/precompiled-module-2.cpp

+14-4
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,18 @@ SLANG_UNIT_TEST(precompiledModule2D3D12)
241241

242242
SLANG_UNIT_TEST(precompiledTargetModuleInternalLink2D3D12)
243243
{
244-
runTestImpl(precompiledTargetModule2InternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12);
244+
runTestImpl(
245+
precompiledTargetModule2InternalLinkTestImpl,
246+
unitTestContext,
247+
Slang::RenderApiFlag::D3D12);
245248
}
246249

247250
/*
248251
// Unavailable on D3D12/DXIL currently
249252
SLANG_UNIT_TEST(precompiledTargetModuleExternalLink2D3D12)
250253
{
251-
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12);
254+
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext,
255+
Slang::RenderApiFlag::D3D12);
252256
}
253257
*/
254258

@@ -259,12 +263,18 @@ SLANG_UNIT_TEST(precompiledModule2Vulkan)
259263

260264
SLANG_UNIT_TEST(precompiledTargetModule2InternalLinkVulkan)
261265
{
262-
runTestImpl(precompiledTargetModule2InternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan);
266+
runTestImpl(
267+
precompiledTargetModule2InternalLinkTestImpl,
268+
unitTestContext,
269+
Slang::RenderApiFlag::Vulkan);
263270
}
264271

265272
SLANG_UNIT_TEST(precompiledTargetModule2ExternalLinkVulkan)
266273
{
267-
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan);
274+
runTestImpl(
275+
precompiledTargetModule2ExternalLinkTestImpl,
276+
unitTestContext,
277+
Slang::RenderApiFlag::Vulkan);
268278
}
269279

270280
} // namespace gfx_test

tools/gfx/vulkan/vk-shader-program.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Result ShaderProgramImpl::createShaderModule(
8080
if (kernelCodes.getCount() == 1)
8181
{
8282
linkedKernel = kernelCodes[0];
83-
}
83+
}
8484
else
8585
{
8686
linkedKernel = m_device->m_glslang.linkSPIRV(kernelCodes);

0 commit comments

Comments
 (0)