mesa: Check glReadBuffer enums against the ES3 table.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 24 Mar 2016 05:35:41 +0000 (22:35 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 24 Mar 2016 23:52:08 +0000 (16:52 -0700)
commit511ce2925baf90c1d93d3e6a389d31e8e7549493
treed9425afd6c94a73e587c45e82f2e583b5702a5c2
parent22b343a8ec75a08dae6a6badbb261eab8437475d
mesa: Check glReadBuffer enums against the ES3 table.

From the ES 3.2 spec, section 16.1.1 (Selecting Buffers for Reading):

   "An INVALID_ENUM error is generated if src is not BACK or one of
    the values from table 15.5."

Table 15.5 contains NONE and COLOR_ATTACHMENTi.

Mesa properly returned INVALID_ENUM for unknown enums, but it decided
what was known by using read_buffer_enum_to_index, which handles all
enums in every API.  So enums that were valid in GL were making it
past the "valid enum" check.  Such targets would then be classified
as unsupported, and we'd raise INVALID_OPERATION, but that's technically
the wrong error code.

Fixes dEQP-GLES31's
functional.debug.negative_coverage.get_error.buffer.read_buffer

v2: Only call read_buffer_enuM_to_index when required (Eduardo).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/mesa/main/buffers.c