Commit 0d208976 by Olli Etuaho

Revert "D3D11: Futher optimize input layout cache."

This seems to have broken some dEQP tests in debug build, possibly uncovering a previously undetected bug. TEST=dEQP-GLES3.functional.shaders.linkage.varying.basic_types.* This reverts commit d2328a52. Change-Id: I9f082d7a6fca38b4c076fecc342ac40d5416ebef Reviewed-on: https://chromium-review.googlesource.com/284780Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent fb6ab2ce
......@@ -647,58 +647,6 @@ const FormatSet &GetAllSizedInternalFormats()
return formatSet;
}
AttributeType GetAttributeType(GLenum enumValue)
{
switch (enumValue)
{
case GL_FLOAT:
return ATTRIBUTE_FLOAT;
case GL_FLOAT_VEC2:
return ATTRIBUTE_VEC2;
case GL_FLOAT_VEC3:
return ATTRIBUTE_VEC3;
case GL_FLOAT_VEC4:
return ATTRIBUTE_VEC4;
case GL_INT:
return ATTRIBUTE_INT;
case GL_INT_VEC2:
return ATTRIBUTE_IVEC2;
case GL_INT_VEC3:
return ATTRIBUTE_IVEC3;
case GL_INT_VEC4:
return ATTRIBUTE_IVEC4;
case GL_UNSIGNED_INT:
return ATTRIBUTE_UINT;
case GL_UNSIGNED_INT_VEC2:
return ATTRIBUTE_UVEC2;
case GL_UNSIGNED_INT_VEC3:
return ATTRIBUTE_UVEC3;
case GL_UNSIGNED_INT_VEC4:
return ATTRIBUTE_UVEC4;
case GL_FLOAT_MAT2:
return ATTRIBUTE_MAT2;
case GL_FLOAT_MAT3:
return ATTRIBUTE_MAT3;
case GL_FLOAT_MAT4:
return ATTRIBUTE_MAT4;
case GL_FLOAT_MAT2x3:
return ATTRIBUTE_MAT2x3;
case GL_FLOAT_MAT2x4:
return ATTRIBUTE_MAT2x4;
case GL_FLOAT_MAT3x2:
return ATTRIBUTE_MAT3x2;
case GL_FLOAT_MAT3x4:
return ATTRIBUTE_MAT3x4;
case GL_FLOAT_MAT4x2:
return ATTRIBUTE_MAT4x2;
case GL_FLOAT_MAT4x3:
return ATTRIBUTE_MAT4x3;
default:
UNREACHABLE();
return ATTRIBUTE_FLOAT;
}
}
VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
{
switch (type)
......
......@@ -76,37 +76,6 @@ GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type);
typedef std::set<GLenum> FormatSet;
const FormatSet &GetAllSizedInternalFormats();
// From the ESSL 3.00.4 spec:
// Vertex shader inputs can only be float, floating-point vectors, matrices, signed and unsigned
// integers and integer vectors. Vertex shader inputs cannot be arrays or structures.
enum AttributeType
{
ATTRIBUTE_FLOAT,
ATTRIBUTE_VEC2,
ATTRIBUTE_VEC3,
ATTRIBUTE_VEC4,
ATTRIBUTE_INT,
ATTRIBUTE_IVEC2,
ATTRIBUTE_IVEC3,
ATTRIBUTE_IVEC4,
ATTRIBUTE_UINT,
ATTRIBUTE_UVEC2,
ATTRIBUTE_UVEC3,
ATTRIBUTE_UVEC4,
ATTRIBUTE_MAT2,
ATTRIBUTE_MAT3,
ATTRIBUTE_MAT4,
ATTRIBUTE_MAT2x3,
ATTRIBUTE_MAT2x4,
ATTRIBUTE_MAT3x2,
ATTRIBUTE_MAT3x4,
ATTRIBUTE_MAT4x2,
ATTRIBUTE_MAT4x3,
};
AttributeType GetAttributeType(GLenum enumValue);
enum VertexFormatType
{
VERTEX_FORMAT_INVALID,
......
......@@ -70,8 +70,14 @@ bool InputLayoutCache::PackedAttributeComparator::operator()(const PackedAttribu
const auto &attribA = a.attributeData[attribIndex];
const auto &attribB = b.attributeData[attribIndex];
if (attribA.pack != attribB.pack)
return attribA.pack < attribB.pack;
if (attribA.glType != attribB.glType)
return attribA.glType < attribB.glType;
if (attribA.semanticIndex != attribB.semanticIndex)
return attribA.semanticIndex < attribB.semanticIndex;
if (attribA.dxgiFormat != attribB.dxgiFormat)
return attribA.dxgiFormat < attribB.dxgiFormat;
if (attribA.divisor != attribB.divisor)
return attribA.divisor < attribB.divisor;
}
// Equal
......@@ -192,13 +198,13 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
firstInstancedElement = ilKey.elementCount;
}
ilKey.elementCount++;
nextAvailableInputSlot = i + 1;
layout.addAttributeData(ilKey.elements[ilKey.elementCount].glslElementType,
sortedSemanticIndices[i],
vertexFormatType,
vertexFormatInfo.nativeFormat,
sortedAttributes[i]->divisor);
ilKey.elementCount++;
nextAvailableInputSlot = i + 1;
}
}
......
......@@ -10,17 +10,16 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
#define LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
#include "libANGLE/Constants.h"
#include "libANGLE/Error.h"
#include "common/angleutils.h"
#include <GLES2/gl2.h>
#include <cstddef>
#include <map>
#include <unordered_map>
#include "common/angleutils.h"
#include "libANGLE/Constants.h"
#include "libANGLE/Error.h"
#include "libANGLE/formatutils.h"
namespace gl
{
class Program;
......@@ -81,38 +80,22 @@ class InputLayoutCache : angle::NonCopyable
void addAttributeData(GLenum glType,
UINT semanticIndex,
gl::VertexFormatType vertexFormatType,
DXGI_FORMAT dxgiFormat,
unsigned int divisor)
{
gl::AttributeType attribType = gl::GetAttributeType(glType);
uint8_t packedType = static_cast<uint8_t>(attribType);
uint8_t packedSemantic = static_cast<uint8_t>(semanticIndex);
uint8_t packedFormatType = static_cast<uint8_t>(vertexFormatType);
uint8_t packedDivisor = static_cast<uint8_t>(divisor);
ASSERT(static_cast<gl::AttributeType>(packedType) == attribType);
ASSERT(static_cast<UINT>(packedSemantic) == semanticIndex);
ASSERT(static_cast<gl::VertexFormatType>(packedFormatType) == vertexFormatType);
ASSERT(static_cast<unsigned int>(packedDivisor) == divisor);
attributeData[numAttributes].values.attribType = packedType;
attributeData[numAttributes].values.semanticIndex = packedSemantic;
attributeData[numAttributes].values.vertexFormatType = packedFormatType;
attributeData[numAttributes].values.divisor = packedDivisor;
attributeData[numAttributes].glType = glType;
attributeData[numAttributes].semanticIndex = semanticIndex;
attributeData[numAttributes].dxgiFormat = dxgiFormat;
attributeData[numAttributes].divisor = divisor;
++numAttributes;
}
union PackedAttribute
struct PackedAttribute
{
struct
{
uint8_t attribType;
uint8_t semanticIndex;
uint8_t vertexFormatType;
uint8_t divisor;
} values;
uint32_t pack;
GLenum glType;
UINT semanticIndex;
DXGI_FORMAT dxgiFormat;
unsigned int divisor;
};
enum Flags
......
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