|
25 | 25 | import path from 'path'; |
26 | 26 | import fs from 'fs/promises'; |
27 | 27 |
|
28 | | -import type {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js'; |
| 28 | +import type {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js'; |
29 | 29 | import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js'; |
30 | 30 | import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; |
31 | 31 | import {BaseCompiler} from '../base-compiler.js'; |
32 | 32 | import {logger} from '../logger.js'; |
33 | 33 | import {SPIRVAsmParser} from '../parsers/asm-parser-spirv.js'; |
| 34 | +import type {OptRemark} from '../../static/panes/opt-view.interfaces.js'; |
| 35 | +import type {StackUsageInfo} from '../stack-usage-transformer.js'; |
34 | 36 | import * as utils from '../utils.js'; |
35 | 37 | import {splitArguments} from '../../shared/common-utils.js'; |
36 | 38 | import {unwrap} from '../assert.js'; |
@@ -153,9 +155,13 @@ export class NSCSPIRVCompiler extends BaseCompiler { |
153 | 155 | const ppFilename = path.join(sourceDir, this.outputFilebase + '.i'); |
154 | 156 | if (await utils.fileExists(ppFilename)) { |
155 | 157 | const ppText = await fs.readFile(ppFilename, 'utf8'); |
156 | | - result.stdout = result.stdout.concat(utils.parseOutput(ppText)); |
| 158 | + result.asm = ppText; |
| 159 | + } else { |
| 160 | + result.asm = '<No preprocessed output file>'; |
157 | 161 | } |
158 | 162 | result.languageId = 'hlsl'; |
| 163 | + result.okToCache = false; |
| 164 | + (result as any).preprocessOnly = true; |
159 | 165 | return result; |
160 | 166 | } |
161 | 167 |
|
@@ -244,4 +250,16 @@ export class NSCSPIRVCompiler extends BaseCompiler { |
244 | 250 | asm: ir.asm, |
245 | 251 | }; |
246 | 252 | } |
| 253 | + |
| 254 | + override async postProcess( |
| 255 | + result: CompilationResult, |
| 256 | + outputFilename: string, |
| 257 | + filters: ParseFiltersAndOutputOptions, |
| 258 | + produceOptRemarks = false, |
| 259 | + ): Promise<[CompilationResult, OptRemark[], StackUsageInfo[]]> { |
| 260 | + if ((result as any).preprocessOnly) { |
| 261 | + return [result, [] as OptRemark[], [] as StackUsageInfo[]]; |
| 262 | + } |
| 263 | + return super.postProcess(result, outputFilename, filters, produceOptRemarks); |
| 264 | + } |
247 | 265 | } |
0 commit comments