Validate GLSL attribute location range
The location index of a vertex shader input's layout qualifier must be
less than GL_MAX_VERTEX_ATTRIBS to link successfully. We can check for
this during shader compilation to not rely on other layers to handle
pathological cases.
While strictly speaking only 'active' attributes are considered during
shader linking, this is merely intended to allow for 'uber' shaders to
declare more inputs than GL_MAX_VERTEX_ATTRIBS but only use a subset of
them. There is no known reasonable use case for a manually specified
location to exceed the valid range.
Note that according to http://opengl.gpuinfo.org, the highest
GL_MAX_VERTEX_ATTRIBS value at the time of writing is 32. Also,
D3D12_VS_INPUT_REGISTER_COUNT = 32. Hence the unit test's value of 1000
should be sufficiently future proof.
Also address the case where the uniform location might be close to
INT_MAX and not be detected as out-of-range due to numeric overflow.
Bug: chromium:1110800
Change-Id: I9985c8eab3bb8a2a59b8f985e8f5b6884756383c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2405368Reviewed-by:
Jamie Madill <jmadill@chromium.org>
Reviewed-by:
Geoff Lang <geofflang@chromium.org>
Commit-Queue: Nicolas Capens <capn@chromium.org>
Showing
Please
register
or
sign in
to comment