problem static method
Why a stage named stage that binds textures textures, samplers
samplers and uniformBlocks uniform blocks is over the budget, or null
when it is within it.
Implementation
static String? problem(
String stage, {
required int textures,
required int samplers,
required int uniformBlocks,
}) {
String over(int count, int budget, String what) =>
'the stage "$stage" binds $count $what, and a stage may bind at most '
'$budget on WebGPU, the engine\'s own bindings included: that is '
'what every WebGPU device guarantees. Bind fewer in the material, '
'or pack two maps into the channels of one';
if (textures > MaterialStageBudget.textures) {
return over(textures, MaterialStageBudget.textures, 'textures');
}
if (samplers > MaterialStageBudget.samplers) {
return over(samplers, MaterialStageBudget.samplers, 'samplers');
}
if (uniformBlocks > MaterialStageBudget.uniformBlocks) {
return over(
uniformBlocks,
MaterialStageBudget.uniformBlocks,
'uniform blocks',
);
}
return null;
}