Commit 00c782e8 by Jamie Madill

Revert "D3D11: Fix draw perf regression with input layouts."

size_t comparison warning in Win32. src\libangle\renderer\d3d\programd3d.cpp(2084) : warning C4018: '<' : signed/unsigned mismatch BUG=510151 This reverts commit bf3f780c. Change-Id: I5565b697ca29270375049f3e855437fa19157de9 Reviewed-on: https://chromium-review.googlesource.com/292331Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent bf3f780c
...@@ -59,9 +59,12 @@ GLenum GetTextureType(GLenum samplerType) ...@@ -59,9 +59,12 @@ GLenum GetTextureType(GLenum samplerType)
gl::InputLayout GetDefaultInputLayoutFromShader(const gl::Shader *vertexShader) gl::InputLayout GetDefaultInputLayoutFromShader(const gl::Shader *vertexShader)
{ {
gl::InputLayout defaultLayout; gl::InputLayout defaultLayout(gl::MAX_VERTEX_ATTRIBS, gl::VERTEX_FORMAT_INVALID);
for (const sh::Attribute &shaderAttr : vertexShader->getActiveAttributes()) const auto &shaderAttributes = vertexShader->getActiveAttributes();
size_t layoutIndex = 0;
for (size_t attribIndex = 0; attribIndex < shaderAttributes.size(); ++attribIndex)
{ {
const sh::Attribute &shaderAttr = shaderAttributes[attribIndex];
if (shaderAttr.type != GL_NONE) if (shaderAttr.type != GL_NONE)
{ {
GLenum transposedType = gl::TransposeMatrixType(shaderAttr.type); GLenum transposedType = gl::TransposeMatrixType(shaderAttr.type);
...@@ -76,7 +79,7 @@ gl::InputLayout GetDefaultInputLayoutFromShader(const gl::Shader *vertexShader) ...@@ -76,7 +79,7 @@ gl::InputLayout GetDefaultInputLayoutFromShader(const gl::Shader *vertexShader)
gl::VertexFormatType defaultType = gl::GetVertexFormatType( gl::VertexFormatType defaultType = gl::GetVertexFormatType(
componentType, GL_FALSE, components, pureInt); componentType, GL_FALSE, components, pureInt);
defaultLayout.push_back(defaultType); defaultLayout[layoutIndex++] = defaultType;
} }
} }
} }
...@@ -147,36 +150,23 @@ void ProgramD3D::VertexExecutable::getSignature(RendererD3D *renderer, ...@@ -147,36 +150,23 @@ void ProgramD3D::VertexExecutable::getSignature(RendererD3D *renderer,
const gl::InputLayout &inputLayout, const gl::InputLayout &inputLayout,
Signature *signatureOut) Signature *signatureOut)
{ {
signatureOut->resize(inputLayout.size()); signatureOut->assign(inputLayout.size(), false);
for (size_t index = 0; index < inputLayout.size(); ++index) for (size_t index = 0; index < inputLayout.size(); ++index)
{ {
gl::VertexFormatType vertexFormatType = inputLayout[index]; gl::VertexFormatType vertexFormatType = inputLayout[index];
bool converted = false;
if (vertexFormatType != gl::VERTEX_FORMAT_INVALID) if (vertexFormatType != gl::VERTEX_FORMAT_INVALID)
{ {
VertexConversionType conversionType = VertexConversionType conversionType =
renderer->getVertexConversionType(vertexFormatType); renderer->getVertexConversionType(vertexFormatType);
converted = ((conversionType & VERTEX_CONVERT_GPU) != 0); (*signatureOut)[index] = ((conversionType & VERTEX_CONVERT_GPU) != 0);
} }
(*signatureOut)[index] = converted;
} }
} }
bool ProgramD3D::VertexExecutable::matchesSignature(const Signature &signature) const bool ProgramD3D::VertexExecutable::matchesSignature(const Signature &signature) const
{ {
size_t limit = std::max(mSignature.size(), signature.size()); return mSignature == signature;
for (size_t index = 0; index < limit; ++index)
{
// treat undefined indexes as 'not converted'
bool a = index < signature.size() ? signature[index] : false;
bool b = index < mSignature.size() ? mSignature[index] : false;
if (a != b)
return false;
}
return true;
} }
ProgramD3D::PixelExecutable::PixelExecutable(const std::vector<GLenum> &outputSignature, ProgramD3D::PixelExecutable::PixelExecutable(const std::vector<GLenum> &outputSignature,
...@@ -2070,7 +2060,7 @@ void ProgramD3D::sortAttributesByLayout(const std::vector<TranslatedAttribute> & ...@@ -2070,7 +2060,7 @@ void ProgramD3D::sortAttributesByLayout(const std::vector<TranslatedAttribute> &
void ProgramD3D::updateCachedInputLayout(const gl::Program *program, const gl::State &state) void ProgramD3D::updateCachedInputLayout(const gl::Program *program, const gl::State &state)
{ {
mCachedInputLayout.clear(); mCachedInputLayout.assign(gl::MAX_VERTEX_ATTRIBS, gl::VERTEX_FORMAT_INVALID);
const int *semanticIndexes = program->getSemanticIndexes(); const int *semanticIndexes = program->getSemanticIndexes();
const auto &vertexAttributes = state.getVertexArray()->getVertexAttributes(); const auto &vertexAttributes = state.getVertexArray()->getVertexAttributes();
...@@ -2081,10 +2071,6 @@ void ProgramD3D::updateCachedInputLayout(const gl::Program *program, const gl::S ...@@ -2081,10 +2071,6 @@ void ProgramD3D::updateCachedInputLayout(const gl::Program *program, const gl::S
if (semanticIndex != -1) if (semanticIndex != -1)
{ {
if (mCachedInputLayout.size() < semanticIndex + 1)
{
mCachedInputLayout.resize(semanticIndex + 1, gl::VERTEX_FORMAT_INVALID);
}
mCachedInputLayout[semanticIndex] = mCachedInputLayout[semanticIndex] =
GetVertexFormatType(vertexAttributes[attributeIndex], GetVertexFormatType(vertexAttributes[attributeIndex],
state.getVertexAttribCurrentValue(attributeIndex).Type); state.getVertexAttribCurrentValue(attributeIndex).Type);
......
...@@ -31,16 +31,17 @@ gl::InputLayout GetInputLayout( ...@@ -31,16 +31,17 @@ gl::InputLayout GetInputLayout(
const TranslatedAttribute *translatedAttributes[gl::MAX_VERTEX_ATTRIBS], const TranslatedAttribute *translatedAttributes[gl::MAX_VERTEX_ATTRIBS],
size_t attributeCount) size_t attributeCount)
{ {
gl::InputLayout inputLayout(attributeCount, gl::VERTEX_FORMAT_INVALID); gl::InputLayout inputLayout(gl::MAX_VERTEX_ATTRIBS, gl::VERTEX_FORMAT_INVALID);
for (size_t attributeIndex = 0; attributeIndex < attributeCount; ++attributeIndex) for (size_t attributeIndex = 0; attributeIndex < attributeCount; ++attributeIndex)
{ {
const TranslatedAttribute *translatedAttribute = translatedAttributes[attributeIndex]; const TranslatedAttribute *translatedAttribute = translatedAttributes[attributeIndex];
if (translatedAttribute->active) if (translatedAttribute->active)
{ {
inputLayout[attributeIndex] = gl::GetVertexFormatType( gl::VertexFormatType vertexFormatType =
*translatedAttribute->attribute, translatedAttribute->currentValueType); gl::GetVertexFormatType(*translatedAttribute->attribute,
translatedAttribute->currentValueType);
inputLayout[attributeIndex] = vertexFormatType;
} }
} }
return inputLayout; return inputLayout;
......
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