setupTexture method
Creates a texture and compiles the shaders. Safe to call multiple times – resources are recreated if needed.
Implementation
Future<void> setupTexture({
required double width,
required double height,
bool enableProfiling = false,
}) async {
assert(width > 0 && height > 0, 'Viewport must be non‑zero');
_targetTexture = await _angle.createTexture(
AngleOptions(
width: width.toInt(),
height: height.toInt(),
dpr: 1,
alpha: true,
useSurfaceProducer: true,
),
);
_gl = _targetTexture.getContext();
// Detect GPU capabilities once
_caps = Caps(_gl);
debugPrint('R32UI supported: ${_caps!.hasIntegerTex}');
await _splatPass.init(_gl, caps: _caps);
_updateProjectionMatrix();
_profilerType = enableProfiling ? 'CPU' : null; // Set intent
_initProfilerIfEnabled();
}