V.E.R.B.L.E.N.D.E.T.: Versatile Electronic Replicant Built for Logical Exploration, Nocturnal Destruction and Efficient Troubleshooting
I think TIR should be an option, so it is backwards compatible to 2.41 and we could disable tir in 2.42 if we dont need that really.
on my testscene, the refract_monkey, it slows down rendering by at least 20% in comparison to 2.41. it may render more correct now, but imho without tir suzanna looks nicer in this scene :)
without tir(2.41): without tear, 1:28 took 1:28
wit tir(2.42rc2): with tir, 1:48, +20sek took 1:48 (+20s)
(can you see the smile on suzannas face without tir?)

so i did almost ui stuff to include a per material option to enable tir just beneath the transparency button which was big enough to make it smaller and add a new one.


(click for fullsize)


in buttons_shading.c
static void material_panel_tramir(Material *ma)
    uiDefButF(block, NUM, B_MATPRV, "Filt:",        10,110,150,20, &(ma->filter), 0.0, 1.0, 10, 0, "Amount of filtering for transparent raytrace");
    uiDefButBitI(block, TOG, MA_RAYTRANSP, B_MATRAYTRANSP,"Ray Transp",160,110,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for transparency rendering");
//mmmh, dont know how to use new toggle button style:    uiDefButBitI(block, TOG, B_MATPRV(???), B_MATPRV(???), "TIR",260,110,50,20, &(ma->tir), 0, 0, 0, 0, "Enables total internal reflection and transmissivity");
//use old style:
    uiDefButC(block, TOG|BIT|1, B_MATPRV, "TIR",    260,110,50,20, &(ma->tir), 0, 0, 0, 0, "Enables total internal reflection and transmissivity");
in DNA_material_types.h
typedef struct Material {
    short tir, pad_tir0;
    int pad_tir1;
//needed padding here on my linux machine, without wont compile :O
} Material;
and finaly some code to penable/disable tir in ray.c per material: (dont know what to do here exactly), regarding to the patchtracker and the tir patch once posted, just a few lines to change...?