mesa: Fix GL_SHADER_BINARY_FORMATS query
There were two bugs here. First, this and several other queries were
not available in a desktop GL context with GL_ARB_ES2_compatibility.
Second, GL_NUM_SHADER_BINARY_FORMATS returns zero, but
GL_SHADER_BINARY_FORMATS writes one element of data to the buffer. If
NUM is zero, no data should be written.
Fixes piglit test 'arb_get_program_binary-overrun shader'.
NOTE: This is a candidate for stable release branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>