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("spirv-tools");
|
||||
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)
|
||||
procSettings.Arguments += TEXT(" --minify");
|
||||
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
|
||||
procSettings.FileName = Globals::BinariesFolder / TEXT("tint.exe");
|
||||
#else
|
||||
procSettings.FileName = Globals::BinariesFolder / TEXT("tint");
|
||||
procSettings.FileName += TEXT(".exe");
|
||||
#endif
|
||||
int32 result = Platform::CreateProcess(procSettings);
|
||||
StringAnsi wgsl;
|
||||
|
||||
@@ -119,18 +119,18 @@ namespace Flax.Deps.Dependencies
|
||||
BuildCmake(buildDir, config, options: Utilities.RunOptions.ConsoleLogOutput);
|
||||
|
||||
// Deploy executable
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
var dstFolder = Path.Combine(GetBinariesFolder(options, TargetPlatform.Web), "Tools", platform.ToString(), architecture.ToString());
|
||||
switch (platform)
|
||||
{
|
||||
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;
|
||||
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)
|
||||
{
|
||||
Utilities.Run("chmod", "+x tint", null, depsFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.Run("strip", "tint", null, depsFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.Run("chmod", "+x tint", null, dstFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Utilities.Run("strip", "tint", null, dstFolder, Utilities.RunOptions.ConsoleLogOutput);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user