From 79e6a73da8de5a33687efb081a908f62f1f0acb8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Lachowicz Date: Tue, 23 Dec 2025 16:04:53 +0100 Subject: [PATCH 1/4] Show preprocess output in asm view --- lib/compilers/nsc-spirv.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/compilers/nsc-spirv.ts b/lib/compilers/nsc-spirv.ts index 1ab0d7e1732..0e978202eca 100644 --- a/lib/compilers/nsc-spirv.ts +++ b/lib/compilers/nsc-spirv.ts @@ -153,7 +153,9 @@ export class NSCSPIRVCompiler extends BaseCompiler { const ppFilename = path.join(sourceDir, this.outputFilebase + '.i'); if (await utils.fileExists(ppFilename)) { const ppText = await fs.readFile(ppFilename, 'utf8'); - result.stdout = result.stdout.concat(utils.parseOutput(ppText)); + result.asm = utils.parseOutput(ppText); + } else { + result.asm = utils.parseOutput(''); } result.languageId = 'hlsl'; return result; From 9795456ceea5cfebd1804aaa29677ef361aa1006 Mon Sep 17 00:00:00 2001 From: Arkadiusz Lachowicz Date: Tue, 23 Dec 2025 18:15:55 +0100 Subject: [PATCH 2/4] Keep preprocess output in asm view --- lib/compilers/nsc-spirv.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/compilers/nsc-spirv.ts b/lib/compilers/nsc-spirv.ts index 0e978202eca..c139b8e11ff 100644 --- a/lib/compilers/nsc-spirv.ts +++ b/lib/compilers/nsc-spirv.ts @@ -153,11 +153,13 @@ export class NSCSPIRVCompiler extends BaseCompiler { const ppFilename = path.join(sourceDir, this.outputFilebase + '.i'); if (await utils.fileExists(ppFilename)) { const ppText = await fs.readFile(ppFilename, 'utf8'); - result.asm = utils.parseOutput(ppText); + result.asm = ppText; } else { - result.asm = utils.parseOutput(''); + result.asm = ''; } result.languageId = 'hlsl'; + result.okToCache = false; + (result as any).preprocessOnly = true; return result; } @@ -246,4 +248,16 @@ export class NSCSPIRVCompiler extends BaseCompiler { asm: ir.asm, }; } + + override async postProcess( + result, + outputFilename: string, + filters: ParseFiltersAndOutputOptions, + produceOptRemarks = false, + ) { + if ((result as any).preprocessOnly) { + return [result, [], []]; + } + return super.postProcess(result, outputFilename, filters, produceOptRemarks); + } } From be54f23571a5a69231ef3810d49960bec8d7695d Mon Sep 17 00:00:00 2001 From: Arkadiusz Lachowicz Date: Tue, 23 Dec 2025 18:48:13 +0100 Subject: [PATCH 3/4] Fix nsc-spirv postProcess tuple types --- lib/compilers/nsc-spirv.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/compilers/nsc-spirv.ts b/lib/compilers/nsc-spirv.ts index c139b8e11ff..3a216c016e7 100644 --- a/lib/compilers/nsc-spirv.ts +++ b/lib/compilers/nsc-spirv.ts @@ -25,12 +25,14 @@ import path from 'path'; import fs from 'fs/promises'; -import type {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js'; +import type {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js'; import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js'; import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; import {BaseCompiler} from '../base-compiler.js'; import {logger} from '../logger.js'; import {SPIRVAsmParser} from '../parsers/asm-parser-spirv.js'; +import type {OptRemark} from '../../static/panes/opt-view.interfaces.js'; +import type * as StackUsage from '../parsers/stackusage.js'; import * as utils from '../utils.js'; import {splitArguments} from '../../shared/common-utils.js'; import {unwrap} from '../assert.js'; @@ -250,13 +252,13 @@ export class NSCSPIRVCompiler extends BaseCompiler { } override async postProcess( - result, + result: CompilationResult, outputFilename: string, filters: ParseFiltersAndOutputOptions, produceOptRemarks = false, - ) { + ): Promise<[CompilationResult, OptRemark[], StackUsage.StackUsageInfo[]]> { if ((result as any).preprocessOnly) { - return [result, [], []]; + return [result, [] as OptRemark[], [] as StackUsage.StackUsageInfo[]]; } return super.postProcess(result, outputFilename, filters, produceOptRemarks); } From 52fac3b4601a1aa1ceefb9ddaa01971ea26d11f6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Lachowicz Date: Tue, 23 Dec 2025 18:53:38 +0100 Subject: [PATCH 4/4] Fix stack usage type import for nsc-spirv --- lib/compilers/nsc-spirv.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compilers/nsc-spirv.ts b/lib/compilers/nsc-spirv.ts index 3a216c016e7..fa13b0690d9 100644 --- a/lib/compilers/nsc-spirv.ts +++ b/lib/compilers/nsc-spirv.ts @@ -32,7 +32,7 @@ import {BaseCompiler} from '../base-compiler.js'; import {logger} from '../logger.js'; import {SPIRVAsmParser} from '../parsers/asm-parser-spirv.js'; import type {OptRemark} from '../../static/panes/opt-view.interfaces.js'; -import type * as StackUsage from '../parsers/stackusage.js'; +import type {StackUsageInfo} from '../stack-usage-transformer.js'; import * as utils from '../utils.js'; import {splitArguments} from '../../shared/common-utils.js'; import {unwrap} from '../assert.js'; @@ -256,9 +256,9 @@ export class NSCSPIRVCompiler extends BaseCompiler { outputFilename: string, filters: ParseFiltersAndOutputOptions, produceOptRemarks = false, - ): Promise<[CompilationResult, OptRemark[], StackUsage.StackUsageInfo[]]> { + ): Promise<[CompilationResult, OptRemark[], StackUsageInfo[]]> { if ((result as any).preprocessOnly) { - return [result, [] as OptRemark[], [] as StackUsage.StackUsageInfo[]]; + return [result, [] as OptRemark[], [] as StackUsageInfo[]]; } return super.postProcess(result, outputFilename, filters, produceOptRemarks); }