location aliasing (#3438)

* location aliasing
    when location aliasing, the aliases sharing the location must have the same underlying numerical type
    (floating-point or integer) and the same auxiliary storage and interpolation qualification.
    The following case, glslang need report error.

    layout(vertices = 1) out;

    layout (location = 1, component = 0)  in  double gohan[];
    layout (location = 1, component = 2)  in  float goten[];

    in  vec4 vs_tcs[];
    out vec4 tcs_tes[];

    void main()
    {
    }

* Need consider the following case: location aliasing with different interpolation qualifier.
This commit is contained in:
jimihem 2024-04-27 00:05:08 +08:00 committed by GitHub
parent 9337143313
commit 44fcbccd06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 114 additions and 13 deletions

View file

@ -6568,10 +6568,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision);
if (repeated >= 0 && ! typeCollision)
error(loc, "overlapping use of location", "location", "%d", repeated);
// "fragment-shader outputs/tileImageEXT ... if two variables are placed within the same
// location, they must have the same underlying type (floating-point or integer)"
if (typeCollision && language == EShLangFragment && (qualifier.isPipeOutput() || qualifier.storage == EvqTileImageEXT))
error(loc, "fragment outputs or tileImageEXTs sharing the same location", "location", "%d must be the same basic type", repeated);
// When location aliasing, the aliases sharing the location must have the same underlying numerical type and bit width(
// floating - point or integer, 32 - bit versus 64 - bit,etc.)
if (typeCollision && (qualifier.isPipeInput() || qualifier.isPipeOutput() || qualifier.storage == EvqTileImageEXT))
error(loc, "the aliases sharing the location", "location", "%d must be the same basic type and interpolation qualification", repeated);
}
if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) {