@@ -16,7 +16,7 @@ const getNeighbors = tgpu['~unstable'].fn(
16
16
for ( let i = 0 ; i < 4 ; i ++ ) {
17
17
adjacentOffsets [ i ] = std . clamp (
18
18
std . add ( coords , adjacentOffsets [ i ] ) ,
19
- d . vec2i ( 0 ) ,
19
+ d . vec2i ( ) ,
20
20
std . sub ( bounds , d . vec2i ( 1 ) ) ,
21
21
) ;
22
22
}
@@ -25,8 +25,8 @@ const getNeighbors = tgpu['~unstable'].fn(
25
25
26
26
export const brushLayout = tgpu . bindGroupLayout ( {
27
27
brushParams : { uniform : p . BrushParams } ,
28
- forceDst : { storageTexture : 'rg32float ' , access : 'writeonly' } ,
29
- inkDst : { storageTexture : 'r32float ' , access : 'writeonly' } ,
28
+ forceDst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
29
+ inkDst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
30
30
} ) ;
31
31
32
32
export const brushFn = tgpu [ '~unstable' ] . computeFn ( {
@@ -67,7 +67,7 @@ export const brushFn = tgpu['~unstable'].computeFn({
67
67
68
68
export const addForcesLayout = tgpu . bindGroupLayout ( {
69
69
src : { texture : 'float' } ,
70
- dst : { storageTexture : 'rg32float ' , access : 'writeonly' } ,
70
+ dst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
71
71
force : { texture : 'float' } ,
72
72
simParams : { uniform : p . ShaderParams } ,
73
73
} ) ;
@@ -86,7 +86,7 @@ export const addForcesFn = tgpu['~unstable'].computeFn({
86
86
87
87
export const advectLayout = tgpu . bindGroupLayout ( {
88
88
src : { texture : 'float' } ,
89
- dst : { storageTexture : 'rg32float ' , access : 'writeonly' } ,
89
+ dst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
90
90
simParams : { uniform : p . ShaderParams } ,
91
91
linSampler : { sampler : 'filtering' } ,
92
92
} ) ;
@@ -131,7 +131,7 @@ export const advectFn = tgpu['~unstable'].computeFn({
131
131
132
132
export const diffusionLayout = tgpu . bindGroupLayout ( {
133
133
in : { texture : 'float' } ,
134
- out : { storageTexture : 'rg32float ' , access : 'writeonly' } ,
134
+ out : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
135
135
simParams : { uniform : p . ShaderParams } ,
136
136
} ) ;
137
137
@@ -170,7 +170,7 @@ export const diffusionFn = tgpu['~unstable'].computeFn({
170
170
171
171
export const divergenceLayout = tgpu . bindGroupLayout ( {
172
172
vel : { texture : 'float' } ,
173
- div : { storageTexture : 'r32float ' , access : 'writeonly' } ,
173
+ div : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
174
174
} ) ;
175
175
176
176
export const divergenceFn = tgpu [ '~unstable' ] . computeFn ( {
@@ -189,7 +189,7 @@ export const divergenceFn = tgpu['~unstable'].computeFn({
189
189
const rightVel = std . textureLoad ( divergenceLayout . $ . vel , neighbors [ 2 ] , 0 ) ;
190
190
const downVel = std . textureLoad ( divergenceLayout . $ . vel , neighbors [ 3 ] , 0 ) ;
191
191
192
- const divergence = d . f32 ( 0.5 ) *
192
+ const divergence = 0.5 *
193
193
( rightVel . x - leftVel . x + ( downVel . y - upVel . y ) ) ;
194
194
std . textureStore (
195
195
divergenceLayout . $ . div ,
@@ -201,7 +201,7 @@ export const divergenceFn = tgpu['~unstable'].computeFn({
201
201
export const pressureLayout = tgpu . bindGroupLayout ( {
202
202
x : { texture : 'float' } ,
203
203
b : { texture : 'float' } ,
204
- out : { storageTexture : 'r32float ' , access : 'writeonly' } ,
204
+ out : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
205
205
} ) ;
206
206
207
207
export const pressureFn = tgpu [ '~unstable' ] . computeFn ( {
@@ -232,7 +232,7 @@ export const pressureFn = tgpu['~unstable'].computeFn({
232
232
export const projectLayout = tgpu . bindGroupLayout ( {
233
233
vel : { texture : 'float' } ,
234
234
p : { texture : 'float' } ,
235
- out : { storageTexture : 'rg32float ' , access : 'writeonly' } ,
235
+ out : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
236
236
} ) ;
237
237
238
238
export const projectFn = tgpu [ '~unstable' ] . computeFn ( {
@@ -261,7 +261,7 @@ export const projectFn = tgpu['~unstable'].computeFn({
261
261
export const advectInkLayout = tgpu . bindGroupLayout ( {
262
262
vel : { texture : 'float' } ,
263
263
src : { texture : 'float' } ,
264
- dst : { storageTexture : 'r32float ' , access : 'writeonly' } ,
264
+ dst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
265
265
simParams : { uniform : p . ShaderParams } ,
266
266
linSampler : { sampler : 'filtering' } ,
267
267
} ) ;
@@ -297,7 +297,7 @@ export const advectInkFn = tgpu['~unstable'].computeFn({
297
297
298
298
export const addInkLayout = tgpu . bindGroupLayout ( {
299
299
src : { texture : 'float' } ,
300
- dst : { storageTexture : 'r32float ' , access : 'writeonly' } ,
300
+ dst : { storageTexture : 'rgba16float ' , access : 'writeonly' } ,
301
301
add : { texture : 'float' } ,
302
302
} ) ;
303
303
0 commit comments