|
@@ -14,15 +14,16 @@ declare type WebRequest = import("../../Misc/webRequest").WebRequest;
|
|
declare type LoadFileError = import("../../Misc/fileTools").LoadFileError;
|
|
declare type LoadFileError = import("../../Misc/fileTools").LoadFileError;
|
|
declare type IOfflineProvider = import("../../Offline/IOfflineProvider").IOfflineProvider;
|
|
declare type IOfflineProvider = import("../../Offline/IOfflineProvider").IOfflineProvider;
|
|
declare type IFileRequest = import("../../Misc/fileRequest").IFileRequest;
|
|
declare type IFileRequest = import("../../Misc/fileRequest").IFileRequest;
|
|
|
|
+declare type ThinEngine = import("../thinEngine").ThinEngine;
|
|
|
|
|
|
const regexSE = /defined\s*?\((.+?)\)/g;
|
|
const regexSE = /defined\s*?\((.+?)\)/g;
|
|
const regexSERevert = /defined\s*?\[(.+?)\]/g;
|
|
const regexSERevert = /defined\s*?\[(.+?)\]/g;
|
|
|
|
|
|
/** @hidden */
|
|
/** @hidden */
|
|
export class ShaderProcessor {
|
|
export class ShaderProcessor {
|
|
- public static Process(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string) => void) {
|
|
|
|
|
|
+ public static Process(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string) => void, engine: ThinEngine) {
|
|
this._ProcessIncludes(sourceCode, options, (codeWithIncludes) => {
|
|
this._ProcessIncludes(sourceCode, options, (codeWithIncludes) => {
|
|
- let migratedCode = this._ProcessShaderConversion(codeWithIncludes, options);
|
|
|
|
|
|
+ let migratedCode = this._ProcessShaderConversion(codeWithIncludes, options, engine);
|
|
callback(migratedCode);
|
|
callback(migratedCode);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -253,7 +254,7 @@ export class ShaderProcessor {
|
|
return preprocessors;
|
|
return preprocessors;
|
|
}
|
|
}
|
|
|
|
|
|
- private static _ProcessShaderConversion(sourceCode: string, options: ProcessingOptions): string {
|
|
|
|
|
|
+ private static _ProcessShaderConversion(sourceCode: string, options: ProcessingOptions, engine: ThinEngine): string {
|
|
|
|
|
|
var preparedSourceCode = this._ProcessPrecision(sourceCode, options);
|
|
var preparedSourceCode = this._ProcessPrecision(sourceCode, options);
|
|
|
|
|
|
@@ -279,7 +280,7 @@ export class ShaderProcessor {
|
|
|
|
|
|
// Post processing
|
|
// Post processing
|
|
if (options.processor.postProcessor) {
|
|
if (options.processor.postProcessor) {
|
|
- preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment);
|
|
|
|
|
|
+ preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment, engine);
|
|
}
|
|
}
|
|
|
|
|
|
return preparedSourceCode;
|
|
return preparedSourceCode;
|