16.06.2016 Views

Advanced Metal Shader Optimization

606_advanced_metal_shader_optimization

606_advanced_metal_shader_optimization

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Address Spaces<br />

Example: projection matrix<br />

Variable Number of items Amount of reuse Address space<br />

transform one all constant<br />

vertex float4 transformedVertex(uint vid [[ vertex_id ]]),<br />

const device float4 *positions [[ buffer(0) ]],<br />

constant matrix_float4x4 &transform [[ buffer(1) ]])<br />

{<br />

return transform * positions[vid];<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!