1bf215546Sopenharmony_ciOverview 2bf215546Sopenharmony_ci======== 3bf215546Sopenharmony_ci 4bf215546Sopenharmony_ciComputerator is a tool to launch compute shaders, written in assembly. 5bf215546Sopenharmony_ciThe main purpose is to have an easy way to experiment with instructions 6bf215546Sopenharmony_ciwithout dealing with the entire compiler stack (which makes controlling 7bf215546Sopenharmony_cithe order of instructions, the registers chosen, etc, difficult). The 8bf215546Sopenharmony_cichoice of compute shaders is simply because there is far less state 9bf215546Sopenharmony_cisetup required. 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ciHeaders 12bf215546Sopenharmony_ci------- 13bf215546Sopenharmony_ci 14bf215546Sopenharmony_ciThe shader assembly can be prefixed with headers to control state setup: 15bf215546Sopenharmony_ci 16bf215546Sopenharmony_ci* ``@localsize X, Y, Z`` - configures local workgroup size 17bf215546Sopenharmony_ci* ``@buf SZ (cN.c)`` - configures an SSBO of the specified size (in dwords). 18bf215546Sopenharmony_ci The order of the ``@buf`` headers determines the index, ie the first 19bf215546Sopenharmony_ci ``@buf`` header is ``g[0]``, the second ``g[1]``, and so on. 20bf215546Sopenharmony_ci The iova of the buffer is written as a vec2 to ``cN.c`` 21bf215546Sopenharmony_ci* ``@const(cN.c)`` configures a const vec4 starting at specified 22bf215546Sopenharmony_ci const register, ie ``@const(c1.x) 1.0, 2.0, 3.0, 4.0`` will populate 23bf215546Sopenharmony_ci ``c1.xyzw`` with ``vec4(1.0, 2.0, 3.0, 4.0)`` 24bf215546Sopenharmony_ci* ``@invocationid(rN.c)`` will populate a vec3 starting at the specified 25bf215546Sopenharmony_ci register with the local invocation-id 26bf215546Sopenharmony_ci* ``@wgid(rN.c)`` will populate a vec3 starting at the specified register 27bf215546Sopenharmony_ci with the workgroup-id (must be a high-reg, ie. ``r48.x`` and above) 28bf215546Sopenharmony_ci* ``@numwg(cN.c)`` will populate a vec3 starting at the specified const 29bf215546Sopenharmony_ci register 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ciExample 32bf215546Sopenharmony_ci------- 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci``` 35bf215546Sopenharmony_ci@localsize 32, 1, 1 36bf215546Sopenharmony_ci@buf 32 ; g[0] 37bf215546Sopenharmony_ci@const(c0.x) 0.0, 0.0, 0.0, 0.0 38bf215546Sopenharmony_ci@const(c1.x) 1.0, 2.0, 3.0, 4.0 39bf215546Sopenharmony_ci@wgid(r48.x) ; r48.xyz 40bf215546Sopenharmony_ci@invocationid(r0.x) ; r0.xyz 41bf215546Sopenharmony_ci@numwg(c2.x) ; c2.xyz 42bf215546Sopenharmony_cimov.u32u32 r0.y, r0.x 43bf215546Sopenharmony_ci(rpt5)nop 44bf215546Sopenharmony_cistib.untyped.1d.u32.1 g[0] + r0.y, r0.x 45bf215546Sopenharmony_ciend 46bf215546Sopenharmony_cinop 47bf215546Sopenharmony_ci``` 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ciUsage 50bf215546Sopenharmony_ci----- 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci``` 53bf215546Sopenharmony_cicat myshader.asm | ./computerator --disasm --groups=4,4,4 54bf215546Sopenharmony_ci``` 55bf215546Sopenharmony_ci 56