Restrict to a specific viewport?

had a similar thread:

but stuck changing the shadercode
could someone post sample patch according joreg instructions?