add verbatim

This commit is contained in:
Zack Buhman 2025-10-23 13:25:25 -05:00
commit 2aca774dd1
16 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,67 @@
-- CONST[0] = {0.159155, 0.5, 6.283185, -3.141593}
-- CONST[1] = {theta1, theta2, 0.2, 0.5}
-- each instruction is only allowed to use a single unique `const`
-- address
--
-- instructions may use multiple `temp` addresses, so const[1] is
-- moved to temp[0]:
--
temp[0].xy = VE_ADD const[1].xy__ const[1].00__ ;
-- ME_SIN and ME_COS clamp their inputs to [-pi,+pi] prior to the
-- sin/cos calculation.
--
-- This 3-instruction sequence remaps the range
-- [-inf,+inf] to [-pi,+pi]
temp[0].xy = VE_MAD temp[0].xy__ const[0].xx__ const[0].yy__ ;
temp[0].xy = VE_FRC temp[0].xy__ ;
temp[0].xy = VE_MAD temp[0].xy__ const[0].zz__ const[0].ww__ ;
-- sin and cos
temp[3].x = ME_SIN temp[0].___x ;
temp[3].y = ME_COS temp[0].___x ;
temp[3].z = ME_SIN temp[0].___y ;
temp[3].w = ME_COS temp[0].___y ;
-- temp[3] now contains:
-- temp[3] = {sin(theta1), cos(theta1), sin(theta2), cos(theta2)}
----------------------------------------------------------------------
-- first rotation: X-axis rotation:
----------------------------------------------------------------------
-- y_ = (-z0 * st1)
-- z_ = ( z0 * ct1)
temp[1].yz = VE_MUL input[0]._-zz_ temp[3]._xy_ ;
-- x1 = (x0 * 1 + 0)
-- y1 = (y0 * ct1 + nz0st1)
-- z1 = (y0 * st1 + z0ct1)
temp[1].xyz = VE_MAD input[0].xyy_ temp[3].1yx_ temp[1].0yz_ ;
----------------------------------------------------------------------
-- second rotation: Y-axis rotation:
----------------------------------------------------------------------
-- x_ = (-z1 * st2)
-- z_ = ( z1 * ct2)
temp[2].xz = VE_MUL temp[1].-z_z_ temp[3].z_w_ ;
-- x2 = (x1 * ct2 + nz1st2)
-- y2 = (y1 * 1 + 0)
-- z2 = (x1 * st2 + z1ct2)
temp[2].xyz = VE_MAD temp[1].xyx_ temp[3].w1z_ temp[2].x0z_ ;
----------------------------------------------------------------------
-- scale
----------------------------------------------------------------------
temp[3].xyz = VE_MAD temp[2].xyz_ const[1].zzz_ const[1].00w_ ;
----------------------------------------------------------------------
-- output
----------------------------------------------------------------------
out[0].xyzw = VE_MUL temp[3].xyzz temp[3].11-z1 ;
out[1].xyzw = VE_ADD input[1].xyzw input[1].0000 ;

View File

@ -0,0 +1,39 @@
#version 120
attribute vec3 pos;
attribute vec2 tex;
uniform float theta1;
uniform float theta2;
vec3 rotate(vec3 v)
{
float ct1 = cos(theta1);
float st1 = sin(theta1);
float ct2 = cos(theta2);
float st2 = sin(theta2);
float x0 = v.x;
float y0 = v.y;
float z0 = v.z;
float x1 = x0;
float y1 = y0 * ct1 - z0 * st1;
float z1 = y0 * st1 + z0 * ct1;
float x2 = x1 * ct2 - z1 * st2;
float y2 = y1;
float z2 = x1 * st2 + z1 * ct2;
return vec3(x2 * 0.2,
y2 * 0.2,
z2 * 0.2 + 0.5);
}
void main()
{
vec3 rpos = rotate(pos);
gl_Position = vec4(rpos.xy, -rpos.z * rpos.z, rpos.z);
gl_TexCoord[0] = vec4(tex, 0, 0);
}

View File

@ -0,0 +1 @@
temp[2].xyz = VE_MAD temp[1].xyx_ temp[3].w1z_ temp[2].x0z_ ;

View File

@ -0,0 +1 @@
colorbuffer_A = max(vec4(1, 1, 0, 0), vec4(1, 1, 0, 0));

View File

@ -0,0 +1,2 @@
src0.rgb = temp[0].rgb
colorbuffer_A = max(vec4(src0.rgb, 1), vec4(src0.rgb, 1))

View File

@ -0,0 +1,27 @@
temp[0].xyzw = VE_ADD const[2].xyzw const[2].0000 const[2].0000 ;
temp[1].xyzw = VE_ADD const[2].xyzw const[2].0000 const[2].0000 ;
temp[0].x = VE_MAD const[0].x___ temp[1].x___ temp[0].y___ ;
temp[0].x = VE_FRC temp[0].x___ temp[0].0000 temp[0].0000 ;
temp[0].x = VE_MAD temp[0].x___ const[2].z___ const[2].w___ ;
temp[0].y = ME_COS temp[0].xxxx temp[0].0000 temp[0].0000 ;
temp[0].x = ME_SIN temp[0].xxxx temp[0].0000 temp[0].0000 ;
temp[1].xyzw = VE_ADD const[2].xyzw const[2].0000 const[2].0000 ;
temp[2].xyzw = VE_ADD const[2].xyzw const[2].0000 const[2].0000 ;
temp[0].z = VE_MAD const[1].__x_ temp[2].__x_ temp[1].__y_ ;
temp[0].z = VE_FRC temp[0].__z_ temp[0].0000 temp[0].0000 ;
temp[0].z = VE_MAD temp[0].__z_ const[2].__z_ const[2].__w_ ;
temp[0].w = ME_COS temp[0].zzzz temp[0].0000 temp[0].0000 ;
temp[0].z = ME_SIN temp[0].zzzz temp[0].0000 temp[0].0000 ;
temp[1].xy = VE_MUL input[0].yz__ temp[0].xx__ temp[0].0000 ;
temp[0].x = VE_MAD input[0].z___ temp[0].y___ temp[1].x___ ;
temp[1].z = VE_MUL temp[0].__x_ temp[0].__z_ temp[0].0000 ;
temp[1].z = VE_MAD input[0].__x_ temp[0].__w_ temp[1].__-z_ ;
temp[0].y = VE_MAD input[0]._y__ temp[0]._y__ temp[1]._-y__ ;
temp[0].x = VE_MUL temp[0].x___ temp[0].w___ temp[0].0000 ;
temp[0].x = VE_MAD input[0].x___ temp[0].z___ temp[0].x___ ;
temp[2].xyzw = VE_ADD const[2].xyzw const[2].0000 const[2].0000 ;
temp[0].x = VE_MAD temp[0].x___ const[3].x___ temp[2].y___ ;
temp[0].z = VE_MUL temp[0].__x_ temp[0].__x_ temp[0].0000 ;
out[0].xz = VE_MAD temp[1].z_1_ const[3].x_0_ temp[0].0_-z_ ;
out[1].xy = VE_ADD input[1].xy__ input[1].0000 input[1].0000 ;
out[0].yw = VE_MAD temp[0]._y_1 const[3]._x_0 temp[0]._0_x ;

View File

@ -0,0 +1,4 @@
OUT TEX_SEM_WAIT
src0.a = const[0] :
out[0].a = MAX src0.a src0.a ,
out[0].rgb = MAX src0.rgb src0.rgb ;

View File

@ -0,0 +1,2 @@
out[0].xyzw = VE_ADD input[0].xyzw input[0].0000 ;
out[1].xyzw = VE_ADD input[1].xyzw input[1].0000 ;

View File

@ -0,0 +1,21 @@
-- 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 ;
-- d = abs(d - 0.5) * 1 + -0.1
src0.a = float(48), -- 0.5
src1.a = temp[0], -- d
src2.a = float(29), -- 0.1015625
srcp.a = sub : -- (src1.a - src0.a)
temp[0].a = MAD |srcp.a| src0.1 -src2.a ;
-- d = (d >= 0.0) ? 1.0 : 0.0
-- out.rgba = vec4(d, 0, 0, 1)
OUT TEX_SEM_WAIT
src0.a = temp[0] :
out[0].a = MAX src0.1 src0.1 ,
out[0].rgb = CMP src0.100 src0.000 src0.a00 ;

View File

@ -0,0 +1,51 @@
-- 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
src0.rgb = const[0] ,
src2.a = temp[0] :
temp[0].rgb = MAD src0.a10 src1.1a0 src2.00r ,
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 * 2pi)
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 ;

View File

@ -0,0 +1,17 @@
TEX
temp[1].rgba = LD tex[0] temp[0].rgaa ;
TEX TEX_SEM_ACQUIRE
temp[2].rgba = LD tex[1] temp[0].rgaa ;
-- (temp[0].rrrr * (temp[2].rgba - temp[1].rgba)) + temp[1].rgba
OUT TEX_SEM_WAIT
src0.a = temp[1],
src1.a = temp[2],
srcp.a = sub,
src0.rgb = temp[1],
src1.rgb = temp[2],
src2.rgb = temp[0],
srcp.rgb = sub :
out[0].a = MAD src2.r srcp.a src0.a ,
out[0].rgb = MAD src2.rrr srcp.rgb src0.rgb ;

View File

@ -0,0 +1,3 @@
vec4 c1 = texture2D(texture[0], gl_TexCoord[0].xy);
vec4 c2 = texture2D(texture[1], gl_TexCoord[0].xy);
gl_FragColor = mix(c1, c2, gl_TexCoord[0].x);

View File

@ -0,0 +1,6 @@
const float vertices[] = {
// position // color
0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left
0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top
};

View File

@ -0,0 +1,10 @@
const float vertices[] = {
// position
0.5f, -0.5f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, // bottom left
0.0f, 0.5f, 0.0f, // top
// color
1.0f, 0.0f, 0.0f, // bottom right
0.0f, 1.0f, 0.0f, // bottom left
0.0f, 0.0f, 1.0f // top
};

View File

@ -0,0 +1 @@
out[0] = input[0].xyzw + vec4(0, 0, 0, 0);

View File

@ -0,0 +1,2 @@
out[1] = input[1].xyz + vec3(0, 0, 0);
out[0] = vec4(input[0].xyz, 1) + vec4(0, 0, 0, 0);