rendered paste body
#define _pp_( n ) half##n pp( float##n v ) { return v; }
_pp_(1); _pp_(2); _pp_(3); _pp_(4);
#undef _pp_
#define chx( v, n, a, b ) (v[n]>=0)?a[n]:b[n]
#define chx4( v, a, b ) chx(v,0,a,b),chx(v,1,a,b),chx(v,2,a,b),chx(v,3,a,b)
half4 cmp_pp( half4 v, half4 a, half4 b )
{ return half4( chx4( v, a, b ) ); }
float4 cmp( float4 v, float4 a, float4 b )
{ return float4( chx4( v, a, b ) ); }
#undef chx
#undef chx4
float2 col( float2x4 m, const int c )
{ return float2( m[0][c], m[1][c] ); }
float3 col( float3x4 m, const int c )
{ return float3( m[0][c], m[1][c], m[2][c] ); }
float4 col( float4x4 m, const int c )
{ return float4( m[0][c], m[1][c], m[2][c], m[3][c] ); }
#define sc( n ) m[n][c] = v[n]
float2 col( float2x4 m, const int c, float2 v )
{ sc(0);sc(1); return v; }
float3 col( float3x4 m, const int c, float3 v )
{ sc(0);sc(1);sc(2); return v; }
float4 col( float4x4 m, const int c, float4 v )
{ sc(0);sc(1);sc(2);sc(3); return v; }
#undef sc
float2x4 cols( float4 x, float4 y ) {
return float2x4(
float2(x.x,y.x),
float2(x.y,y.y),
float2(x.z,y.z),
float2(x.w,y.w)
);
}
float3x4 cols( float4 x, float4 y, float4 z ) {
return float3x4(
float3(x.x,y.x,z.x),
float3(x.y,y.y,z.y),
float3(x.z,y.z,z.z),
float3(x.w,y.w,z.w)
);
}
float4x4 cols( float4 x, float4 y, float4 z, float4 w ) {
return float4x4(
float4(x.x,y.x,z.x,w.x),
float4(x.y,y.y,z.y,w.y),
float4(x.z,y.z,z.z,w.z),
float4(x.w,y.w,z.w,w.w)
);
}
const float4 z = {0,0,0,0};
/*
mov {[^,]+}, {.+}
\1 = \2;
mad {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = ((\2) * (\3)) + (\4);
mad_pp {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = pp( ((\2) * (\3)) + (\4) );
mad_sat {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = saturate( ( (\2) * (\3) ) + (\4) );
mad_sat_pp {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = pp(saturate( ( (\2) * (\3) ) + (\4) ));
mul {[^,]+}, {[^,]+}, {.+}
\1 = (\2) * (\3);
mul_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp((\2) * (\3));
add {[^,]+}, {[^,]+}, {.+}
\1 = (\2) + (\3);
add_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp((\2) + (\3));
frc {[^,]+}, {.+}
\1 = frac( \2 );
frc_pp {[^,]+}, {.+}
\1 = pp(frac( \2 ));
cmp {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = cmp( \2, \3, \4 );
cmp_pp {[^,]+}, {[^,]+}, {[^,]+}, {.+}
\1 = cmp_pp( \2, \3, \4 );
nrm {[^,]+}, {.+}
\1 = normalize(\2);
nrm_pp {[^,]+}, {.+}
\1 = pp(normalize(\2));
texld {[^,]+}, {[^,]+}, {.+}
\1 = tex2D( \3, \2 );
texld_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp(tex2D( \3, \2 ));
dp4 {[^,]+}, {[^,]+}, {.+}
\1 = dot( (float4) \2, \3 );
dp4_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp(dot( (float4) \2, \3 ));
dp4_sat {[^,]+}, {[^,]+}, {.+}
\1 = saturate( dot( (float4) \2, \3 ) );
dp4_sat_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp(saturate( dot( (float4) \2, \3 ) ));
dp3 {[^,]+}, {[^,]+}, {.+}
\1 = dot( (float3) \2, \3 );
dp3_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp(dot( (float3) \2, \3 ));
dp3_sat {[^,]+}, {[^,]+}, {.+}
\1 = saturate( dot( (float3) \2, \3 ) );
dp3_sat_pp {[^,]+}, {[^,]+}, {.+}
\1 = pp(saturate( dot( (float3) \2, \3 ) ));
rsq {[^,]+}, {.+}
\1 = 1/sqrt(\2);
rsq_pp {[^,]+}, {.+}
\1 = pp( 1/sqrt( \2 ) );
rcp {[^,]+}, {.+}
\1 = 1/( \2 );
rcp_pp {[^,]+}, {.+}
\1 = pp( 1/pp( \2 ) );
exp {[^,]+}, {.+}
\1 = pow( 2, \2 );
exp_pp {[^,]+}, {.+}
\1 = pp(pow( 2, \2 ));
*/