diff --git a/drm/shadertoy.c b/drm/shadertoy.c index cf5d194..acd1c80 100644 --- a/drm/shadertoy.c +++ b/drm/shadertoy.c @@ -304,18 +304,18 @@ int indirect_buffer(float time) | SC_SCISSOR0__YS0(0) ); T0V(SC_SCISSOR1 - , SC_SCISSOR1__XS1(1600 - 1) - | SC_SCISSOR1__YS1(1200 - 1) + , SC_SCISSOR1__XS1(800 - 1) + | SC_SCISSOR1__YS1(600 - 1) ); ////////////////////////////////////////////////////////////////////////////// // VAP ////////////////////////////////////////////////////////////////////////////// - T0Vf(VAP_VPORT_XSCALE, 800.0f); - T0Vf(VAP_VPORT_XOFFSET, 800.0f); - T0Vf(VAP_VPORT_YSCALE, -600.0f); - T0Vf(VAP_VPORT_YOFFSET, 600.0f); + T0Vf(VAP_VPORT_XSCALE, 400.0f); + T0Vf(VAP_VPORT_XOFFSET, 400.0f); + T0Vf(VAP_VPORT_YSCALE, -300.0f); + T0Vf(VAP_VPORT_YOFFSET, 300.0f); T0Vf(VAP_VPORT_ZSCALE, 0.5f); T0Vf(VAP_VPORT_ZOFFSET, 0.5f); @@ -409,7 +409,7 @@ int indirect_buffer(float time) }; const int vertex_shader_length = (sizeof (vertex_shader)) / (sizeof (vertex_shader[0])); assert(vertex_shader_length % 4 == 0); - printf("vs length %d\n", vertex_shader_length); + //printf("vs length %d\n", vertex_shader_length); T0_ONE_REG(VAP_PVS_VECTOR_DATA_REG_128, vertex_shader_length - 1); for (int i = 0; i < vertex_shader_length; i++) { @@ -449,10 +449,17 @@ int indirect_buffer(float time) // fragment constants +#define PI (3.14159274101257324219f) +#define PI_2 (PI * 2.0f) +#define I_PI_2 (1.0f / (PI_2)) + const float fragment_consts[] = { - time, 0, 0, 0, + time, 1.2, 0.01, 0.4, + PI_2, I_PI_2, 0, 0, + 0.25, 0.40625, 0.5625, 0, }; int fragment_consts_length = (sizeof (fragment_consts)) / (sizeof (fragment_consts[0])); + assert(fragment_consts_length % 4 == 0); T0V(GA_US_VECTOR_INDEX , GA_US_VECTOR_INDEX__INDEX(0) @@ -465,16 +472,16 @@ int indirect_buffer(float time) // fragment code const uint32_t fragment_shader[] = { - #include "shadertoy_palette.fs.inc" + #include "shadertoy_palette_fractal.fs.inc" }; const int fragment_shader_length = (sizeof (fragment_shader)) / (sizeof (fragment_shader[0])); assert(fragment_shader_length % 6 == 0); - printf("fs length %d\n", fragment_shader_length); + //printf("fs length %d\n", fragment_shader_length); const int fragment_shader_instructions = fragment_shader_length / 6; - printf("fs instructions %d\n", fragment_shader_instructions); + //printf("fs instructions %d\n", fragment_shader_instructions); T0V(US_PIXSIZE - , US_PIXSIZE__PIX_SIZE(2) // pixel shader stack frame size + , US_PIXSIZE__PIX_SIZE(3) // pixel shader stack frame size ); T0V(US_CODE_RANGE @@ -513,7 +520,7 @@ int indirect_buffer(float time) -1.0f, 1.0f, 0.0f }; const int vertices_length = (sizeof (vertices)) / (sizeof (vertices[0])); - printf("vtx length %d\n", vertices_length); + //printf("vtx length %d\n", vertices_length); T3(_3D_DRAW_IMMD_2, (1 + vertices_length) - 1); ib[ix++].u32 = VAP_VF_CNTL__PRIM_TYPE(4) @@ -708,7 +715,7 @@ int main() #define D1GRPH_UPDATE__D1GRPH_SURFACE_UPDATE_PENDING (1 << 2) uint32_t d1crtc_double_buffer_control = rreg(rmmio, D1CRTC_DOUBLE_BUFFER_CONTROL); - printf("D1CRTC_DOUBLE_BUFFER_CONTROL: %08x\n", d1crtc_double_buffer_control); + //printf("D1CRTC_DOUBLE_BUFFER_CONTROL: %08x\n", d1crtc_double_buffer_control); assert(d1crtc_double_buffer_control == (1 << 8)); // addresses were retrieved from /sys/kernel/debug/radeon_vram_mm diff --git a/drm/shadertoy_palette_fractal.fs.asm b/drm/shadertoy_palette_fractal.fs.asm new file mode 100644 index 0000000..145a863 --- /dev/null +++ b/drm/shadertoy_palette_fractal.fs.asm @@ -0,0 +1,37 @@ +-- CONST[0] = { time, 1.2, 0.01, 0.4 } +-- CONST[1] = { PI_2, I_PI_2, 0, 0 }, +-- CONST[2] = { 0.25, 0.40625, 0.5625, 0 }, + +-- temp[0] : { uv0.xy , _, l } +-- temp[1] : { uv.xy , _, d } +-- temp[2] : final_color.xyzw +-- temp[3] : {col.xyz , i } + +-- vec2 uv = uv0; // temp[1] +src0.rgb = temp[0] : -- uv0 + temp[1].rg = MAX src0.rg_ src0.rg_ ; + +-- vec4 final_color = vec4(0, 0, 0, 1); +: + temp[2].a = MAX src0.1 src0.1 , + temp[2].rgb = MAX src0.000 src0.000 ; + +-- i = 0; +: + temp[3].a = MAX src0.0 src0.0 ; + +-------------------------------------------------------------------------------- +-- loop start +-------------------------------------------------------------------------------- +#include "shadertoy_palette_fractal_loop_inner.fs.asm" +#include "shadertoy_palette_fractal_loop_inner.fs.asm" +#include "shadertoy_palette_fractal_loop_inner.fs.asm" +#include "shadertoy_palette_fractal_loop_inner.fs.asm" +-------------------------------------------------------------------------------- +-- loop end +-------------------------------------------------------------------------------- + +OUT TEX_SEM_WAIT +src0.rgb = temp[2] : + out[0].a = MAX src0.1 src0.1 , + out[0].rgb = MAX src0.rgb src0.rgb ; diff --git a/drm/shadertoy_palette_fractal.fs.inc b/drm/shadertoy_palette_fractal.fs.inc new file mode 100644 index 0000000..1b6df53 --- /dev/null +++ b/drm/shadertoy_palette_fractal.fs.inc @@ -0,0 +1,924 @@ +0x00001800, +0x08020000, +0x08020080, +0x00e40720, +0x00000000, +0x00000015, + +0x00007800, +0x08020080, +0x08020080, +0x00920490, +0x00c18023, +0x00000025, + +0x00004000, +0x08020080, +0x08020080, +0x00000000, +0x00810033, +0x00000000, + +0x00001800, +0x08020001, +0x080200bc, +0x00ed8720, +0x00000000, +0x00790010, + +0x00001800, +0x08020001, +0x08020080, +0x00000720, +0x00000000, +0x00000019, + +0x00001800, +0x08020001, +0x0802c080, +0x00fb0720, +0x00000000, +0x00f6d010, + +0x00004000, +0x08020000, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x00300100, +0x00000000, +0x0060e010, +0x1a000000, + +0x00004000, +0x08020100, +0x08000500, +0x00000000, +0x00600010, +0x1a000000, + +0x00003800, +0x8802c102, +0x08020001, +0x006d86d8, +0x00000000, +0x00223030, + +0x00003800, +0x08020003, +0x08020080, +0x00000220, +0x00000000, +0x00000039, + +0x00003800, +0x0802c003, +0x08020080, +0x004406d8, +0x00000000, +0x00a21030, + +0x00000800, +0x08020003, +0x08020080, +0x00000000, +0x0000000d, +0x0000003a, + +0x00001000, +0x08020003, +0x08020080, +0x00000000, +0x0000400d, +0x0000003a, + +0x00002000, +0x08020003, +0x08020080, +0x00000000, +0x0000800d, +0x0000003a, + +0x00003800, +0x0802c003, +0x08020080, +0x00440221, +0x00000000, +0x00221030, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0002c018, +0x00000000, + +0x00004000, +0x08020001, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x08000400, +0x00000000, +0x0068c010, +0x20000000, + +0x00004000, +0x10020080, +0x08034001, +0x00000000, +0x0068c010, +0x04000000, + +0x00004000, +0x08040480, +0x0b020001, +0x00000000, +0x0028c010, +0x1c000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c017, +0x00000000, + +0x00004000, +0x08020080, +0x0802c001, +0x00000000, +0x00618010, +0x5a000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x1800c01c, +0x00000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0004c01a, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0048c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c019, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0028c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c018, +0x00000000, + +0x00003800, +0x00220003, +0x08000480, +0x006da220, +0x00000000, +0x00222020, + +0x00004000, +0x08020080, +0x08020003, +0x00000000, +0x00618030, +0x30000000, + +0x00001800, +0x08020001, +0x080200bc, +0x00ed8720, +0x00000000, +0x00790010, + +0x00001800, +0x08020001, +0x08020080, +0x00000720, +0x00000000, +0x00000019, + +0x00001800, +0x08020001, +0x0802c080, +0x00fb0720, +0x00000000, +0x00f6d010, + +0x00004000, +0x08020000, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x00300100, +0x00000000, +0x0060e010, +0x1a000000, + +0x00004000, +0x08020100, +0x08000500, +0x00000000, +0x00600010, +0x1a000000, + +0x00003800, +0x8802c102, +0x08020001, +0x006d86d8, +0x00000000, +0x00223030, + +0x00003800, +0x08020003, +0x08020080, +0x00000220, +0x00000000, +0x00000039, + +0x00003800, +0x0802c003, +0x08020080, +0x004406d8, +0x00000000, +0x00a21030, + +0x00000800, +0x08020003, +0x08020080, +0x00000000, +0x0000000d, +0x0000003a, + +0x00001000, +0x08020003, +0x08020080, +0x00000000, +0x0000400d, +0x0000003a, + +0x00002000, +0x08020003, +0x08020080, +0x00000000, +0x0000800d, +0x0000003a, + +0x00003800, +0x0802c003, +0x08020080, +0x00440221, +0x00000000, +0x00221030, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0002c018, +0x00000000, + +0x00004000, +0x08020001, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x08000400, +0x00000000, +0x0068c010, +0x20000000, + +0x00004000, +0x10020080, +0x08034001, +0x00000000, +0x0068c010, +0x04000000, + +0x00004000, +0x08040480, +0x0b020001, +0x00000000, +0x0028c010, +0x1c000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c017, +0x00000000, + +0x00004000, +0x08020080, +0x0802c001, +0x00000000, +0x00618010, +0x5a000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x1800c01c, +0x00000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0004c01a, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0048c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c019, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0028c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c018, +0x00000000, + +0x00003800, +0x00220003, +0x08000480, +0x006da220, +0x00000000, +0x00222020, + +0x00004000, +0x08020080, +0x08020003, +0x00000000, +0x00618030, +0x30000000, + +0x00001800, +0x08020001, +0x080200bc, +0x00ed8720, +0x00000000, +0x00790010, + +0x00001800, +0x08020001, +0x08020080, +0x00000720, +0x00000000, +0x00000019, + +0x00001800, +0x08020001, +0x0802c080, +0x00fb0720, +0x00000000, +0x00f6d010, + +0x00004000, +0x08020000, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x00300100, +0x00000000, +0x0060e010, +0x1a000000, + +0x00004000, +0x08020100, +0x08000500, +0x00000000, +0x00600010, +0x1a000000, + +0x00003800, +0x8802c102, +0x08020001, +0x006d86d8, +0x00000000, +0x00223030, + +0x00003800, +0x08020003, +0x08020080, +0x00000220, +0x00000000, +0x00000039, + +0x00003800, +0x0802c003, +0x08020080, +0x004406d8, +0x00000000, +0x00a21030, + +0x00000800, +0x08020003, +0x08020080, +0x00000000, +0x0000000d, +0x0000003a, + +0x00001000, +0x08020003, +0x08020080, +0x00000000, +0x0000400d, +0x0000003a, + +0x00002000, +0x08020003, +0x08020080, +0x00000000, +0x0000800d, +0x0000003a, + +0x00003800, +0x0802c003, +0x08020080, +0x00440221, +0x00000000, +0x00221030, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0002c018, +0x00000000, + +0x00004000, +0x08020001, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x08000400, +0x00000000, +0x0068c010, +0x20000000, + +0x00004000, +0x10020080, +0x08034001, +0x00000000, +0x0068c010, +0x04000000, + +0x00004000, +0x08040480, +0x0b020001, +0x00000000, +0x0028c010, +0x1c000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c017, +0x00000000, + +0x00004000, +0x08020080, +0x0802c001, +0x00000000, +0x00618010, +0x5a000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x1800c01c, +0x00000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0004c01a, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0048c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c019, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0028c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c018, +0x00000000, + +0x00003800, +0x00220003, +0x08000480, +0x006da220, +0x00000000, +0x00222020, + +0x00004000, +0x08020080, +0x08020003, +0x00000000, +0x00618030, +0x30000000, + +0x00001800, +0x08020001, +0x080200bc, +0x00ed8720, +0x00000000, +0x00790010, + +0x00001800, +0x08020001, +0x08020080, +0x00000720, +0x00000000, +0x00000019, + +0x00001800, +0x08020001, +0x0802c080, +0x00fb0720, +0x00000000, +0x00f6d010, + +0x00004000, +0x08020000, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x00300100, +0x00000000, +0x0060e010, +0x1a000000, + +0x00004000, +0x08020100, +0x08000500, +0x00000000, +0x00600010, +0x1a000000, + +0x00003800, +0x8802c102, +0x08020001, +0x006d86d8, +0x00000000, +0x00223030, + +0x00003800, +0x08020003, +0x08020080, +0x00000220, +0x00000000, +0x00000039, + +0x00003800, +0x0802c003, +0x08020080, +0x004406d8, +0x00000000, +0x00a21030, + +0x00000800, +0x08020003, +0x08020080, +0x00000000, +0x0000000d, +0x0000003a, + +0x00001000, +0x08020003, +0x08020080, +0x00000000, +0x0000400d, +0x0000003a, + +0x00002000, +0x08020003, +0x08020080, +0x00000000, +0x0000800d, +0x0000003a, + +0x00003800, +0x0802c003, +0x08020080, +0x00440221, +0x00000000, +0x00221030, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0002c018, +0x00000000, + +0x00004000, +0x08020001, +0x08020080, +0x00840420, +0x00000001, +0x00000001, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0004c00b, +0x00000000, + +0x00004000, +0x08020080, +0x08020000, +0x00000000, +0x0000c00a, +0x00000000, + +0x00004000, +0x08020080, +0x08000400, +0x00000000, +0x0068c010, +0x20000000, + +0x00004000, +0x10020080, +0x08034001, +0x00000000, +0x0068c010, +0x04000000, + +0x00004000, +0x08040480, +0x0b020001, +0x00000000, +0x0028c010, +0x1c000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c017, +0x00000000, + +0x00004000, +0x08020080, +0x0802c001, +0x00000000, +0x00618010, +0x5a000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x1800c01c, +0x00000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0004c01a, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0048c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c019, +0x00000000, + +0x00004000, +0x08040080, +0x08020001, +0x00000000, +0x0028c010, +0x20000000, + +0x00004000, +0x08020080, +0x08020001, +0x00000000, +0x0000c018, +0x00000000, + +0x00003800, +0x00220003, +0x08000480, +0x006da220, +0x00000000, +0x00222020, + +0x00004000, +0x08020080, +0x08020003, +0x00000000, +0x00618030, +0x30000000, + +0x00078005, +0x08020002, +0x08020080, +0x00440220, +0x00c18003, +0x00000005, + diff --git a/drm/shadertoy_palette_fractal_loop_inner.fs.asm b/drm/shadertoy_palette_fractal_loop_inner.fs.asm new file mode 100644 index 0000000..8179024 --- /dev/null +++ b/drm/shadertoy_palette_fractal_loop_inner.fs.asm @@ -0,0 +1,142 @@ +-- uv = uv * 1.5; +src0.rgb = temp[1] , -- uv +src0.a = float(60) : -- 1.5 + temp[1].rg = MAD src0.rg_ src0.aa_ src0.00_ ; + +-- uv = fract(uv); +src0.rgb = temp[1] : -- uv + temp[1].rg = FRC src0.rg_ ; + +-- uv = uv - 0.5; +src0.rgb = temp[1] , +src1.a = float(48) : -- 0.5 + temp[1].rg = MAD src0.rg_ src0.11_ -src1.aa_ ; + +-- l = length(uv0); +src0.rgb = temp[0] : -- uv0 + DP3 src0.rg0 src0.rg0 , + temp[0].a = DP ; +src0.a = temp[0] : + temp[0].a = RSQ |src0.a| ; +src0.a = temp[0] : + temp[0].a = RCP src0.a ; + +-- d = i * 0.4 + l; +src0.a = const[0] , -- 0.4 +src1.a = temp[0] , -- l +src2.a = temp[3] : -- i + temp[1].a = MAD src2.a src0.a src1.a ; + +-- d = time * 0.4 + d; +src0.a = const[0] , -- 0.4 +src1.a = temp[1] , -- d +src0.rgb = const[0] : -- time (r) + temp[1].a = MAD src0.r src0.a src1.a ; + +-------------------------------------------------------------------------------- +-- start of 'palette' function +-------------------------------------------------------------------------------- + +-- v = d + (vec3(0.25, 0.40625, 0.5625) + 0.5) +src0.a = temp[1] , -- d +src0.rgb = const[2] , -- vec3(0.25, 0.40625, 0.5625) +src1.rgb = float(48) , -- 0.5 +srcp.rgb = add : -- (vec3(0.25, 0.40625, 0.5625) + 0.5) + temp[3].rgb = MAD src0.111 src0.aaa srcp.rgb ; + +-- v = frac(v) +src0.rgb = temp[3] : -- v + temp[3].rgb = FRC src0.rgb ; + +src0.rgb = temp[3] , -- v +src1.rgb = float(48) : -- 0.5 + temp[3].rgb = MAD src0.111 src0.rgb -src1.rgb ; + +-- v = cos(v) +src0.rgb = temp[3] : -- v + COS src0.r , + temp[3].r = SOP ; +src0.rgb = temp[3] : -- v + COS src0.g , + temp[3].g = SOP ; +src0.rgb = temp[3] : -- v + COS src0.b , + temp[3].b = SOP ; + +-- col = vec3(0.5, 0.5, 0.5) * v + vec3(0.5, 0.5, 0.5) +src0.rgb = temp[3] , -- v +src1.rgb = float(48) : -- 0.5 + temp[3].rgb = MAD src1.rgb src0.rgb src1.rgb; + +-------------------------------------------------------------------------------- +-- end of 'palette' function +-------------------------------------------------------------------------------- + +-- d = ex2(-l); +src0.a = temp[0] : -- l + temp[1].a = EX2 -src0.a ; + +-- l = length(uv); +src0.rgb = temp[1] : -- uv + DP3 src0.rg0 src0.rg0 , + temp[0].a = DP ; +src0.a = temp[0] : + temp[0].a = RSQ |src0.a| ; +src0.a = temp[0] : + temp[0].a = RCP src0.a ; + +-- d = l * d; +src0.a = temp[0] , -- l +src1.a = temp[1] : -- d + temp[1].a = MAD src0.a src1.a src0.0 ; + +-- d = d * 8.0 + time; +src0.a = temp[1] , -- d +src1.a = float(80) , -- 8.0 +src2.rgb = const[0] : -- time (r) + temp[1].a = MAD src0.a src1.a src2.r ; + +-- d = 0.125 * sin(d); +-- d = d * 0.159154936671257019043 + 0.5; // 48 +src0.a = temp[1] , -- d +src1.rgb = const[1] , -- I_PI_2 (g) +src2.a = float(48) : -- 0.5 + temp[1].a = MAD src0.a src1.g src2.a ; +-- d = fract(d); +src0.a = temp[1] : -- d + temp[1].a = FRC src0.a ; +-- d = d - 0.5; +src0.a = temp[1] , -- d +src1.a = float(48) : -- 0.5 + temp[1].a = MAD src0.1 src0.a -src1.a ; +-- d = 0.125 * sin(d * PI_2); +src0.a = temp[1] : + temp[1].a = 0.125 * SIN src0.a ; + +-- d = 1.0 / abs(d); +src0.a = temp[1] : -- d + temp[1].a = RCP |src0.a|; + +-- d = 0.01 * d; +src0.a = temp[1] , -- d +src1.rgb = const[0] : -- 0.01 (b) + temp[1].a = MAD src0.a src1.b src0.0 ; + +-- d = pow(d, 1.2); +src0.a = temp[1] : -- d + temp[1].a = LN2 src0.a ; +src0.a = temp[1] , +src1.rgb = const[0] : -- 1.2 (g) + temp[1].a = MAD src0.a src1.g src0.0 ; +src0.a = temp[1] : + temp[1].a = EX2 src0.a ; + +-- final_color = col * d + final_color +src0.rgb = temp[3] , -- col +src1.a = temp[1] , -- d +src2.rgb = temp[2] : -- final_color + temp[2].rgb = MAD src0.rgb src1.aaa src2.rgb ; + +-- i = i + 1 +src0.a = temp[3] : + temp[3].a = MAD src0.1 src0.a src0.1 ;