Commit bb3adfa4 by Shahbaz Youssefi Committed by Commit Bot

Rename ShaderVariable::structName to structOrBlockName

Bug: angleproject:3580 Change-Id: Ic53a5267972f153dad2e20948e493e9767a45d16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568247 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent df33d561
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 251 #define ANGLE_SH_VERSION 252
enum ShShaderSpec enum ShShaderSpec
{ {
......
...@@ -100,8 +100,8 @@ struct ShaderVariable ...@@ -100,8 +100,8 @@ struct ShaderVariable
unsigned int getExternalSize() const; unsigned int getExternalSize() const;
bool isStruct() const { return !fields.empty(); } bool isStruct() const { return !fields.empty(); }
const std::string &getStructName() const { return structName; } const std::string &getStructName() const { return structOrBlockName; }
void setStructName(const std::string &newName) { structName = newName; } void setStructName(const std::string &newName) { structOrBlockName = newName; }
// All of the shader's variables are described using nested data // All of the shader's variables are described using nested data
// structures. This is needed in order to disambiguate similar looking // structures. This is needed in order to disambiguate similar looking
...@@ -155,10 +155,12 @@ struct ShaderVariable ...@@ -155,10 +155,12 @@ struct ShaderVariable
// necessarily active. GLES 3.0.5 section 2.12.6. GLES 3.1 section 7.3.1. // necessarily active. GLES 3.0.5 section 2.12.6. GLES 3.1 section 7.3.1.
bool active; bool active;
std::vector<ShaderVariable> fields; std::vector<ShaderVariable> fields;
// Struct name is used for varyings of struct type. Additionally, it's used with shader I/O // structOrBlockName is used for:
// blocks, in which case it contains the block name. //
std::string structName; // - varyings of struct type, in which case it contains the struct name.
std::string mappedStructName; // - shader I/O blocks, in which case it contains the block name.
std::string structOrBlockName;
std::string mappedStructOrBlockName;
// Only applies to interface block fields. Kept here for simplicity. // Only applies to interface block fields. Kept here for simplicity.
bool isRowMajorLayout; bool isRowMajorLayout;
......
...@@ -673,7 +673,7 @@ void PrintVariable(const std::string &prefix, size_t index, const sh::ShaderVari ...@@ -673,7 +673,7 @@ void PrintVariable(const std::string &prefix, size_t index, const sh::ShaderVari
std::string structPrefix; std::string structPrefix;
for (size_t i = 0; i < prefix.size(); ++i) for (size_t i = 0; i < prefix.size(); ++i)
structPrefix += ' '; structPrefix += ' ';
printf("%s struct %s\n", structPrefix.c_str(), var.structName.c_str()); printf("%s struct %s\n", structPrefix.c_str(), var.structOrBlockName.c_str());
structPrefix += " field"; structPrefix += " field";
for (size_t i = 0; i < var.fields.size(); ++i) for (size_t i = 0; i < var.fields.size(); ++i)
PrintVariable(structPrefix, i, var.fields[i]); PrintVariable(structPrefix, i, var.fields[i]);
......
...@@ -101,7 +101,7 @@ ShaderVariable *FindShaderIOBlockVariable(const ImmutableString &blockName, ...@@ -101,7 +101,7 @@ ShaderVariable *FindShaderIOBlockVariable(const ImmutableString &blockName,
{ {
for (size_t index = 0; index < infoList->size(); ++index) for (size_t index = 0; index < infoList->size(); ++index)
{ {
if (blockName == (*infoList)[index].structName) if (blockName == (*infoList)[index].structOrBlockName)
return &(*infoList)[index]; return &(*infoList)[index];
} }
...@@ -755,7 +755,7 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type, ...@@ -755,7 +755,7 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type,
variableOut->type = GL_NONE; variableOut->type = GL_NONE;
if (structure->symbolType() != SymbolType::Empty) if (structure->symbolType() != SymbolType::Empty)
{ {
variableOut->structName = structure->name().data(); variableOut->structOrBlockName = structure->name().data();
} }
const TFieldList &fields = structure->fields(); const TFieldList &fields = structure->fields();
...@@ -775,8 +775,8 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type, ...@@ -775,8 +775,8 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type,
variableOut->type = GL_NONE; variableOut->type = GL_NONE;
if (interfaceBlock->symbolType() != SymbolType::Empty) if (interfaceBlock->symbolType() != SymbolType::Empty)
{ {
variableOut->structName = interfaceBlock->name().data(); variableOut->structOrBlockName = interfaceBlock->name().data();
variableOut->mappedStructName = variableOut->mappedStructOrBlockName =
HashName(interfaceBlock->name(), mHashFunction, nullptr).data(); HashName(interfaceBlock->name(), mHashFunction, nullptr).data();
} }
const TFieldList &fields = interfaceBlock->fields(); const TFieldList &fields = interfaceBlock->fields();
...@@ -859,16 +859,16 @@ void CollectVariablesTraverser::setCommonVariableProperties(const TType &type, ...@@ -859,16 +859,16 @@ void CollectVariablesTraverser::setCommonVariableProperties(const TType &type,
variableOut->mappedName = getMappedName(&variable); variableOut->mappedName = getMappedName(&variable);
} }
// For I/O blocks, additionally store the name of the block as structName. If the variable is // For I/O blocks, additionally store the name of the block as blockName. If the variable is
// unnamed, this name will be used instead for the purpose of interface matching. // unnamed, this name will be used instead for the purpose of interface matching.
if (isShaderIOBlock) if (isShaderIOBlock)
{ {
const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock(); const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
ASSERT(interfaceBlock); ASSERT(interfaceBlock);
variableOut->structName.assign(interfaceBlock->name().data(), variableOut->structOrBlockName.assign(interfaceBlock->name().data(),
interfaceBlock->name().length()); interfaceBlock->name().length());
variableOut->mappedStructName = variableOut->mappedStructOrBlockName =
HashName(interfaceBlock->name(), mHashFunction, nullptr).data(); HashName(interfaceBlock->name(), mHashFunction, nullptr).data();
variableOut->isShaderIOBlock = true; variableOut->isShaderIOBlock = true;
} }
......
...@@ -73,8 +73,8 @@ ShaderVariable::ShaderVariable(const ShaderVariable &other) ...@@ -73,8 +73,8 @@ ShaderVariable::ShaderVariable(const ShaderVariable &other)
staticUse(other.staticUse), staticUse(other.staticUse),
active(other.active), active(other.active),
fields(other.fields), fields(other.fields),
structName(other.structName), structOrBlockName(other.structOrBlockName),
mappedStructName(other.mappedStructName), mappedStructOrBlockName(other.mappedStructOrBlockName),
isRowMajorLayout(other.isRowMajorLayout), isRowMajorLayout(other.isRowMajorLayout),
location(other.location), location(other.location),
hasImplicitLocation(other.hasImplicitLocation), hasImplicitLocation(other.hasImplicitLocation),
...@@ -103,8 +103,8 @@ ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other) ...@@ -103,8 +103,8 @@ ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
staticUse = other.staticUse; staticUse = other.staticUse;
active = other.active; active = other.active;
fields = other.fields; fields = other.fields;
structName = other.structName; structOrBlockName = other.structOrBlockName;
mappedStructName = other.mappedStructName; mappedStructOrBlockName = other.mappedStructOrBlockName;
isRowMajorLayout = other.isRowMajorLayout; isRowMajorLayout = other.isRowMajorLayout;
flattenedOffsetInParentArrays = other.flattenedOffsetInParentArrays; flattenedOffsetInParentArrays = other.flattenedOffsetInParentArrays;
location = other.location; location = other.location;
...@@ -129,12 +129,13 @@ bool ShaderVariable::operator==(const ShaderVariable &other) const ...@@ -129,12 +129,13 @@ bool ShaderVariable::operator==(const ShaderVariable &other) const
if (type != other.type || precision != other.precision || name != other.name || if (type != other.type || precision != other.precision || name != other.name ||
mappedName != other.mappedName || arraySizes != other.arraySizes || mappedName != other.mappedName || arraySizes != other.arraySizes ||
staticUse != other.staticUse || active != other.active || staticUse != other.staticUse || active != other.active ||
fields.size() != other.fields.size() || structName != other.structName || fields.size() != other.fields.size() || structOrBlockName != other.structOrBlockName ||
mappedStructName != other.mappedStructName || isRowMajorLayout != other.isRowMajorLayout || mappedStructOrBlockName != other.mappedStructOrBlockName ||
location != other.location || hasImplicitLocation != other.hasImplicitLocation || isRowMajorLayout != other.isRowMajorLayout || location != other.location ||
binding != other.binding || imageUnitFormat != other.imageUnitFormat || hasImplicitLocation != other.hasImplicitLocation || binding != other.binding ||
offset != other.offset || readonly != other.readonly || writeonly != other.writeonly || imageUnitFormat != other.imageUnitFormat || offset != other.offset ||
index != other.index || yuv != other.yuv || interpolation != other.interpolation || readonly != other.readonly || writeonly != other.writeonly || index != other.index ||
yuv != other.yuv || interpolation != other.interpolation ||
isInvariant != other.isInvariant || isShaderIOBlock != other.isShaderIOBlock || isInvariant != other.isInvariant || isShaderIOBlock != other.isShaderIOBlock ||
isPatch != other.isPatch || texelFetchStaticUse != other.texelFetchStaticUse) isPatch != other.isPatch || texelFetchStaticUse != other.texelFetchStaticUse)
{ {
...@@ -323,7 +324,7 @@ const sh::ShaderVariable *ShaderVariable::findField(const std::string &fullName, ...@@ -323,7 +324,7 @@ const sh::ShaderVariable *ShaderVariable::findField(const std::string &fullName,
} }
else else
{ {
std::string baseName = isShaderIOBlock ? structName : name; std::string baseName = isShaderIOBlock ? structOrBlockName : name;
topName = fullName.substr(0, pos); topName = fullName.substr(0, pos);
if (topName != baseName) if (topName != baseName)
{ {
...@@ -384,7 +385,8 @@ bool ShaderVariable::isSameVariableAtLinkTime(const ShaderVariable &other, ...@@ -384,7 +385,8 @@ bool ShaderVariable::isSameVariableAtLinkTime(const ShaderVariable &other,
return false; return false;
} }
} }
if (structName != other.structName || mappedStructName != other.mappedStructName) if (structOrBlockName != other.structOrBlockName ||
mappedStructOrBlockName != other.mappedStructOrBlockName)
return false; return false;
return true; return true;
} }
...@@ -461,7 +463,7 @@ bool ShaderVariable::isSameNameAtLinkTime(const ShaderVariable &other) const ...@@ -461,7 +463,7 @@ bool ShaderVariable::isSameNameAtLinkTime(const ShaderVariable &other) const
if (isShaderIOBlock) if (isShaderIOBlock)
{ {
// Shader I/O blocks match by block name. // Shader I/O blocks match by block name.
return structName == other.structName; return structOrBlockName == other.structOrBlockName;
} }
// Otherwise match by name. // Otherwise match by name.
......
...@@ -685,7 +685,7 @@ void UpdateInterfaceVariable(std::vector<sh::ShaderVariable> *block, const sh::S ...@@ -685,7 +685,7 @@ void UpdateInterfaceVariable(std::vector<sh::ShaderVariable> *block, const sh::S
// type field; // produces "Block2.field" // type field; // produces "Block2.field"
// } block2; // } block2;
// //
const std::string &baseName = var.isShaderIOBlock ? var.structName : var.name; const std::string &baseName = var.isShaderIOBlock ? var.structOrBlockName : var.name;
const std::string prefix = var.name.empty() ? "" : baseName + "."; const std::string prefix = var.name.empty() ? "" : baseName + ".";
if (!field.isStruct()) if (!field.isStruct())
...@@ -936,8 +936,8 @@ void WriteShaderVar(BinaryOutputStream *stream, const sh::ShaderVariable &var) ...@@ -936,8 +936,8 @@ void WriteShaderVar(BinaryOutputStream *stream, const sh::ShaderVariable &var)
stream->writeBool(var.staticUse); stream->writeBool(var.staticUse);
stream->writeBool(var.active); stream->writeBool(var.active);
stream->writeInt(var.binding); stream->writeInt(var.binding);
stream->writeString(var.structName); stream->writeString(var.structOrBlockName);
stream->writeString(var.mappedStructName); stream->writeString(var.mappedStructOrBlockName);
stream->writeInt(var.hasParentArrayIndex() ? var.parentArrayIndex() : -1); stream->writeInt(var.hasParentArrayIndex() ? var.parentArrayIndex() : -1);
stream->writeInt(var.imageUnitFormat); stream->writeInt(var.imageUnitFormat);
...@@ -956,11 +956,11 @@ void LoadShaderVar(BinaryInputStream *stream, sh::ShaderVariable *var) ...@@ -956,11 +956,11 @@ void LoadShaderVar(BinaryInputStream *stream, sh::ShaderVariable *var)
var->name = stream->readString(); var->name = stream->readString();
var->mappedName = stream->readString(); var->mappedName = stream->readString();
stream->readIntVector<unsigned int>(&var->arraySizes); stream->readIntVector<unsigned int>(&var->arraySizes);
var->staticUse = stream->readBool(); var->staticUse = stream->readBool();
var->active = stream->readBool(); var->active = stream->readBool();
var->binding = stream->readInt<int>(); var->binding = stream->readInt<int>();
var->structName = stream->readString(); var->structOrBlockName = stream->readString();
var->mappedStructName = stream->readString(); var->mappedStructOrBlockName = stream->readString();
var->setParentArrayIndex(stream->readInt<int>()); var->setParentArrayIndex(stream->readInt<int>());
var->imageUnitFormat = stream->readInt<GLenum>(); var->imageUnitFormat = stream->readInt<GLenum>();
......
...@@ -81,8 +81,8 @@ struct TransformFeedbackVarying : public sh::ShaderVariable ...@@ -81,8 +81,8 @@ struct TransformFeedbackVarying : public sh::ShaderVariable
name = parent.name + "." + name; name = parent.name + "." + name;
mappedName = parent.mappedName + "." + mappedName; mappedName = parent.mappedName + "." + mappedName;
} }
structName = parent.structName; structOrBlockName = parent.structOrBlockName;
mappedStructName = parent.mappedStructName; mappedStructOrBlockName = parent.mappedStructOrBlockName;
} }
std::string nameWithArrayIndex() const std::string nameWithArrayIndex() const
......
...@@ -1653,7 +1653,8 @@ bool LinkValidateShaderInterfaceMatching(const std::vector<sh::ShaderVariable> & ...@@ -1653,7 +1653,8 @@ bool LinkValidateShaderInterfaceMatching(const std::vector<sh::ShaderVariable> &
// if it is not active. GLSL ES 3.00.6 section 4.3.10. // if it is not active. GLSL ES 3.00.6 section 4.3.10.
if (!match && input->staticUse) if (!match && input->staticUse)
{ {
const std::string &name = input->isShaderIOBlock ? input->structName : input->name; const std::string &name =
input->isShaderIOBlock ? input->structOrBlockName : input->name;
infoLog << GetShaderTypeString(backShaderType) << " varying " << name infoLog << GetShaderTypeString(backShaderType) << " varying " << name
<< " does not match any " << GetShaderTypeString(frontShaderType) << " varying"; << " does not match any " << GetShaderTypeString(frontShaderType) << " varying";
return false; return false;
...@@ -1702,7 +1703,7 @@ LinkMismatchError LinkValidateProgramVariables(const sh::ShaderVariable &variabl ...@@ -1702,7 +1703,7 @@ LinkMismatchError LinkValidateProgramVariables(const sh::ShaderVariable &variabl
return LinkMismatchError::PRECISION_MISMATCH; return LinkMismatchError::PRECISION_MISMATCH;
} }
if (!variable1.isShaderIOBlock && !variable2.isShaderIOBlock && if (!variable1.isShaderIOBlock && !variable2.isShaderIOBlock &&
variable1.structName != variable2.structName) variable1.structOrBlockName != variable2.structOrBlockName)
{ {
return LinkMismatchError::STRUCT_NAME_MISMATCH; return LinkMismatchError::STRUCT_NAME_MISMATCH;
} }
...@@ -1738,7 +1739,7 @@ LinkMismatchError LinkValidateProgramVariables(const sh::ShaderVariable &variabl ...@@ -1738,7 +1739,7 @@ LinkMismatchError LinkValidateProgramVariables(const sh::ShaderVariable &variabl
return LinkMismatchError::FIELD_LOCATION_MISMATCH; return LinkMismatchError::FIELD_LOCATION_MISMATCH;
} }
if (member1.structName != member2.structName) if (member1.structOrBlockName != member2.structOrBlockName)
{ {
return LinkMismatchError::FIELD_STRUCT_NAME_MISMATCH; return LinkMismatchError::FIELD_STRUCT_NAME_MISMATCH;
} }
......
...@@ -708,8 +708,8 @@ std::string Shader::getTransformFeedbackVaryingMappedName(const std::string &tfV ...@@ -708,8 +708,8 @@ std::string Shader::getTransformFeedbackVaryingMappedName(const std::string &tfV
// If it's an I/O block without an instance name, don't include the block name. // If it's an I/O block without an instance name, don't include the block name.
if (!varying.isShaderIOBlock || !varying.name.empty()) if (!varying.isShaderIOBlock || !varying.name.empty())
{ {
mappedName = mappedName = varying.isShaderIOBlock ? varying.mappedStructOrBlockName
varying.isShaderIOBlock ? varying.mappedStructName : varying.mappedName; : varying.mappedName;
mappedName += '.'; mappedName += '.';
} }
return mappedName + field->mappedName; return mappedName + field->mappedName;
......
...@@ -105,8 +105,8 @@ bool InterfaceVariablesMatch(const sh::ShaderVariable &front, const sh::ShaderVa ...@@ -105,8 +105,8 @@ bool InterfaceVariablesMatch(const sh::ShaderVariable &front, const sh::ShaderVa
} }
// Compare names, or if shader I/O blocks, block names. // Compare names, or if shader I/O blocks, block names.
const std::string &backName = back.isShaderIOBlock ? back.structName : back.name; const std::string &backName = back.isShaderIOBlock ? back.structOrBlockName : back.name;
const std::string &frontName = front.isShaderIOBlock ? front.structName : front.name; const std::string &frontName = front.isShaderIOBlock ? front.structOrBlockName : front.name;
return backName == frontName; return backName == frontName;
} }
...@@ -569,8 +569,8 @@ void VaryingPacking::collectUserVaryingField(const ProgramVaryingRef &ref, ...@@ -569,8 +569,8 @@ void VaryingPacking::collectUserVaryingField(const ProgramVaryingRef &ref,
{ {
if (frontField->isShaderIOBlock) if (frontField->isShaderIOBlock)
{ {
frontVarying.parentStructName = input->structName; frontVarying.parentStructName = input->structOrBlockName;
frontVarying.parentStructMappedName = input->mappedStructName; frontVarying.parentStructMappedName = input->mappedStructOrBlockName;
} }
else else
{ {
...@@ -583,8 +583,8 @@ void VaryingPacking::collectUserVaryingField(const ProgramVaryingRef &ref, ...@@ -583,8 +583,8 @@ void VaryingPacking::collectUserVaryingField(const ProgramVaryingRef &ref,
{ {
if (backField->isShaderIOBlock) if (backField->isShaderIOBlock)
{ {
backVarying.parentStructName = output->structName; backVarying.parentStructName = output->structOrBlockName;
backVarying.parentStructMappedName = output->mappedStructName; backVarying.parentStructMappedName = output->mappedStructOrBlockName;
} }
else else
{ {
...@@ -641,8 +641,8 @@ void VaryingPacking::collectUserVaryingFieldTF(const ProgramVaryingRef &ref, ...@@ -641,8 +641,8 @@ void VaryingPacking::collectUserVaryingFieldTF(const ProgramVaryingRef &ref,
if (frontField->isShaderIOBlock) if (frontField->isShaderIOBlock)
{ {
frontVarying.parentStructName = input->structName; frontVarying.parentStructName = input->structOrBlockName;
frontVarying.parentStructMappedName = input->mappedStructName; frontVarying.parentStructMappedName = input->mappedStructOrBlockName;
} }
else else
{ {
...@@ -720,7 +720,7 @@ void VaryingPacking::collectVarying(const sh::ShaderVariable &varying, ...@@ -720,7 +720,7 @@ void VaryingPacking::collectVarying(const sh::ShaderVariable &varying,
(*uniqueFullNames)[ref.frontShaderStage].insert(input->name); (*uniqueFullNames)[ref.frontShaderStage].insert(input->name);
if (input->isShaderIOBlock) if (input->isShaderIOBlock)
{ {
(*uniqueFullNames)[ref.frontShaderStage].insert(input->structName); (*uniqueFullNames)[ref.frontShaderStage].insert(input->structOrBlockName);
} }
} }
if (output) if (output)
...@@ -747,7 +747,7 @@ void VaryingPacking::collectTFVarying(const std::string &tfVarying, ...@@ -747,7 +747,7 @@ void VaryingPacking::collectTFVarying(const std::string &tfVarying,
if ((*uniqueFullNames)[ref.frontShaderStage].count(tfVarying) > 0 || if ((*uniqueFullNames)[ref.frontShaderStage].count(tfVarying) > 0 ||
(*uniqueFullNames)[ref.frontShaderStage].count(baseName) > 0 || (*uniqueFullNames)[ref.frontShaderStage].count(baseName) > 0 ||
(input->isShaderIOBlock && (input->isShaderIOBlock &&
(*uniqueFullNames)[ref.frontShaderStage].count(input->structName) > 0)) (*uniqueFullNames)[ref.frontShaderStage].count(input->structOrBlockName) > 0))
{ {
return; return;
} }
...@@ -783,7 +783,7 @@ void VaryingPacking::collectTFVarying(const std::string &tfVarying, ...@@ -783,7 +783,7 @@ void VaryingPacking::collectTFVarying(const std::string &tfVarying,
} }
} }
(*uniqueFullNames)[ref.frontShaderStage].insert(input->structName); (*uniqueFullNames)[ref.frontShaderStage].insert(input->structOrBlockName);
} }
else else
{ {
......
...@@ -601,8 +601,8 @@ void SerializeShaderVariable(gl::BinaryOutputStream *bos, const sh::ShaderVariab ...@@ -601,8 +601,8 @@ void SerializeShaderVariable(gl::BinaryOutputStream *bos, const sh::ShaderVariab
{ {
SerializeShaderVariable(bos, field); SerializeShaderVariable(bos, field);
} }
bos->writeString(shaderVariable.structName); bos->writeString(shaderVariable.structOrBlockName);
bos->writeString(shaderVariable.mappedStructName); bos->writeString(shaderVariable.mappedStructOrBlockName);
bos->writeBool(shaderVariable.isRowMajorLayout); bos->writeBool(shaderVariable.isRowMajorLayout);
bos->writeInt(shaderVariable.location); bos->writeInt(shaderVariable.location);
bos->writeInt(shaderVariable.binding); bos->writeInt(shaderVariable.binding);
......
...@@ -797,7 +797,7 @@ void AssignTransformFeedbackExtensionQualifiers(const gl::ProgramExecutable &pro ...@@ -797,7 +797,7 @@ void AssignTransformFeedbackExtensionQualifiers(const gl::ProgramExecutable &pro
if (tfVarying.isShaderIOBlock) if (tfVarying.isShaderIOBlock)
{ {
if (varying->frontVarying.parentStructName == tfVarying.structName) if (varying->frontVarying.parentStructName == tfVarying.structOrBlockName)
{ {
size_t pos = tfVarying.name.find_first_of("."); size_t pos = tfVarying.name.find_first_of(".");
std::string fieldName = pos == std::string::npos std::string fieldName = pos == std::string::npos
......
...@@ -863,7 +863,7 @@ TEST_F(CollectHashedVertexVariablesTest, StructUniform) ...@@ -863,7 +863,7 @@ TEST_F(CollectHashedVertexVariablesTest, StructUniform)
EXPECT_FALSE(uniform.isArray()); EXPECT_FALSE(uniform.isArray());
EXPECT_EQ("u", uniform.name); EXPECT_EQ("u", uniform.name);
EXPECT_EQ("webgl_1", uniform.mappedName); EXPECT_EQ("webgl_1", uniform.mappedName);
EXPECT_EQ("sType", uniform.structName); EXPECT_EQ("sType", uniform.structOrBlockName);
EXPECT_TRUE(uniform.staticUse); EXPECT_TRUE(uniform.staticUse);
EXPECT_TRUE(uniform.active); EXPECT_TRUE(uniform.active);
...@@ -907,7 +907,7 @@ TEST_F(CollectHashedVertexVariablesTest, NamelessStructUniform) ...@@ -907,7 +907,7 @@ TEST_F(CollectHashedVertexVariablesTest, NamelessStructUniform)
EXPECT_FALSE(uniform.isArray()); EXPECT_FALSE(uniform.isArray());
EXPECT_EQ("u", uniform.name); EXPECT_EQ("u", uniform.name);
EXPECT_EQ("webgl_1", uniform.mappedName); EXPECT_EQ("webgl_1", uniform.mappedName);
EXPECT_EQ("", uniform.structName); EXPECT_EQ("", uniform.structOrBlockName);
EXPECT_TRUE(uniform.staticUse); EXPECT_TRUE(uniform.staticUse);
EXPECT_TRUE(uniform.active); EXPECT_TRUE(uniform.active);
...@@ -1044,7 +1044,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInFields) ...@@ -1044,7 +1044,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInFields)
const ShaderVariable &glIn = inVaryings[0]; const ShaderVariable &glIn = inVaryings[0];
EXPECT_EQ("gl_in", glIn.name); EXPECT_EQ("gl_in", glIn.name);
EXPECT_EQ("gl_PerVertex", glIn.structName); EXPECT_EQ("gl_PerVertex", glIn.structOrBlockName);
EXPECT_TRUE(glIn.staticUse); EXPECT_TRUE(glIn.staticUse);
EXPECT_TRUE(glIn.active); EXPECT_TRUE(glIn.active);
EXPECT_TRUE(glIn.isBuiltIn()); EXPECT_TRUE(glIn.isBuiltIn());
...@@ -1184,7 +1184,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression) ...@@ -1184,7 +1184,7 @@ TEST_F(CollectGeometryVariablesTest, CollectGLInIndexedByExpression)
{ {
foundGLIn = true; foundGLIn = true;
EXPECT_TRUE(varying.isShaderIOBlock); EXPECT_TRUE(varying.isShaderIOBlock);
EXPECT_EQ("gl_PerVertex", varying.structName); EXPECT_EQ("gl_PerVertex", varying.structOrBlockName);
} }
else if (varying.name == "gl_InvocationID") else if (varying.name == "gl_InvocationID")
{ {
......
...@@ -26,14 +26,14 @@ TEST(ShaderVariableTest, FindInfoByMappedName) ...@@ -26,14 +26,14 @@ TEST(ShaderVariableTest, FindInfoByMappedName)
// }; // };
// B uni[2]; // B uni[2];
ShaderVariable uni(0, 2); ShaderVariable uni(0, 2);
uni.name = "uni"; uni.name = "uni";
uni.mappedName = "m_uni"; uni.mappedName = "m_uni";
uni.structName = "B"; uni.structOrBlockName = "B";
{ {
ShaderVariable a(0, 3); ShaderVariable a(0, 3);
a.name = "a"; a.name = "a";
a.mappedName = "m_a"; a.mappedName = "m_a";
a.structName = "A"; a.structOrBlockName = "A";
{ {
ShaderVariable x(GL_FLOAT, 2); ShaderVariable x(GL_FLOAT, 2);
x.name = "x"; x.name = "x";
...@@ -86,9 +86,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentFieldOrder) ...@@ -86,9 +86,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentFieldOrder)
// }; // };
// uniform A uni; // uniform A uni;
ShaderVariable vx_a; ShaderVariable vx_a;
vx_a.name = "uni"; vx_a.name = "uni";
vx_a.mappedName = "m_uni"; vx_a.mappedName = "m_uni";
vx_a.structName = "A"; vx_a.structOrBlockName = "A";
{ {
ShaderVariable x(GL_FLOAT); ShaderVariable x(GL_FLOAT);
x.name = "x"; x.name = "x";
...@@ -107,9 +107,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentFieldOrder) ...@@ -107,9 +107,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentFieldOrder)
// }; // };
// uniform A uni; // uniform A uni;
ShaderVariable fx_a; ShaderVariable fx_a;
fx_a.name = "uni"; fx_a.name = "uni";
fx_a.mappedName = "m_uni"; fx_a.mappedName = "m_uni";
fx_a.structName = "A"; fx_a.structOrBlockName = "A";
{ {
ShaderVariable y(GL_FLOAT); ShaderVariable y(GL_FLOAT);
y.name = "y"; y.name = "y";
...@@ -133,9 +133,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentStructNames) ...@@ -133,9 +133,9 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentStructNames)
// }; // };
// uniform A uni; // uniform A uni;
ShaderVariable vx_a; ShaderVariable vx_a;
vx_a.name = "uni"; vx_a.name = "uni";
vx_a.mappedName = "m_uni"; vx_a.mappedName = "m_uni";
vx_a.structName = "A"; vx_a.structOrBlockName = "A";
{ {
ShaderVariable x(GL_FLOAT); ShaderVariable x(GL_FLOAT);
x.name = "x"; x.name = "x";
...@@ -168,13 +168,13 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentStructNames) ...@@ -168,13 +168,13 @@ TEST(ShaderVariableTest, IsSameUniformWithDifferentStructNames)
fx_a.fields.push_back(y); fx_a.fields.push_back(y);
} }
fx_a.structName = "B"; fx_a.structOrBlockName = "B";
EXPECT_FALSE(vx_a.isSameUniformAtLinkTime(fx_a)); EXPECT_FALSE(vx_a.isSameUniformAtLinkTime(fx_a));
fx_a.structName = "A"; fx_a.structOrBlockName = "A";
EXPECT_TRUE(vx_a.isSameUniformAtLinkTime(fx_a)); EXPECT_TRUE(vx_a.isSameUniformAtLinkTime(fx_a));
fx_a.structName = ""; fx_a.structOrBlockName = "";
EXPECT_FALSE(vx_a.isSameUniformAtLinkTime(fx_a)); EXPECT_FALSE(vx_a.isSameUniformAtLinkTime(fx_a));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment