1+ const { assert, skip, test, module : describe , only } = require ( 'qunit' ) ;
2+ const { GPU } = require ( '../../src' ) ;
3+
4+ describe ( 'issue #586 - unable to resize' ) ;
5+
6+ function testResize ( convert , mode ) {
7+ const gpu = new GPU ( { mode } ) ;
8+ const createTexture1 = gpu . createKernel ( function ( ) {
9+ return 1 ;
10+ } , { output : [ 2 , 2 ] , pipeline : false } ) ;
11+
12+ const createTexture2 = gpu . createKernel ( function ( ) {
13+ return 1 ;
14+ } , { output : [ 4 , 4 ] , pipeline : true } ) ;
15+
16+ var t1 = createTexture1 ( ) ;
17+ var t2 = createTexture2 ( ) ;
18+
19+ assert . deepEqual ( convert ( t2 ) , [
20+ new Float32Array ( [ 1 , 1 , 1 , 1 ] ) ,
21+ new Float32Array ( [ 1 , 1 , 1 , 1 ] ) ,
22+ new Float32Array ( [ 1 , 1 , 1 , 1 ] ) ,
23+ new Float32Array ( [ 1 , 1 , 1 , 1 ] ) ,
24+ ] ) ;
25+
26+ gpu . destroy ( ) ;
27+ }
28+
29+ test ( 'auto' , ( ) => {
30+ testResize ( t => t . toArray ( ) ) ;
31+ } ) ;
32+
33+ test ( 'gpu' , ( ) => {
34+ testResize ( t => t . toArray ( ) , 'gpu' ) ;
35+ } ) ;
36+
37+ ( GPU . isWebGLSupported ? test : skip ) ( 'webgl' , ( ) => {
38+ testResize ( t => t . toArray ( ) , 'webgl' ) ;
39+ } ) ;
40+
41+ ( GPU . isWebGL2Supported ? test : skip ) ( 'webgl2' , ( ) => {
42+ testResize ( t => t . toArray ( ) , 'webgl2' ) ;
43+ } ) ;
44+
45+ ( GPU . isHeadlessGLSupported ? test : skip ) ( 'headlessgl' , ( ) => {
46+ testResize ( t => t . toArray ( ) , 'headlessgl' ) ;
47+ } ) ;
48+
49+ test ( 'cpu' , ( ) => {
50+ testResize ( a => a , 'cpu' ) ;
51+ } ) ;
0 commit comments