mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
glslang: add support for validating overlapping vertex input locations in OpenGL GLSL.
This commit is contained in:
@@ -6583,7 +6583,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
||||
}
|
||||
|
||||
bool typeCollision;
|
||||
int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision);
|
||||
int repeated = intermediate.addUsedLocation(messages, qualifier, type, typeCollision);
|
||||
if (repeated >= 0 && ! typeCollision)
|
||||
error(loc, "overlapping use of location", "location", "%d", repeated);
|
||||
// When location aliasing, the aliases sharing the location must have the same underlying numerical type and bit width(
|
||||
|
||||
@@ -1644,7 +1644,7 @@ bool TIntermediate::userOutputUsed() const
|
||||
// typeCollision is set to true if there is no direct collision, but the types in the same location
|
||||
// are different.
|
||||
//
|
||||
int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& type, bool& typeCollision)
|
||||
int TIntermediate::addUsedLocation(EShMessages messages, const TQualifier& qualifier, const TType& type, bool& typeCollision)
|
||||
{
|
||||
typeCollision = false;
|
||||
|
||||
@@ -1758,7 +1758,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0, qualifier.centroid, qualifier.smooth, qualifier.flat, qualifier.sample, qualifier.patch);
|
||||
|
||||
// check for collisions, except for vertex inputs on desktop targeting OpenGL
|
||||
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
|
||||
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0 || (messages & EshMsgOverlappingLocations) != 0)
|
||||
collision = checkLocationRange(set, range, type, typeCollision);
|
||||
|
||||
if (collision < 0)
|
||||
|
||||
@@ -1058,7 +1058,7 @@ public:
|
||||
void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
|
||||
bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
|
||||
|
||||
int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
|
||||
int addUsedLocation(EShMessages, const TQualifier&, const TType&, bool& typeCollision);
|
||||
int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
|
||||
int checkLocationRT(int set, int location);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
|
||||
@@ -272,7 +272,8 @@ enum EShMessages : unsigned {
|
||||
EShMsgEnhanced = (1 << 15), // enhanced message readability
|
||||
EShMsgAbsolutePath = (1 << 16), // Output Absolute path for messages
|
||||
EShMsgDisplayErrorColumn = (1 << 17), // Display error message column aswell as line
|
||||
EshMsgCrossStageIO = (1 << 30), // Always validate cross-stage IO
|
||||
EshMsgCrossStageIO = (1 << 28), // Always validate cross-stage IO
|
||||
EshMsgOverlappingLocations = (1 << 29), // Always validate overlapping layout locations
|
||||
LAST_ELEMENT_MARKER(EShMsgCount),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user