Add compile time asserts on number of pnames, add missing pname
Fix typo where scope was fetched twice
Check for functions that might not be present in renderstate apply
Handle invalid UTF-8 bytes without infinite loop
Potentially overestimate compressed image size to avoid crashes

* I need to investigate this more. It seems that on AMD the compressed
  image size returned is the size of the whole cubemap, and then you get
  each face one-by-one. On nVidia the compressed image size is the size of
  one face, so dividing by 6 gives too little space.
* I don't know which one is standard correct, but that kind of doesn't
  matter since I probably need to query the size for maybe a 1x1 cubemap
  or a known dimension & compression format (like BC1 1 byte per pixel).