@@ -141,23 +141,24 @@ describe('TgpuComputePipeline', () => {
141141 expect ( pipeline [ $internal ] . priors . performanceCallback ) . not . toBe ( callback1 ) ;
142142 } ) ;
143143
144- it ( 'should throw error if timestamp-query feature is not enabled' , ( { root, device } ) => {
145- const originalFeatures = device . features ;
146- //@ts -expect-error
144+ it ( 'should warn if timestamp-query feature is not enabled' , ( { root, device } ) => {
145+ // @ts -expect-error
147146 device . features = new Set ( ) ;
147+ using consoleWarnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
148148
149149 const entryFn = tgpu . computeFn ( { workgroupSize : [ 1 ] } ) ( ( ) => { } ) ;
150150
151151 const callback = vi . fn ( ) ;
152152
153153 expect ( ( ) => {
154- root . createComputePipeline ( { compute : entryFn } ) . withPerformanceCallback ( callback ) ;
155- } ) . toThrow (
156- 'Performance callback requires the "timestamp-query" feature to be enabled on GPU device.' ,
154+ const before = root . createComputePipeline ( { compute : entryFn } ) ;
155+ const after = before . withPerformanceCallback ( callback ) ;
156+ // no-op
157+ expect ( after ) . toBe ( before ) ;
158+ } ) . not . toThrow ( ) ;
159+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
160+ 'Performance callback cannot be used because the timestamp-query feature is not enabled on the root.' ,
157161 ) ;
158-
159- //@ts -expect-error
160- device . features = originalFeatures ;
161162 } ) ;
162163 } ) ;
163164
@@ -331,6 +332,7 @@ describe('TgpuComputePipeline', () => {
331332 describe ( 'Combined Performance callback and Timestamp Writes' , ( ) => {
332333 it ( 'should work with both performance callback and custom timestamp writes' , ( {
333334 root,
335+ device,
334336 commandEncoder,
335337 } ) => {
336338 const entryFn = tgpu . computeFn ( { workgroupSize : [ 1 ] } ) ( ( ) => { } ) ;
@@ -371,6 +373,12 @@ describe('TgpuComputePipeline', () => {
371373 querySet [ $internal ] . resolveBuffer ,
372374 0 ,
373375 ) ;
376+
377+ expect ( device . mock . createQuerySet ) . toHaveBeenCalledTimes ( 1 ) ;
378+ expect ( device . mock . createQuerySet ) . toHaveBeenCalledWith ( {
379+ type : 'timestamp' ,
380+ count : 10 ,
381+ } ) ;
374382 } ) ;
375383
376384 it ( 'should prioritize custom timestamp writes over automatic ones' , ( {
@@ -394,8 +402,6 @@ describe('TgpuComputePipeline', () => {
394402 endOfPassWriteIndex : 5 ,
395403 } ) ;
396404
397- expect ( ( autoQuerySet as TgpuQuerySet < 'timestamp' > ) . destroyed ) . toBe ( true ) ;
398-
399405 const priors = pipeline [ $internal ] . priors ;
400406 expect ( priors . performanceCallback ) . toBe ( callback ) ;
401407 expect ( priors . timestampWrites ?. querySet ) . toBe ( querySet ) ;
0 commit comments