{examples,Audio}: optimize needless setComponent calls away

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-05-07 22:15:34 -07:00 committed by Stephen Gutekanst
parent 57767c2f9f
commit 6feaad630e
5 changed files with 19 additions and 15 deletions

View file

@ -96,6 +96,7 @@ fn updatePipeline(
}
}
// TODO: optimize by removing this component set call and instead use a .write() query
try sprite_pipeline.set(pipeline_id, .num_sprites, num_sprites);
if (num_sprites > 0) {
encoder.writeBuffer(built.transforms, 0, gfx.SpritePipeline.cp_transforms[0..i]);

View file

@ -155,6 +155,8 @@ fn buildPipeline(
pipeline_id: mach.EntityID,
texture: *gpu.Texture,
) !void {
// TODO: optimize by removing the component get/set calls in this function where possible
// and instead use .write() queries
const opt_texture2 = sprite_pipeline.get(pipeline_id, .texture2);
const opt_texture3 = sprite_pipeline.get(pipeline_id, .texture3);
const opt_texture4 = sprite_pipeline.get(pipeline_id, .texture4);

View file

@ -179,6 +179,8 @@ fn buildPipeline(
text_pipeline: *Mod,
pipeline_id: mach.EntityID,
) !void {
// TODO: optimize by removing the component get/set calls in this function where possible
// and instead use .write() queries
const opt_shader = text_pipeline.get(pipeline_id, .shader);
const opt_texture_sampler = text_pipeline.get(pipeline_id, .texture_sampler);
const opt_blend_state = text_pipeline.get(pipeline_id, .blend_state);