draws.10k's guest bench draws with v_small and f_flat, which take their bytes as a constant float4 & at buffer 0. draw_cost's 10k drew with render_vbuf and render_fbuf, which read device pointers, so the runtime bound storage buffers where the VM's draws bind constant ones: on Iris the VM's lane thread spends 7.7% in the runtime's push_set, and draw_cost's 10k never reached it, with either kind of upload chunk. The 10k and many shapes now run under the bench's pair, render_small and render_flat, compiled alone here with Xcode's metal (no other metallib rebuilt). The runtime path also takes DRAW_COST_RUNTIME_PASS=fresh, which makes each pass's descriptor anew inside the count as the platform's and the decoder's paths do: whether the runtime's extra pass work under the platform comes of a new descriptor each pass or of what the platform's descriptors carry.
14 lines
565 B
Metal
14 lines
565 B
Metal
// Render suite: the guest bench's small triangle (draws.10k's v_small, in
|
|
// guest/bundle/tools/bench/bench.m): a triangle at d.xy, d.zw in size, in
|
|
// clip space, its d read from constant buffer 0, which the bench sets with
|
|
// setVertexBytes before each draw.
|
|
#include <metal_stdlib>
|
|
using namespace metal;
|
|
struct VOut { float4 pos [[position]]; };
|
|
vertex VOut render_small(uint vid [[vertex_id]], constant float4 &d [[buffer(0)]]) {
|
|
float2 p = float2((vid << 1) & 2, vid & 2) * 0.5;
|
|
VOut o;
|
|
o.pos = float4(d.xy + p * d.zw, 0.0, 1.0);
|
|
return o;
|
|
}
|