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