// This shader creates a 2D color remap texture from // a blend of 2 color remap curves that are represented // by a 1D texture. // We can blend between two remapping curves using a blend amount // specified in c0.a. // We create a 2D texture so that it can be used in one pass on // the frame buffer with a texreg2ar and texreg2gb to remap the spaces. // To accomplish this, we create texture coordinates that sample // the texture both horizontally and vertically, then use // constants to extract AG and RB channels and output them in // the horizontal and vertical dimensions, respectively. xps.1.1 def c0, 0,0,0,0 // this is the blend amount between each row def c1, 0,1,0,1 // extracts the G and A portions def c2, 1,0,1,0 // extracts the R and B portions // all stages are filled with the 1D color remap curve. // t0 and t1 are mapped horizontally (first curve = t1, second curve = t2 // t2 and t3 are mapped vertically (first curve = t2, second curve = t3 tex t0 tex t1 tex t2 tex t3 // r0 = blend of t0 and t1 lrp r0, c0.a, t1, t0 // r1 = blend of t2 and t3 lrp r1, c0.a, t3, t2 // extract the relavent portions of each and add them together xmma discard, discard, r0, r0, c1, r1, c2