Stop generating duplicate vertex binaries.
We would generate multiple vertex binaries that result in the same
HLSL code, eg for vec2 and vec3 vertex attributes. Eliminate
duplicates by using the converted attribute type for testing
for matching binaries.
BUG=angle:599
Change-Id: I061588164577ff9fa69ebb7d8a3f2bf6bb6fe013
Reviewed-on: https://chromium-review.googlesource.com/197830
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/DynamicHLSL.cpp b/src/libGLESv2/DynamicHLSL.cpp
index 193fca5..dd5e2e0 100644
--- a/src/libGLESv2/DynamicHLSL.cpp
+++ b/src/libGLESv2/DynamicHLSL.cpp
@@ -1027,21 +1027,36 @@
GLenum shaderComponentType = UniformComponentType(shaderAttrib.type);
int shaderComponentCount = UniformComponentCount(shaderAttrib.type);
- std::string padString = "";
-
// Perform integer to float conversion (if necessary)
bool requiresTypeConversion = (shaderComponentType == GL_FLOAT && vertexFormat.mType != GL_FLOAT);
- // TODO: normalization for 32-bit integer formats
- ASSERT(!requiresTypeConversion || !vertexFormat.mNormalized);
-
- if (requiresTypeConversion || !padString.empty())
+ if (requiresTypeConversion)
{
- return "float" + Str(shaderComponentCount) + "(" + attribString + padString + ")";
+ // TODO: normalization for 32-bit integer formats
+ ASSERT(!vertexFormat.mNormalized && !vertexFormat.mPureInteger);
+ return "float" + Str(shaderComponentCount) + "(" + attribString + ")";
}
// No conversion necessary
return attribString;
}
+void DynamicHLSL::getInputLayoutSignature(const VertexFormat inputLayout[], GLenum signature[]) const
+{
+ for (size_t inputIndex = 0; inputIndex < MAX_VERTEX_ATTRIBS; inputIndex++)
+ {
+ const VertexFormat &vertexFormat = inputLayout[inputIndex];
+
+ if (vertexFormat.mType == GL_NONE)
+ {
+ signature[inputIndex] = GL_NONE;
+ }
+ else
+ {
+ bool gpuConverted = ((mRenderer->getVertexConversionType(vertexFormat) & rx::VERTEX_CONVERT_GPU) != 0);
+ signature[inputIndex] = (gpuConverted ? GL_TRUE : GL_FALSE);
+ }
+ }
+}
+
}