drm/shadertoy: add shadertoy_palette.fs.asm
This commit is contained in:
parent
f6a0fc4fab
commit
91f83bdaa8
@ -465,7 +465,7 @@ int indirect_buffer(float time)
|
||||
// fragment code
|
||||
|
||||
const uint32_t fragment_shader[] = {
|
||||
#include "shadertoy_sin.fs.inc"
|
||||
#include "shadertoy_palette.fs.inc"
|
||||
};
|
||||
const int fragment_shader_length = (sizeof (fragment_shader)) / (sizeof (fragment_shader[0]));
|
||||
assert(fragment_shader_length % 6 == 0);
|
||||
@ -474,7 +474,7 @@ int indirect_buffer(float time)
|
||||
printf("fs instructions %d\n", fragment_shader_instructions);
|
||||
|
||||
T0V(US_PIXSIZE
|
||||
, US_PIXSIZE__PIX_SIZE(1) // pixel shader stack frame size
|
||||
, US_PIXSIZE__PIX_SIZE(2) // pixel shader stack frame size
|
||||
);
|
||||
|
||||
T0V(US_CODE_RANGE
|
||||
|
||||
53
drm/shadertoy_palette.fs.asm
Normal file
53
drm/shadertoy_palette.fs.asm
Normal file
@ -0,0 +1,53 @@
|
||||
-- CONST[0] = { time, 0, 0, 0 }
|
||||
-- CONST[1] = { PI_2, I_PI_2, 0, 0 },
|
||||
|
||||
-- d = length(uv)
|
||||
src0.rgb = temp[0] :
|
||||
temp[0].r = DP3 src0.rg0 src0.rg0 ;
|
||||
src0.rgb = temp[0] :
|
||||
temp[0].a = RSQ |src0.r| ;
|
||||
src0.a = temp[0] :
|
||||
temp[0].a = RCP src0.a ;
|
||||
|
||||
-- i = vec3(0.25, 0.40625, 0.5625);
|
||||
-- td = time + d
|
||||
src0.a = float(40) , -- 0.25
|
||||
src1.a = float(45) , -- 0.40625
|
||||
src2.rgb = float(49) : -- 0.5625
|
||||
temp[0].rgb = MAD src0.a10 src1.1a0 src2.00r ;
|
||||
|
||||
src0.rgb = const[0] ,
|
||||
src2.a = temp[0] :
|
||||
temp[1].a = MAD src0.1 src0.r src2.a ;
|
||||
|
||||
-- t = i + vec3(td)
|
||||
src0.a = temp[1] ,
|
||||
src0.rgb = temp[0] :
|
||||
temp[0].rgb = MAD src0.111 src0.rgb src0.aaa ;
|
||||
|
||||
-- j = fract(t)
|
||||
src0.rgb = temp[0] :
|
||||
temp[0].rgb = FRC src0.rgb ;
|
||||
|
||||
-- k = cos(j * 2π)
|
||||
src0.rgb = temp[0] :
|
||||
COS src0.r ,
|
||||
temp[0].r = SOP ;
|
||||
src0.rgb = temp[0] :
|
||||
COS src0.g ,
|
||||
temp[0].g = SOP ;
|
||||
src0.rgb = temp[0] :
|
||||
COS src0.b ,
|
||||
temp[0].b = SOP ;
|
||||
|
||||
-- l = k * vec3(0.5, 0.5, 0.5) + vec3(0.5, 0.5, 0.5)
|
||||
src0.rgb = temp[0] ,
|
||||
src1.rgb = float(48) : -- 0.5
|
||||
temp[0].rgb = MAD src0.rgb src1.rrr src1.rrr ;
|
||||
|
||||
OUT TEX_SEM_WAIT
|
||||
src0.a = temp[0] ,
|
||||
src0.rgb = temp[0] :
|
||||
out[0].a = MAX src0.1 src0.1 ,
|
||||
out[0].rgb = MAX src0.rgb src0.rgb ;
|
||||
,
|
||||
84
drm/shadertoy_palette.fs.inc
Normal file
84
drm/shadertoy_palette.fs.inc
Normal file
@ -0,0 +1,84 @@
|
||||
0x00000800,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00840420,
|
||||
0x00000000,
|
||||
0x00000001,
|
||||
|
||||
0x00004000,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00000000,
|
||||
0x0004000b,
|
||||
0x00000000,
|
||||
|
||||
0x00004000,
|
||||
0x08020080,
|
||||
0x08020000,
|
||||
0x00000000,
|
||||
0x0000c00a,
|
||||
0x00000000,
|
||||
|
||||
0x00003800,
|
||||
0x0b120080,
|
||||
0x0802b4a8,
|
||||
0x008f24cc,
|
||||
0x00000000,
|
||||
0x00092000,
|
||||
|
||||
0x00004000,
|
||||
0x08020100,
|
||||
0x00020080,
|
||||
0x00000000,
|
||||
0x00018010,
|
||||
0x1c000000,
|
||||
|
||||
0x00003800,
|
||||
0x08020000,
|
||||
0x08020001,
|
||||
0x004406d8,
|
||||
0x00000000,
|
||||
0x0036c000,
|
||||
|
||||
0x00003800,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00000220,
|
||||
0x00000000,
|
||||
0x00000009,
|
||||
|
||||
0x00000800,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00000000,
|
||||
0x0000000d,
|
||||
0x0000000a,
|
||||
|
||||
0x00001000,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00000000,
|
||||
0x0000400d,
|
||||
0x0000000a,
|
||||
|
||||
0x00002000,
|
||||
0x08020000,
|
||||
0x08020080,
|
||||
0x00000000,
|
||||
0x0000800d,
|
||||
0x0000000a,
|
||||
|
||||
0x00003800,
|
||||
0x0802c000,
|
||||
0x08020080,
|
||||
0x00002220,
|
||||
0x00000000,
|
||||
0x00001000,
|
||||
|
||||
0x00078005,
|
||||
0x08020000,
|
||||
0x08020000,
|
||||
0x00440220,
|
||||
0x00c18003,
|
||||
0x00000005,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user