93 lines
3.4 KiB
JavaScript
93 lines
3.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.gpuCommand = exports.GPU_COMMAND = void 0;
|
|
const renderer_1 = require("@remotion/renderer");
|
|
const client_1 = require("@remotion/renderer/client");
|
|
const browser_download_bar_1 = require("./browser-download-bar");
|
|
const chalk_1 = require("./chalk");
|
|
const get_cli_options_1 = require("./get-cli-options");
|
|
const log_1 = require("./log");
|
|
const parsed_cli_1 = require("./parsed-cli");
|
|
exports.GPU_COMMAND = 'gpu';
|
|
const { enableMultiprocessOnLinuxOption, glOption, delayRenderTimeoutInMillisecondsOption, headlessOption, chromeModeOption, darkModeOption, } = client_1.BrowserSafeApis.options;
|
|
const gpuCommand = async (logLevel) => {
|
|
const { browserExecutable, disableWebSecurity, ignoreCertificateErrors, userAgent, } = (0, get_cli_options_1.getCliOptions)({
|
|
isStill: false,
|
|
logLevel,
|
|
indent: false,
|
|
});
|
|
const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const gl = glOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const puppeteerTimeout = delayRenderTimeoutInMillisecondsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const headless = headlessOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const chromeMode = chromeModeOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const darkMode = darkModeOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const onBrowserDownload = (0, browser_download_bar_1.defaultBrowserDownloadProgress)({
|
|
quiet: (0, parsed_cli_1.quietFlagProvided)(),
|
|
indent: false,
|
|
logLevel,
|
|
onProgress: () => undefined,
|
|
});
|
|
await renderer_1.RenderInternals.internalEnsureBrowser({
|
|
browserExecutable,
|
|
indent: false,
|
|
logLevel,
|
|
onBrowserDownload,
|
|
chromeMode,
|
|
});
|
|
const chromiumOptions = {
|
|
disableWebSecurity,
|
|
enableMultiProcessOnLinux,
|
|
gl,
|
|
headless,
|
|
ignoreCertificateErrors,
|
|
userAgent,
|
|
darkMode,
|
|
};
|
|
const statuses = await renderer_1.RenderInternals.getChromiumGpuInformation({
|
|
browserExecutable,
|
|
indent: false,
|
|
logLevel,
|
|
chromiumOptions,
|
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
onBrowserDownload: (0, browser_download_bar_1.defaultBrowserDownloadProgress)({
|
|
indent: false,
|
|
logLevel,
|
|
quiet: (0, parsed_cli_1.quietFlagProvided)(),
|
|
onProgress: () => undefined,
|
|
}),
|
|
chromeMode,
|
|
onLog: renderer_1.RenderInternals.defaultOnLog,
|
|
});
|
|
for (const { feature, status } of statuses) {
|
|
log_1.Log.info({ indent: false, logLevel }, `${feature}: ${colorStatus(status)}`);
|
|
}
|
|
};
|
|
exports.gpuCommand = gpuCommand;
|
|
const colorStatus = (status) => {
|
|
if (status === 'Enabled') {
|
|
return chalk_1.chalk.green(status);
|
|
}
|
|
if (status === 'Hardware accelerated') {
|
|
return chalk_1.chalk.green(status);
|
|
}
|
|
if (status === 'Disabled') {
|
|
return chalk_1.chalk.red(status);
|
|
}
|
|
if (status === 'Software only. Hardware acceleration disabled') {
|
|
return chalk_1.chalk.red(status);
|
|
}
|
|
if (status === 'Software only, hardware acceleration unavailable') {
|
|
return chalk_1.chalk.red(status);
|
|
}
|
|
return status;
|
|
};
|