Move some D3D-specific stuff into ProgramD3D.
BUG=angle:773
Change-Id: I48b42e7a3e82a43d3dde16a8d1016d28280eae39
Reviewed-on: https://chromium-review.googlesource.com/232968
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
index cc7ea56..2cf7119 100644
--- a/src/libANGLE/Shader.cpp
+++ b/src/libANGLE/Shader.cpp
@@ -216,4 +216,28 @@
return mShader->getActiveOutputVariables();
}
+
+int Shader::getSemanticIndex(const std::string &attributeName) const
+{
+ if (!attributeName.empty())
+ {
+ const auto &activeAttributes = mShader->getActiveAttributes();
+
+ int semanticIndex = 0;
+ for (size_t attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
+ {
+ const sh::ShaderVariable &attribute = activeAttributes[attributeIndex];
+
+ if (attribute.name == attributeName)
+ {
+ return semanticIndex;
+ }
+
+ semanticIndex += gl::VariableRegisterCount(attribute.type);
+ }
+ }
+
+ return -1;
+}
+
}