Move tint compiler to Web package
This commit is contained in:
@@ -37,27 +37,5 @@ public class ShaderCompilerWebGPU : ShaderCompiler
|
|||||||
options.PrivateDependencies.Add("glslang");
|
options.PrivateDependencies.Add("glslang");
|
||||||
options.PrivateDependencies.Add("spirv-tools");
|
options.PrivateDependencies.Add("spirv-tools");
|
||||||
options.PrivateDependencies.Add("lz4");
|
options.PrivateDependencies.Add("lz4");
|
||||||
|
|
||||||
// Deploy tint executable as a dependency for the shader compilation from SPIR-V into WGSL
|
|
||||||
// Tint compiler from: https://github.com/google/dawn/releases
|
|
||||||
// License: Source/ThirdParty/tint-license.txt (BSD 3-Clause)
|
|
||||||
if (options.Target.IsPreBuilt)
|
|
||||||
return;
|
|
||||||
var depsRoot = options.DepsFolder;
|
|
||||||
switch (options.Platform.Target)
|
|
||||||
{
|
|
||||||
case TargetPlatform.Windows:
|
|
||||||
if (options.Architecture == TargetArchitecture.x64)
|
|
||||||
options.DependencyFiles.Add(Path.Combine(depsRoot, "tint.exe"));
|
|
||||||
break;
|
|
||||||
case TargetPlatform.Linux:
|
|
||||||
if (options.Architecture == TargetArchitecture.x64)
|
|
||||||
options.DependencyFiles.Add(Path.Combine(depsRoot, "tint"));
|
|
||||||
break;
|
|
||||||
case TargetPlatform.Mac:
|
|
||||||
if (options.Architecture == TargetArchitecture.ARM64)
|
|
||||||
options.DependencyFiles.Add(Path.Combine(depsRoot, "tint"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,9 @@ bool ShaderCompilerWebGPU::Write(ShaderCompilationContext* context, ShaderFuncti
|
|||||||
if (!context->Options->NoOptimize)
|
if (!context->Options->NoOptimize)
|
||||||
procSettings.Arguments += TEXT(" --minify");
|
procSettings.Arguments += TEXT(" --minify");
|
||||||
procSettings.Arguments += TEXT(" --allow-non-uniform-derivatives"); // Fix sampling texture within non-uniform control flow
|
procSettings.Arguments += TEXT(" --allow-non-uniform-derivatives"); // Fix sampling texture within non-uniform control flow
|
||||||
|
procSettings.FileName = Globals::StartupFolder / String::Format(TEXT("Source/Platforms/Web/Binaries/Tools/Windows/x64/tint"), ToString(PLATFORM_TYPE), ToString(PLATFORM_ARCH));
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
procSettings.FileName = Globals::BinariesFolder / TEXT("tint.exe");
|
procSettings.FileName += TEXT(".exe");
|
||||||
#else
|
|
||||||
procSettings.FileName = Globals::BinariesFolder / TEXT("tint");
|
|
||||||
#endif
|
#endif
|
||||||
int32 result = Platform::CreateProcess(procSettings);
|
int32 result = Platform::CreateProcess(procSettings);
|
||||||
StringAnsi wgsl;
|
StringAnsi wgsl;
|
||||||
|
|||||||
@@ -119,18 +119,18 @@ namespace Flax.Deps.Dependencies
|
|||||||
BuildCmake(buildDir, config, options: Utilities.RunOptions.ConsoleLogOutput);
|
BuildCmake(buildDir, config, options: Utilities.RunOptions.ConsoleLogOutput);
|
||||||
|
|
||||||
// Deploy executable
|
// Deploy executable
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var dstFolder = Path.Combine(GetBinariesFolder(options, TargetPlatform.Web), "Tools", platform.ToString(), architecture.ToString());
|
||||||
switch (platform)
|
switch (platform)
|
||||||
{
|
{
|
||||||
case TargetPlatform.Windows:
|
case TargetPlatform.Windows:
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, config, "tint.exe"), Path.Combine(depsFolder, "tint.exe"));
|
Utilities.FileCopy(Path.Combine(buildDir, config, "tint.exe"), Path.Combine(dstFolder, "tint.exe"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, "tint"), Path.Combine(depsFolder, "tint"));
|
Utilities.FileCopy(Path.Combine(buildDir, "tint"), Path.Combine(dstFolder, "tint"));
|
||||||
if (BuildPlatform != TargetPlatform.Windows)
|
if (BuildPlatform != TargetPlatform.Windows)
|
||||||
{
|
{
|
||||||
Utilities.Run("chmod", "+x tint", null, depsFolder, Utilities.RunOptions.ConsoleLogOutput);
|
Utilities.Run("chmod", "+x tint", null, dstFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||||
Utilities.Run("strip", "tint", null, depsFolder, Utilities.RunOptions.ConsoleLogOutput);
|
Utilities.Run("strip", "tint", null, dstFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user