I propose to subsume the functionality of the following portions of the GL into a programmable unit: Stippling, Scissor Test, Alpha Test, Stencil Test, Depth Test, Blending, and Logic Op.
The program would have the following input registers:
textel - the color of the pixel as passed from the fragment program or ff-pipeline (R,G,B,A).
viewpos - the viewport coordinate of the pixel (x,y).
color - the value of the corresponding location in the frame buffer (R,G,B)
alpha - the value of the corresponding location in the alpha buffer (A).
stencil - the value of the corresponding location in the stencil buffer (S).
The program would have the following output registers:
color - the color of the rendered pixel (R,G,B).
alpha - the alpha of the rendered alpha buffer (A).
stencil - the stencil of the rendered stencil (S).
The features for this programmability would necessarily include:
KILL - Test Units - prevents rendering of this pixel in every buffer, as if the program had never begun
CMP - Test Units - generates a GREATER, EQUAL, LESSER test result (probably a -1, 0, 1 comparison)
ADD - Blend, Stipple - addition
SUB - Blend, Stipple - subtraction
MUL - Blend, Stipple - multiplication
MIN - Blend - minimum of arguments
MAX - Blend - maximum of arguments
MOD - Stipple - remainder (slightly different than modulus)
NOT - Logic Op - logical inversion of bits
AND - Logic Op - logical and of bits
OR - Logic Op - logical inclusive or of bits
NAND - Logic Op - logical nand of bits
XOR - Logic Op - logical exclusive or of bits
Support instruction might include:
MAD - Multiply and Add
MOV - Move
SGE - Set on GreaterEqual
SLT - Set on LessThan
CLAMP - Clamp to Range (like [-1,1])
It would include Attibutes and Environment like the Fragment and Vertex programs – see GL Extensions GL_ARB_vertex_program SGI_ARB#26, and GL_ARB_fragment_program SGI_ARB#27 – for additional values.