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() ...@@ -647,58 +647,6 @@ const FormatSet &GetAllSizedInternalFormats()
return formatSet; 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) VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
{ {
switch (type) switch (type)
......
...@@ -76,37 +76,6 @@ GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type); ...@@ -76,37 +76,6 @@ GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type);
typedef std::set<GLenum> FormatSet; typedef std::set<GLenum> FormatSet;
const FormatSet &GetAllSizedInternalFormats(); 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 enum VertexFormatType
{ {
VERTEX_FORMAT_INVALID, VERTEX_FORMAT_INVALID,
......
...@@ -70,8 +70,14 @@ bool InputLayoutCache::PackedAttributeComparator::operator()(const PackedAttribu ...@@ -70,8 +70,14 @@ bool InputLayoutCache::PackedAttributeComparator::operator()(const PackedAttribu
const auto &attribA = a.attributeData[attribIndex]; const auto &attribA = a.attributeData[attribIndex];
const auto &attribB = b.attributeData[attribIndex]; const auto &attribB = b.attributeData[attribIndex];
if (attribA.pack != attribB.pack) if (attribA.glType != attribB.glType)
return attribA.pack < attribB.pack; 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 // Equal
...@@ -192,13 +198,13 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri ...@@ -192,13 +198,13 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
firstInstancedElement = ilKey.elementCount; firstInstancedElement = ilKey.elementCount;
} }
ilKey.elementCount++;
nextAvailableInputSlot = i + 1;
layout.addAttributeData(ilKey.elements[ilKey.elementCount].glslElementType, layout.addAttributeData(ilKey.elements[ilKey.elementCount].glslElementType,
sortedSemanticIndices[i], sortedSemanticIndices[i],
vertexFormatType, vertexFormatInfo.nativeFormat,
sortedAttributes[i]->divisor); sortedAttributes[i]->divisor);
ilKey.elementCount++;
nextAvailableInputSlot = i + 1;
} }
} }
......
...@@ -10,17 +10,16 @@ ...@@ -10,17 +10,16 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_ #ifndef LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
#define 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 <GLES2/gl2.h>
#include <cstddef> #include <cstddef>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include "common/angleutils.h"
#include "libANGLE/Constants.h"
#include "libANGLE/Error.h"
#include "libANGLE/formatutils.h"
namespace gl namespace gl
{ {
class Program; class Program;
...@@ -81,38 +80,22 @@ class InputLayoutCache : angle::NonCopyable ...@@ -81,38 +80,22 @@ class InputLayoutCache : angle::NonCopyable
void addAttributeData(GLenum glType, void addAttributeData(GLenum glType,
UINT semanticIndex, UINT semanticIndex,
gl::VertexFormatType vertexFormatType, DXGI_FORMAT dxgiFormat,
unsigned int divisor) unsigned int divisor)
{ {
gl::AttributeType attribType = gl::GetAttributeType(glType); attributeData[numAttributes].glType = glType;
attributeData[numAttributes].semanticIndex = semanticIndex;
uint8_t packedType = static_cast<uint8_t>(attribType); attributeData[numAttributes].dxgiFormat = dxgiFormat;
uint8_t packedSemantic = static_cast<uint8_t>(semanticIndex); attributeData[numAttributes].divisor = divisor;
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;
++numAttributes; ++numAttributes;
} }
union PackedAttribute struct PackedAttribute
{ {
struct GLenum glType;
{ UINT semanticIndex;
uint8_t attribType; DXGI_FORMAT dxgiFormat;
uint8_t semanticIndex; unsigned int divisor;
uint8_t vertexFormatType;
uint8_t divisor;
} values;
uint32_t pack;
}; };
enum Flags 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