Uniform lookup stalls GPU pipeline
An AI assistant wrote this per-frame material update for an OpenGL renderer in C++. Visually it's correct, but the profiler shows a multi-millisecond CPU stall every frame and GPU occupancy is low. Review the render loop and explain why updating the uniform this way stalls the pipeline.
Implement
state_change_cost(object_shaders: list[str], object_materials: list[str]) → list[int]Examples
in
[["pbr","pbr","pbr"],["rock","grass","rock"]]out[4,3]in
[[],[]]out[0,0]in
[["pbr"],["rock"]]out[2,2]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 18 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.