Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code for PR #6500 #22

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/slang.h
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ typedef uint32_t SlangSizeT;
EmitReflectionJSON, // bool
SaveGLSLModuleBinSource,

SkipDownstreamLinking, // bool, experimental
SkipDownstreamLinking, // bool, experimental
CountOf,
};

Expand Down
21 changes: 12 additions & 9 deletions source/compiler-core/slang-downstream-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,18 @@ class IDownstreamCompiler : public ICastable
/// True if underlying compiler uses file system to communicate source
virtual SLANG_NO_THROW bool SLANG_MCALL isFileBased() = 0;

virtual SLANG_NO_THROW int SLANG_MCALL
link(const uint32_t** modules, const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact) {
SLANG_UNREFERENCED_PARAMETER(modules);
SLANG_UNREFERENCED_PARAMETER(moduleSizes);
SLANG_UNREFERENCED_PARAMETER(moduleCount);
SLANG_UNREFERENCED_PARAMETER(outArtifact);
return 0;}
virtual SLANG_NO_THROW int SLANG_MCALL link(
const uint32_t** modules,
const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact)
{
SLANG_UNREFERENCED_PARAMETER(modules);
SLANG_UNREFERENCED_PARAMETER(moduleSizes);
SLANG_UNREFERENCED_PARAMETER(moduleCount);
SLANG_UNREFERENCED_PARAMETER(outArtifact);
return 0;
}
};

class DownstreamCompilerBase : public ComBaseObject, public IDownstreamCompiler
Expand Down
16 changes: 10 additions & 6 deletions source/compiler-core/slang-glslang-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ class GlslangDownstreamCompiler : public DownstreamCompilerBase
validate(const uint32_t* contents, int contentsSize) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL
disassemble(const uint32_t* contents, int contentsSize) SLANG_OVERRIDE;
int link(const uint32_t** modules, const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact) SLANG_OVERRIDE;
int link(
const uint32_t** modules,
const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact) SLANG_OVERRIDE;

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

SlangResult GlslangDownstreamCompiler::link(const uint32_t** modules, const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact)
SlangResult GlslangDownstreamCompiler::link(
const uint32_t** modules,
const uint32_t* moduleSizes,
const uint32_t moduleCount,
IArtifact** outArtifact)
{
glslang_LinkRequest request;
memset(&request, 0, sizeof(request));
Expand Down
4 changes: 2 additions & 2 deletions source/slang/slang-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,8 @@ enum class PassThroughMode : SlangPassThroughIntegral
LLVM = SLANG_PASS_THROUGH_LLVM, ///< LLVM 'compiler'
SpirvOpt = SLANG_PASS_THROUGH_SPIRV_OPT, ///< pass thorugh spirv to spirv-opt
MetalC = SLANG_PASS_THROUGH_METAL,
Tint = SLANG_PASS_THROUGH_TINT, ///< pass through spirv to Tint API
SpirvLink = SLANG_PASS_THROUGH_SPIRV_LINK, ///< pass through spirv to spirv-link
Tint = SLANG_PASS_THROUGH_TINT, ///< pass through spirv to Tint API
SpirvLink = SLANG_PASS_THROUGH_SPIRV_LINK, ///< pass through spirv to spirv-link
CountOf = SLANG_PASS_THROUGH_COUNT_OF,
};
void printDiagnosticArg(StringBuilder& sb, PassThroughMode val);
Expand Down
3 changes: 1 addition & 2 deletions source/slang/slang-emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2134,8 +2134,7 @@ SlangResult emitSPIRVForEntryPointsDirectly(
}
}
}
}
);
});

SLANG_ASSERT(int(spirv.getCount()) % 4 == 0);
SLANG_ASSERT(spirvFiles.getCount() == spirvSizes.getCount());
Expand Down
4 changes: 3 additions & 1 deletion tools/gfx-unit-test/gfx-test-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ Slang::Result loadComputeProgram(
if (precompilationMode == PrecompilationMode::ExternalLink)
{
programDesc.downstreamLinkMode = gfx::IShaderProgram::DownstreamLinkMode::Deferred;
} else {
}
else
{
programDesc.downstreamLinkMode = gfx::IShaderProgram::DownstreamLinkMode::None;
}

Expand Down
14 changes: 7 additions & 7 deletions tools/gfx-unit-test/gfx-test-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace gfx_test
{
enum class PrecompilationMode
{
None,
SlangIR,
InternalLink,
ExternalLink,
};
enum class PrecompilationMode
{
None,
SlangIR,
InternalLink,
ExternalLink,
};
/// Helper function for print out diagnostic messages output by Slang compiler.
void diagnoseIfNeeded(slang::IBlob* diagnosticsBlob);

Expand Down
18 changes: 14 additions & 4 deletions tools/gfx-unit-test/precompiled-module-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,18 @@ SLANG_UNIT_TEST(precompiledModule2D3D12)

SLANG_UNIT_TEST(precompiledTargetModuleInternalLink2D3D12)
{
runTestImpl(precompiledTargetModule2InternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12);
runTestImpl(
precompiledTargetModule2InternalLinkTestImpl,
unitTestContext,
Slang::RenderApiFlag::D3D12);
}

/*
// Unavailable on D3D12/DXIL currently
SLANG_UNIT_TEST(precompiledTargetModuleExternalLink2D3D12)
{
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12);
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext,
Slang::RenderApiFlag::D3D12);
}
*/

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

SLANG_UNIT_TEST(precompiledTargetModule2InternalLinkVulkan)
{
runTestImpl(precompiledTargetModule2InternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan);
runTestImpl(
precompiledTargetModule2InternalLinkTestImpl,
unitTestContext,
Slang::RenderApiFlag::Vulkan);
}

SLANG_UNIT_TEST(precompiledTargetModule2ExternalLinkVulkan)
{
runTestImpl(precompiledTargetModule2ExternalLinkTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan);
runTestImpl(
precompiledTargetModule2ExternalLinkTestImpl,
unitTestContext,
Slang::RenderApiFlag::Vulkan);
}

} // namespace gfx_test
2 changes: 1 addition & 1 deletion tools/gfx/vulkan/vk-shader-program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Result ShaderProgramImpl::createShaderModule(
if (kernelCodes.getCount() == 1)
{
linkedKernel = kernelCodes[0];
}
}
else
{
linkedKernel = m_device->m_glslang.linkSPIRV(kernelCodes);
Expand Down
Loading