[flutter_tool] Allow includes relative to shader path (#107862)
This commit is contained in:
parent
6bd3e6e006
commit
e9529e2512
@ -68,6 +68,7 @@ class ShaderCompiler {
|
|||||||
'--spirv=$outputPath',
|
'--spirv=$outputPath',
|
||||||
'--input=${input.path}',
|
'--input=${input.path}',
|
||||||
'--input-type=frag',
|
'--input-type=frag',
|
||||||
|
'--include=${input.parent.path}',
|
||||||
];
|
];
|
||||||
final Process impellercProcess = await _processManager.start(cmd);
|
final Process impellercProcess = await _processManager.start(cmd);
|
||||||
final int code = await impellercProcess.exitCode;
|
final int code = await impellercProcess.exitCode;
|
||||||
|
@ -397,6 +397,7 @@ flutter:
|
|||||||
late Artifacts artifacts;
|
late Artifacts artifacts;
|
||||||
late String impellerc;
|
late String impellerc;
|
||||||
late Directory output;
|
late Directory output;
|
||||||
|
late String assetsPath;
|
||||||
late String shaderPath;
|
late String shaderPath;
|
||||||
late String outputPath;
|
late String outputPath;
|
||||||
|
|
||||||
@ -408,8 +409,9 @@ flutter:
|
|||||||
fileSystem.file(impellerc).createSync(recursive: true);
|
fileSystem.file(impellerc).createSync(recursive: true);
|
||||||
|
|
||||||
output = fileSystem.directory('asset_output')..createSync(recursive: true);
|
output = fileSystem.directory('asset_output')..createSync(recursive: true);
|
||||||
shaderPath = fileSystem.path.join('assets', 'shader.frag');
|
assetsPath = 'assets';
|
||||||
outputPath = fileSystem.path.join(output.path, 'assets', 'shader.frag');
|
shaderPath = fileSystem.path.join(assetsPath, 'shader.frag');
|
||||||
|
outputPath = fileSystem.path.join(output.path, assetsPath, 'shader.frag');
|
||||||
fileSystem.file(shaderPath).createSync(recursive: true);
|
fileSystem.file(shaderPath).createSync(recursive: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -445,6 +447,7 @@ flutter:
|
|||||||
'--spirv=$outputPath',
|
'--spirv=$outputPath',
|
||||||
'--input=/$shaderPath',
|
'--input=/$shaderPath',
|
||||||
'--input-type=frag',
|
'--input-type=frag',
|
||||||
|
'--include=/$assetsPath',
|
||||||
],
|
],
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.file(outputPath).createSync(recursive: true);
|
fileSystem.file(outputPath).createSync(recursive: true);
|
||||||
|
@ -10,6 +10,7 @@ import 'package:flutter_tools/src/build_system/targets/shader_compiler.dart';
|
|||||||
import '../../../src/common.dart';
|
import '../../../src/common.dart';
|
||||||
import '../../../src/fake_process_manager.dart';
|
import '../../../src/fake_process_manager.dart';
|
||||||
|
|
||||||
|
const String fragDir = '/shaders';
|
||||||
const String fragPath = '/shaders/my_shader.frag';
|
const String fragPath = '/shaders/my_shader.frag';
|
||||||
const String notFragPath = '/shaders/not_a_frag.file';
|
const String notFragPath = '/shaders/not_a_frag.file';
|
||||||
const String outputPath = '/output/shaders/my_shader.spv';
|
const String outputPath = '/output/shaders/my_shader.spv';
|
||||||
@ -40,6 +41,7 @@ void main() {
|
|||||||
'--spirv=$outputPath',
|
'--spirv=$outputPath',
|
||||||
'--input=$fragPath',
|
'--input=$fragPath',
|
||||||
'--input-type=frag',
|
'--input-type=frag',
|
||||||
|
'--include=$fragDir',
|
||||||
],
|
],
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.file(outputPath).createSync(recursive: true);
|
fileSystem.file(outputPath).createSync(recursive: true);
|
||||||
@ -72,6 +74,7 @@ void main() {
|
|||||||
'--spirv=$outputPath',
|
'--spirv=$outputPath',
|
||||||
'--input=$notFragPath',
|
'--input=$notFragPath',
|
||||||
'--input-type=frag',
|
'--input-type=frag',
|
||||||
|
'--include=$fragDir',
|
||||||
],
|
],
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.file(outputPath).createSync(recursive: true);
|
fileSystem.file(outputPath).createSync(recursive: true);
|
||||||
@ -104,6 +107,7 @@ void main() {
|
|||||||
'--spirv=$outputPath',
|
'--spirv=$outputPath',
|
||||||
'--input=$notFragPath',
|
'--input=$notFragPath',
|
||||||
'--input-type=frag',
|
'--input-type=frag',
|
||||||
|
'--include=$fragDir',
|
||||||
],
|
],
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user