Skip to content

Commit 01a4af7

Browse files
Ramesh Viswanathanmeta-codesync[bot]
authored andcommitted
Default operator== for VertexAttribute and VertexInputBinding in VertexInputState
Reviewed By: xiendong, corporateshark Differential Revision: D93890658 fbshipit-source-id: 9e7d613b007580a9adbc28870c7bd87992f75bc3
1 parent c0b75de commit 01a4af7

2 files changed

Lines changed: 4 additions & 22 deletions

File tree

src/igl/VertexInputState.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,6 @@ size_t VertexInputStateDesc::sizeForVertexAttributeFormat(VertexAttributeFormat
118118
IGL_UNREACHABLE_RETURN(0)
119119
}
120120

121-
bool VertexInputBinding::operator!=(const VertexInputBinding& other) const {
122-
return !(*this == other);
123-
}
124-
125-
bool VertexInputBinding::operator==(const VertexInputBinding& other) const {
126-
return other.sampleRate == sampleRate && other.sampleFunction == sampleFunction &&
127-
other.stride == stride;
128-
}
129-
130121
size_t std::hash<VertexInputBinding>::operator()(const VertexInputBinding& key) const {
131122
size_t hash = 0;
132123
hash ^= std::hash<int>()(static_cast<int>(key.sampleRate));
@@ -135,10 +126,6 @@ size_t std::hash<VertexInputBinding>::operator()(const VertexInputBinding& key)
135126
return hash;
136127
}
137128

138-
bool VertexAttribute::operator!=(const VertexAttribute& other) const {
139-
return !(*this == other);
140-
}
141-
142129
size_t std::hash<VertexAttribute>::operator()(const VertexAttribute& key) const {
143130
size_t hash = 0;
144131
hash ^= std::hash<std::string>()(key.name);
@@ -149,11 +136,6 @@ size_t std::hash<VertexAttribute>::operator()(const VertexAttribute& key) const
149136
return hash;
150137
}
151138

152-
bool VertexAttribute::operator==(const VertexAttribute& other) const {
153-
return other.name == name && other.location == location && other.bufferIndex == bufferIndex &&
154-
other.format == format && other.offset == offset;
155-
}
156-
157139
bool VertexInputStateDesc::operator==(const VertexInputStateDesc& other) const {
158140
if (other.numAttributes != numAttributes || other.numInputBindings != numInputBindings) {
159141
return false;

src/igl/VertexInputState.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ struct VertexAttribute {
107107
std::string name; // GLES Only
108108
int location = -1; // Metal only
109109

110-
bool operator==(const VertexAttribute& other) const;
111-
bool operator!=(const VertexAttribute& other) const;
110+
bool operator==(const VertexAttribute& other) const = default;
111+
bool operator!=(const VertexAttribute& other) const = default;
112112
};
113113

114114
/**
@@ -119,8 +119,8 @@ struct VertexInputBinding {
119119
VertexSampleFunction sampleFunction = VertexSampleFunction::PerVertex;
120120
size_t sampleRate = 1;
121121

122-
bool operator==(const VertexInputBinding& other) const;
123-
bool operator!=(const VertexInputBinding& other) const;
122+
bool operator==(const VertexInputBinding& other) const = default;
123+
bool operator!=(const VertexInputBinding& other) const = default;
124124
};
125125

126126
/**

0 commit comments

Comments
 (0)