@@ -240,13 +240,11 @@ export const GPU_FUNCTIONS: CompiledFunctions<Expression> = {
240240
241241 // Complex-specific functions
242242 Re : ( args , compile ) => {
243- if ( BaseCompiler . isComplexValued ( args [ 0 ] ) )
244- return `(${ compile ( args [ 0 ] ) } ).x` ;
243+ if ( BaseCompiler . isComplexValued ( args [ 0 ] ) ) return `(${ compile ( args [ 0 ] ) } ).x` ;
245244 return compile ( args [ 0 ] ) ;
246245 } ,
247246 Im : ( args , compile ) => {
248- if ( BaseCompiler . isComplexValued ( args [ 0 ] ) )
249- return `(${ compile ( args [ 0 ] ) } ).y` ;
247+ if ( BaseCompiler . isComplexValued ( args [ 0 ] ) ) return `(${ compile ( args [ 0 ] ) } ).y` ;
250248 return '0.0' ;
251249 } ,
252250 Arg : ( args , compile ) => {
@@ -1174,12 +1172,17 @@ export abstract class GPUShaderTarget implements LanguageTarget<Expression> {
11741172 preamble += buildComplexPreamble ( code , this . languageId ) ;
11751173 if ( code . includes ( '_gpu_gamma' ) ) preamble += GPU_GAMMA_PREAMBLE ;
11761174 if ( code . includes ( '_gpu_erf' ) ) preamble += GPU_ERF_PREAMBLE ;
1177- if ( code . includes ( '_gpu_srgb_to' ) || code . includes ( '_gpu_oklab' ) ||
1178- code . includes ( '_gpu_oklch' ) || code . includes ( '_gpu_color_mix' ) ||
1179- code . includes ( '_gpu_apca' ) ) {
1180- preamble += this . languageId === 'wgsl'
1181- ? GPU_COLOR_PREAMBLE_WGSL
1182- : GPU_COLOR_PREAMBLE_GLSL ;
1175+ if (
1176+ code . includes ( '_gpu_srgb_to' ) ||
1177+ code . includes ( '_gpu_oklab' ) ||
1178+ code . includes ( '_gpu_oklch' ) ||
1179+ code . includes ( '_gpu_color_mix' ) ||
1180+ code . includes ( '_gpu_apca' )
1181+ ) {
1182+ preamble +=
1183+ this . languageId === 'wgsl'
1184+ ? GPU_COLOR_PREAMBLE_WGSL
1185+ : GPU_COLOR_PREAMBLE_GLSL ;
11831186 }
11841187 if ( preamble ) result . preamble = preamble ;
11851188 return result ;
0 commit comments