glapi: add ARB_texture_multisample

V2: - Drop placeholder
    - Align enum values
    - Remove explicit exec=mesa; it *is* the dispatch flavor we want,
      but it's also the default. I misunderstood how this worked before;
      after actually reading the generator it makes good sense.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
dispatch_sanity: enable checks for ARB_texture_multisample

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: add stubs for new entrypoints for ARB_texture_multisample

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: add texobj support for ARB_texture_multisample

V2: Allow multisample texture targets in glInvalidateTexSubImage too.
This was already partly there, but I missed it the first time around
since the interaction is defined in a newer extension. Fixed weird
indentation.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
tests: add ARB_texture_multisample enums to table

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: add new texture state for ARB_texture_multisample

V2: NumSamples and FixedSampleLocations are per-image state, not texture
object state.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: support getting current binding for multisample textures

V2: Use existing code for getting bound texobj names, for the new
targets

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: add support for ARB_texture_multisample

V2: emit `sample` parameter properly for multisample texelFetch()
V3: fix spurious whitespace change

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
wire up GL_TEXTURE_SAMPLES and GL_TEXTURE_FIXED_SAMPLE_LOCATIONS

V2: fixed for state being moved from texobj to image

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: add new max sample count state

- GL_MAX_COLOR_TEXTURE_SAMPLES
- GL_MAX_DEPTH_TEXTURE_SAMPLES
- GL_MAX_INTEGER_SAMPLES

V2: initialize limits to 1 in _mesa_init_constants as suggested by Brian
and Paul

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965: expose new max sample counts

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: implement GetMultisamplefv

Actual sample locations deferred to a driverfunc since only the driver
really knows where they will be.

V2: pass the draw buffer to the driverfunc; don't fallback to pixel
center if driverfunc is missing.

V3: - rename GetSampleLocation to GetSamplePosition
    - invert y sample position for winsys FBOs, at Paul's suggestion

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: implement sample mask

V2: fix multiline comment style

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965: add support for sample mask on Gen6+

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965: expose sample positions

Moves the definition of the sample positions out of
gen6_emit_3dstate_multisample, and unpacks them in
gen6_get_sample_position.

V2: Be consistent about `sample position` rather than `location`.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: support multisample textures in framebuffer completeness check

- sample count must be the same on all attachments
- fixedsamplepositions must be the same on all attachments
(renderbuffers have fixedsamplepositions=true implicitly; only
multisample textures can choose to have it false)

V2: fix wrapping to 80 columns, debug message, fix for state moving from
texobj to image.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: adjust texture completeness for multisample

GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY targets
don't allow filtering state to be set, but the default state fails the
completeness check for integer formats.

We still care about other reasons the texture might be considered
incomplete though, so can't skip this entirely like GL_TEXTURE_BUFFER.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: allow stencil textures

ARB_texture_multisample allows STENCIL_INDEX and sized variants with the
multisample texture targets; similar to renderbuffers.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
mesa: implement TexImage*Multisample

V2: - fix formatting issues
    - generate GL_OUT_OF_MEMORY if teximage cannot be allocated
    - fix for state moving from texobj to image

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
i965: add support for multisample textures

This is a bit nasty -- I've just (ab)used the existing multisample
renderbuffer path.

Also put the actual sample count from the mt back into the
renderbuffer so core mesa can see what the driver actually gave it.

V2: - fix for state moving from texobj to image
    - rebased onto Paul's logical/physical cleanup
    - fixed missing quantization of sample count

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>