зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1136494 - Update post-link validation. - r=mtseng
MozReview-Commit-ID: 75soRjg1h0o
This commit is contained in:
Родитель
55d9d2af29
Коммит
59f607e76a
|
@ -30,11 +30,10 @@ public:
|
||||||
return mWebGL;
|
return mWebGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WebGLContext* const mWebGL;
|
WebGLContext* const mWebGL;
|
||||||
|
|
||||||
// ActiveInfo state:
|
// ActiveInfo state:
|
||||||
const GLint mElemCount; // `size`
|
const uint32_t mElemCount; // `size`
|
||||||
const GLenum mElemType; // `type`
|
const GLenum mElemType; // `type`
|
||||||
const nsCString mBaseUserName; // `name`, but ASCII, and without any final "[0]".
|
const nsCString mBaseUserName; // `name`, but ASCII, and without any final "[0]".
|
||||||
|
|
||||||
|
|
|
@ -1052,43 +1052,38 @@ WebGLProgram::ValidateAfterTentativeLink(nsCString* const out_linkLog) const
|
||||||
const auto& linkInfo = mMostRecentLinkInfo;
|
const auto& linkInfo = mMostRecentLinkInfo;
|
||||||
|
|
||||||
// Check if the attrib name conflicting to uniform name
|
// Check if the attrib name conflicting to uniform name
|
||||||
for (const auto& uniform : linkInfo->uniformMap) {
|
for (const auto& attrib : linkInfo->attribs) {
|
||||||
if (linkInfo->attribMap.find(uniform.first) != linkInfo->attribMap.end()) {
|
const auto& attribName = attrib.mActiveInfo->mBaseUserName;
|
||||||
*out_linkLog = nsPrintfCString("The uniform name (%s) conflicts with"
|
|
||||||
" attribute name.",
|
for (const auto& uniform : linkInfo->uniforms) {
|
||||||
uniform.first.get());
|
const auto& uniformName = uniform->mActiveInfo->mBaseUserName;
|
||||||
|
if (attribName == uniformName) {
|
||||||
|
*out_linkLog = nsPrintfCString("Attrib name conflicts with uniform name:"
|
||||||
|
" %s",
|
||||||
|
attribName.BeginReading());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<GLuint, const WebGLActiveInfo*> attribsByLoc;
|
|
||||||
for (const auto& pair : linkInfo->activeAttribLocs) {
|
|
||||||
const auto dupe = attribsByLoc.find(pair.second);
|
|
||||||
if (dupe != attribsByLoc.end()) {
|
|
||||||
*out_linkLog = nsPrintfCString("Aliased location between active attribs"
|
|
||||||
" \"%s\" and \"%s\".",
|
|
||||||
dupe->second->mBaseUserName.BeginReading(),
|
|
||||||
pair.first->mBaseUserName.BeginReading());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& pair : attribsByLoc) {
|
std::map<uint32_t, const webgl::AttribInfo*> attribsByLoc;
|
||||||
const GLuint attribLoc = pair.first;
|
for (const auto& attrib : linkInfo->attribs) {
|
||||||
const auto attrib = pair.second;
|
const uint32_t elemSize = ElemSizeFromType(attrib.mActiveInfo->mElemType);
|
||||||
|
const uint32_t numUsedLocation = (elemSize + 3) / 4;
|
||||||
|
for (uint32_t i = 0; i < numUsedLocation; i++) {
|
||||||
|
const uint32_t usedLoc = attrib.mLoc + i;
|
||||||
|
|
||||||
const auto elemSize = ElemSizeFromType(attrib->mElemType);
|
const auto res = attribsByLoc.insert({usedLoc, &attrib});
|
||||||
const GLuint locationsUsed = (elemSize + 3) / 4;
|
const bool& didInsert = res.second;
|
||||||
for (GLuint i = 1; i < locationsUsed; i++) {
|
if (!didInsert) {
|
||||||
const GLuint usedLoc = attribLoc + i;
|
const auto& aliasingName = attrib.mActiveInfo->mBaseUserName;
|
||||||
|
const auto& itrExisting = res.first;
|
||||||
const auto dupe = attribsByLoc.find(usedLoc);
|
const auto& existingInfo = itrExisting->second;
|
||||||
if (dupe != attribsByLoc.end()) {
|
const auto& existingName = existingInfo->mActiveInfo->mBaseUserName;
|
||||||
*out_linkLog = nsPrintfCString("Attrib \"%s\" of type \"0x%04x\" aliases"
|
*out_linkLog = nsPrintfCString("Attrib \"%s\" aliases locations used by"
|
||||||
" \"%s\" by overhanging its location.",
|
" attrib \"%s\".",
|
||||||
attrib->mBaseUserName.BeginReading(),
|
aliasingName.BeginReading(),
|
||||||
attrib->mElemType,
|
existingName.BeginReading());
|
||||||
dupe->second->mBaseUserName.BeginReading());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче