Commit d633b156 by Frank Henigman Committed by Commit Bot

Get rid of VertexFormatType.

The enum VertexFormatType is redundant with angle::FormatID. The Vulkan back end has already eschewed VertexFormatType, this change updates the D3D back ends. BUG=angleproject:2531 Change-Id: I67ea2203ca80be828f4c757a37810fe67a279364 Reviewed-on: https://chromium-review.googlesource.com/c/1263899Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
parent 6eba3c61
......@@ -207,102 +207,7 @@ enum AttributeType
AttributeType GetAttributeType(GLenum enumValue);
enum VertexFormatType
{
VERTEX_FORMAT_INVALID,
VERTEX_FORMAT_SBYTE1,
VERTEX_FORMAT_SBYTE1_NORM,
VERTEX_FORMAT_SBYTE2,
VERTEX_FORMAT_SBYTE2_NORM,
VERTEX_FORMAT_SBYTE3,
VERTEX_FORMAT_SBYTE3_NORM,
VERTEX_FORMAT_SBYTE4,
VERTEX_FORMAT_SBYTE4_NORM,
VERTEX_FORMAT_UBYTE1,
VERTEX_FORMAT_UBYTE1_NORM,
VERTEX_FORMAT_UBYTE2,
VERTEX_FORMAT_UBYTE2_NORM,
VERTEX_FORMAT_UBYTE3,
VERTEX_FORMAT_UBYTE3_NORM,
VERTEX_FORMAT_UBYTE4,
VERTEX_FORMAT_UBYTE4_NORM,
VERTEX_FORMAT_SSHORT1,
VERTEX_FORMAT_SSHORT1_NORM,
VERTEX_FORMAT_SSHORT2,
VERTEX_FORMAT_SSHORT2_NORM,
VERTEX_FORMAT_SSHORT3,
VERTEX_FORMAT_SSHORT3_NORM,
VERTEX_FORMAT_SSHORT4,
VERTEX_FORMAT_SSHORT4_NORM,
VERTEX_FORMAT_USHORT1,
VERTEX_FORMAT_USHORT1_NORM,
VERTEX_FORMAT_USHORT2,
VERTEX_FORMAT_USHORT2_NORM,
VERTEX_FORMAT_USHORT3,
VERTEX_FORMAT_USHORT3_NORM,
VERTEX_FORMAT_USHORT4,
VERTEX_FORMAT_USHORT4_NORM,
VERTEX_FORMAT_SINT1,
VERTEX_FORMAT_SINT1_NORM,
VERTEX_FORMAT_SINT2,
VERTEX_FORMAT_SINT2_NORM,
VERTEX_FORMAT_SINT3,
VERTEX_FORMAT_SINT3_NORM,
VERTEX_FORMAT_SINT4,
VERTEX_FORMAT_SINT4_NORM,
VERTEX_FORMAT_UINT1,
VERTEX_FORMAT_UINT1_NORM,
VERTEX_FORMAT_UINT2,
VERTEX_FORMAT_UINT2_NORM,
VERTEX_FORMAT_UINT3,
VERTEX_FORMAT_UINT3_NORM,
VERTEX_FORMAT_UINT4,
VERTEX_FORMAT_UINT4_NORM,
VERTEX_FORMAT_SBYTE1_INT,
VERTEX_FORMAT_SBYTE2_INT,
VERTEX_FORMAT_SBYTE3_INT,
VERTEX_FORMAT_SBYTE4_INT,
VERTEX_FORMAT_UBYTE1_INT,
VERTEX_FORMAT_UBYTE2_INT,
VERTEX_FORMAT_UBYTE3_INT,
VERTEX_FORMAT_UBYTE4_INT,
VERTEX_FORMAT_SSHORT1_INT,
VERTEX_FORMAT_SSHORT2_INT,
VERTEX_FORMAT_SSHORT3_INT,
VERTEX_FORMAT_SSHORT4_INT,
VERTEX_FORMAT_USHORT1_INT,
VERTEX_FORMAT_USHORT2_INT,
VERTEX_FORMAT_USHORT3_INT,
VERTEX_FORMAT_USHORT4_INT,
VERTEX_FORMAT_SINT1_INT,
VERTEX_FORMAT_SINT2_INT,
VERTEX_FORMAT_SINT3_INT,
VERTEX_FORMAT_SINT4_INT,
VERTEX_FORMAT_UINT1_INT,
VERTEX_FORMAT_UINT2_INT,
VERTEX_FORMAT_UINT3_INT,
VERTEX_FORMAT_UINT4_INT,
VERTEX_FORMAT_FIXED1,
VERTEX_FORMAT_FIXED2,
VERTEX_FORMAT_FIXED3,
VERTEX_FORMAT_FIXED4,
VERTEX_FORMAT_HALF1,
VERTEX_FORMAT_HALF2,
VERTEX_FORMAT_HALF3,
VERTEX_FORMAT_HALF4,
VERTEX_FORMAT_FLOAT1,
VERTEX_FORMAT_FLOAT2,
VERTEX_FORMAT_FLOAT3,
VERTEX_FORMAT_FLOAT4,
VERTEX_FORMAT_SINT210,
VERTEX_FORMAT_UINT210,
VERTEX_FORMAT_SINT210_NORM,
VERTEX_FORMAT_UINT210_NORM,
VERTEX_FORMAT_SINT210_INT,
VERTEX_FORMAT_UINT210_INT,
};
typedef std::vector<VertexFormatType> InputLayout;
typedef std::vector<angle::FormatID> InputLayout;
struct VertexFormat : private angle::NonCopyable
{
......@@ -319,14 +224,9 @@ angle::FormatID GetVertexFormatID(GLenum type,
GLuint components,
bool pureInteger);
angle::FormatID GetVertexFormatID(const VertexAttribute &attrib);
VertexFormatType GetVertexFormatType(GLenum type,
GLboolean normalized,
GLuint components,
bool pureInteger);
VertexFormatType GetVertexFormatType(const VertexAttribute &attrib);
VertexFormatType GetVertexFormatType(const VertexAttribute &attrib, GLenum currentValueType);
const VertexFormat &GetVertexFormatFromType(VertexFormatType vertexFormatType);
size_t GetVertexFormatTypeSize(VertexFormatType vertexFormatType);
angle::FormatID GetVertexFormatID(const VertexAttribute &attrib, GLenum currentValueType);
const VertexFormat &GetVertexFormatFromID(angle::FormatID vertexFormatID);
size_t GetVertexFormatSize(angle::FormatID vertexFormatID);
// Check if an internal format is ever valid in ES3. Makes no checks about support for a specific
// context.
......
......@@ -204,8 +204,8 @@ std::string DynamicHLSL::generateVertexShaderForInputLayout(
if (!shaderAttribute.name.empty())
{
ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
VertexFormatType vertexFormatType =
inputIndex < inputLayout.size() ? inputLayout[inputIndex] : VERTEX_FORMAT_INVALID;
angle::FormatID vertexFormatID =
inputIndex < inputLayout.size() ? inputLayout[inputIndex] : angle::FormatID::NONE;
// HLSL code for input structure
if (IsMatrixType(shaderAttribute.type))
......@@ -216,7 +216,7 @@ std::string DynamicHLSL::generateVertexShaderForInputLayout(
}
else
{
GLenum componentType = mRenderer->getVertexComponentType(vertexFormatType);
GLenum componentType = mRenderer->getVertexComponentType(vertexFormatID);
if (shaderAttribute.name == "gl_InstanceID" ||
shaderAttribute.name == "gl_VertexID")
......@@ -258,9 +258,9 @@ std::string DynamicHLSL::generateVertexShaderForInputLayout(
// data reinterpretation (eg for pure integer->float, float->pure integer)
// TODO: issue warning with gl debug info extension, when supported
if (IsMatrixType(shaderAttribute.type) ||
(mRenderer->getVertexConversionType(vertexFormatType) & VERTEX_CONVERT_GPU) != 0)
(mRenderer->getVertexConversionType(vertexFormatID) & VERTEX_CONVERT_GPU) != 0)
{
GenerateAttributeConversionHLSL(vertexFormatType, shaderAttribute, initStream);
GenerateAttributeConversionHLSL(vertexFormatID, shaderAttribute, initStream);
}
else
{
......@@ -1150,7 +1150,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
}
// static
void DynamicHLSL::GenerateAttributeConversionHLSL(gl::VertexFormatType vertexFormatType,
void DynamicHLSL::GenerateAttributeConversionHLSL(angle::FormatID vertexFormatID,
const sh::ShaderVariable &shaderAttrib,
std::ostringstream &outStream)
{
......@@ -1163,7 +1163,7 @@ void DynamicHLSL::GenerateAttributeConversionHLSL(gl::VertexFormatType vertexFor
GLenum shaderComponentType = VariableComponentType(shaderAttrib.type);
int shaderComponentCount = VariableComponentCount(shaderAttrib.type);
const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromType(vertexFormatType);
const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromID(vertexFormatID);
// Perform integer to float conversion (if necessary)
if (shaderComponentType == GL_FLOAT && vertexFormat.type != GL_FLOAT)
......
......@@ -162,7 +162,7 @@ class DynamicHLSL : angle::NonCopyable
bool programUsesPointSize,
std::ostringstream &hlslStream) const;
static void GenerateAttributeConversionHLSL(gl::VertexFormatType vertexFormatType,
static void GenerateAttributeConversionHLSL(angle::FormatID vertexFormatID,
const sh::ShaderVariable &shaderAttrib,
std::ostringstream &outStream);
};
......
......@@ -53,10 +53,10 @@ void GetDefaultInputLayoutFromShader(gl::Shader *vertexShader, gl::InputLayout *
GLenum componentType = gl::VariableComponentType(transposedType);
GLuint components = static_cast<GLuint>(gl::VariableColumnCount(transposedType));
bool pureInt = (componentType != GL_FLOAT);
gl::VertexFormatType defaultType =
gl::GetVertexFormatType(componentType, GL_FALSE, components, pureInt);
angle::FormatID defaultID =
gl::GetVertexFormatID(componentType, GL_FALSE, components, pureInt);
inputLayoutOut->push_back(defaultType);
inputLayoutOut->push_back(defaultID);
}
}
}
......@@ -502,15 +502,15 @@ void ProgramD3D::VertexExecutable::getSignature(RendererD3D *renderer,
for (size_t index = 0; index < inputLayout.size(); ++index)
{
gl::VertexFormatType vertexFormatType = inputLayout[index];
if (vertexFormatType == gl::VERTEX_FORMAT_INVALID)
angle::FormatID vertexFormatID = inputLayout[index];
if (vertexFormatID == angle::FormatID::NONE)
continue;
VertexConversionType conversionType = renderer->getVertexConversionType(vertexFormatType);
VertexConversionType conversionType = renderer->getVertexConversionType(vertexFormatID);
if ((conversionType & VERTEX_CONVERT_GPU) == 0)
continue;
GLenum componentType = renderer->getVertexComponentType(vertexFormatType);
GLenum componentType = renderer->getVertexComponentType(vertexFormatID);
(*signatureOut)[index] = GetAttribType(componentType);
}
}
......@@ -928,11 +928,11 @@ angle::Result ProgramD3D::load(const gl::Context *context,
vertexShaderIndex++)
{
size_t inputLayoutSize = stream->readInt<size_t>();
gl::InputLayout inputLayout(inputLayoutSize, gl::VERTEX_FORMAT_INVALID);
gl::InputLayout inputLayout(inputLayoutSize, angle::FormatID::NONE);
for (size_t inputIndex = 0; inputIndex < inputLayoutSize; inputIndex++)
{
inputLayout[inputIndex] = stream->readInt<gl::VertexFormatType>();
inputLayout[inputIndex] = stream->readInt<angle::FormatID>();
}
unsigned int vertexShaderSize = stream->readInt<unsigned int>();
......@@ -2729,11 +2729,11 @@ void ProgramD3D::updateCachedInputLayout(Serial associatedSerial, const gl::Stat
{
if (mCachedInputLayout.size() < static_cast<size_t>(d3dSemantic + 1))
{
mCachedInputLayout.resize(d3dSemantic + 1, gl::VERTEX_FORMAT_INVALID);
mCachedInputLayout.resize(d3dSemantic + 1, angle::FormatID::NONE);
}
mCachedInputLayout[d3dSemantic] =
GetVertexFormatType(vertexAttributes[locationIndex],
state.getVertexAttribCurrentValue(locationIndex).Type);
GetVertexFormatID(vertexAttributes[locationIndex],
state.getVertexAttribCurrentValue(locationIndex).Type);
}
}
......
......@@ -127,9 +127,8 @@ class BufferFactoryD3D : angle::NonCopyable
virtual IndexBuffer *createIndexBuffer() = 0;
// TODO(jmadill): add VertexFormatCaps
virtual VertexConversionType getVertexConversionType(
gl::VertexFormatType vertexFormatType) const = 0;
virtual GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const = 0;
virtual VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const = 0;
virtual GLenum getVertexComponentType(angle::FormatID vertexFormatID) const = 0;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
......
......@@ -86,10 +86,10 @@ bool DirectStoragePossible(const gl::Context *context,
// TODO(jmadill): add VertexFormatCaps
BufferFactoryD3D *factory = bufferD3D->getFactory();
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib);
angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib);
// CPU-converted vertex data must be converted (naturally).
if ((factory->getVertexConversionType(vertexFormatType) & VERTEX_CONVERT_CPU) != 0)
if ((factory->getVertexConversionType(vertexFormatID) & VERTEX_CONVERT_CPU) != 0)
{
return false;
}
......
......@@ -73,7 +73,7 @@ PackedAttributeLayout::PackedAttributeLayout(const PackedAttributeLayout &other)
void PackedAttributeLayout::addAttributeData(GLenum glType,
UINT semanticIndex,
gl::VertexFormatType vertexFormatType,
angle::FormatID vertexFormatID,
unsigned int divisor)
{
gl::AttributeType attribType = gl::GetAttributeType(glType);
......@@ -81,13 +81,13 @@ void PackedAttributeLayout::addAttributeData(GLenum glType,
PackedAttribute packedAttrib;
packedAttrib.attribType = static_cast<uint8_t>(attribType);
packedAttrib.semanticIndex = static_cast<uint8_t>(semanticIndex);
packedAttrib.vertexFormatType = static_cast<uint8_t>(vertexFormatType);
packedAttrib.vertexFormatType = static_cast<uint8_t>(vertexFormatID);
packedAttrib.dummyPadding = 0u;
packedAttrib.divisor = static_cast<uint32_t>(divisor);
ASSERT(static_cast<gl::AttributeType>(packedAttrib.attribType) == attribType);
ASSERT(static_cast<UINT>(packedAttrib.semanticIndex) == semanticIndex);
ASSERT(static_cast<gl::VertexFormatType>(packedAttrib.vertexFormatType) == vertexFormatType);
ASSERT(static_cast<angle::FormatID>(packedAttrib.vertexFormatType) == vertexFormatID);
ASSERT(static_cast<unsigned int>(packedAttrib.divisor) == divisor);
static_assert(sizeof(uint64_t) == sizeof(PackedAttribute),
......@@ -165,9 +165,9 @@ angle::Result InputLayoutCache::getInputLayout(
const auto &currentValue =
state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex));
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValue.Type);
angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValue.Type);
layout.addAttributeData(glslElementType, d3dSemantic, vertexFormatType,
layout.addAttributeData(glslElementType, d3dSemantic, vertexFormatID,
binding.getDivisor() * divisorMultiplier);
}
......@@ -220,9 +220,9 @@ angle::Result InputLayoutCache::createInputLayout(
D3D11_INPUT_CLASSIFICATION inputClass =
attrib.divisor > 0 ? D3D11_INPUT_PER_INSTANCE_DATA : D3D11_INPUT_PER_VERTEX_DATA;
const auto &vertexFormatType =
gl::GetVertexFormatType(*attrib.attribute, attrib.currentValueType);
const auto &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
angle::FormatID vertexFormatID =
gl::GetVertexFormatID(*attrib.attribute, attrib.currentValueType);
const auto &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatID, featureLevel);
auto *inputElement = &inputElements[inputElementCount];
......
......@@ -34,7 +34,7 @@ struct PackedAttributeLayout
void addAttributeData(GLenum glType,
UINT semanticIndex,
gl::VertexFormatType vertexFormatType,
angle::FormatID vertexFormatID,
unsigned int divisor);
bool operator==(const PackedAttributeLayout &other) const;
......
......@@ -3595,17 +3595,16 @@ bool Renderer11::getLUID(LUID *adapterLuid) const
return true;
}
VertexConversionType Renderer11::getVertexConversionType(
gl::VertexFormatType vertexFormatType) const
VertexConversionType Renderer11::getVertexConversionType(angle::FormatID vertexFormatID) const
{
return d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel)
return d3d11::GetVertexFormatInfo(vertexFormatID, mRenderer11DeviceCaps.featureLevel)
.conversionType;
}
GLenum Renderer11::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
GLenum Renderer11::getVertexComponentType(angle::FormatID vertexFormatID) const
{
const auto &format =
d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel);
d3d11::GetVertexFormatInfo(vertexFormatID, mRenderer11DeviceCaps.featureLevel);
return d3d11::GetComponentType(format.nativeFormat);
}
......@@ -3637,10 +3636,10 @@ angle::Result Renderer11::getVertexSpaceRequired(const gl::Context *context,
ASSERT(elementCount > 0);
gl::VertexFormatType formatType = gl::GetVertexFormatType(attrib);
angle::FormatID formatID = gl::GetVertexFormatID(attrib);
const D3D_FEATURE_LEVEL featureLevel = mRenderer11DeviceCaps.featureLevel;
const d3d11::VertexFormat &vertexFormatInfo =
d3d11::GetVertexFormatInfo(formatType, featureLevel);
d3d11::GetVertexFormatInfo(formatID, featureLevel);
const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(vertexFormatInfo.nativeFormat);
unsigned int elementSize = dxgiFormatInfo.pixelBytes;
......
......@@ -355,9 +355,8 @@ class Renderer11 : public RendererD3D
uint8_t *pixelsOut);
bool getLUID(LUID *adapterLuid) const override;
VertexConversionType getVertexConversionType(
gl::VertexFormatType vertexFormatType) const override;
GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const override;
VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const override;
GLenum getVertexComponentType(angle::FormatID vertexFormatID) const override;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
......
......@@ -122,10 +122,10 @@ angle::Result VertexBuffer11::storeVertexAttributes(const gl::Context *context,
input += inputStride * start;
}
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValueType);
const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
const d3d11::VertexFormat &vertexFormatInfo =
d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
d3d11::GetVertexFormatInfo(vertexFormatID, featureLevel);
ASSERT(vertexFormatInfo.copyFunction != nullptr);
vertexFormatInfo.copyFunction(input, inputStride, count, output);
......
......@@ -54,7 +54,7 @@ struct VertexFormat : private angle::NonCopyable
VertexCopyFunction copyFunction;
};
const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType,
const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID,
D3D_FEATURE_LEVEL featureLevel);
// Auto-generated in dxgi_format_map_autogen.cpp.
......
......@@ -2895,14 +2895,14 @@ bool Renderer9::getLUID(LUID *adapterLuid) const
return false;
}
VertexConversionType Renderer9::getVertexConversionType(gl::VertexFormatType vertexFormatType) const
VertexConversionType Renderer9::getVertexConversionType(angle::FormatID vertexFormatID) const
{
return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType).conversionType;
return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID).conversionType;
}
GLenum Renderer9::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
GLenum Renderer9::getVertexComponentType(angle::FormatID vertexFormatID) const
{
return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType).componentType;
return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID).componentType;
}
angle::Result Renderer9::getVertexSpaceRequired(const gl::Context *context,
......@@ -2918,9 +2918,9 @@ angle::Result Renderer9::getVertexSpaceRequired(const gl::Context *context,
return angle::Result::Continue();
}
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, GL_FLOAT);
angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, GL_FLOAT);
const d3d9::VertexFormat &d3d9VertexInfo =
d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType);
d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID);
unsigned int elementCount = 0;
const unsigned int divisor = binding.getDivisor();
......
......@@ -356,9 +356,8 @@ class Renderer9 : public RendererD3D
D3DPOOL getTexturePool(DWORD usage) const;
bool getLUID(LUID *adapterLuid) const override;
VertexConversionType getVertexConversionType(
gl::VertexFormatType vertexFormatType) const override;
GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const override;
VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const override;
GLenum getVertexComponentType(angle::FormatID vertexFormatID) const override;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
......
......@@ -90,8 +90,9 @@ angle::Result VertexBuffer9::storeVertexAttributes(const gl::Context *context,
input += inputStride * start;
}
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
const d3d9::VertexFormat &d3dVertexInfo = d3d9::GetVertexFormatInfo(mRenderer->getCapsDeclTypes(), vertexFormatType);
angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValueType);
const d3d9::VertexFormat &d3dVertexInfo =
d3d9::GetVertexFormatInfo(mRenderer->getCapsDeclTypes(), vertexFormatID);
bool needsConversion = (d3dVertexInfo.conversionType & VERTEX_CONVERT_CPU) > 0;
if (!needsConversion && inputStride == elementSize)
......
......@@ -168,9 +168,10 @@ angle::Result VertexDeclarationCache::applyDeclaration(
mAppliedVBs[stream].offset = offset;
}
gl::VertexFormatType vertexformatType =
gl::GetVertexFormatType(*attributes[i].attribute, GL_FLOAT);
const d3d9::VertexFormat &d3d9VertexInfo = d3d9::GetVertexFormatInfo(caps.DeclTypes, vertexformatType);
angle::FormatID vertexformatID =
gl::GetVertexFormatID(*attributes[i].attribute, GL_FLOAT);
const d3d9::VertexFormat &d3d9VertexInfo =
d3d9::GetVertexFormatInfo(caps.DeclTypes, vertexformatID);
element->Stream = static_cast<WORD>(stream);
element->Offset = 0;
......
......@@ -872,8 +872,7 @@ static inline unsigned int ComputeTypeIndex(GLenum type)
}
}
const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes,
gl::VertexFormatType vertexFormatType)
const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, angle::FormatID vertexFormatID)
{
static bool initialized = false;
static DWORD initializedDeclTypes = 0;
......@@ -908,7 +907,7 @@ const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes,
initializedDeclTypes = supportedDeclTypes;
}
const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromType(vertexFormatType);
const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromID(vertexFormatID);
// Pure integer attributes only supported in ES3.0
ASSERT(!vertexFormat.pureInteger);
......
......@@ -73,8 +73,7 @@ struct VertexFormat
D3DDECLTYPE nativeFormat;
GLenum componentType;
};
const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes,
gl::VertexFormatType vertexFormatType);
const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, angle::FormatID vertexFormatID);
struct TextureFormat
{
......
......@@ -995,8 +995,8 @@ bool ValidateWebGLVertexAttribPointer(Context *context,
// The offset arguments to drawElements and vertexAttribPointer, and the stride argument to
// vertexAttribPointer, must be a multiple of the size of the data type passed to the call,
// or an INVALID_OPERATION error is generated.
VertexFormatType internalType = GetVertexFormatType(type, normalized, 1, pureInteger);
size_t typeSize = GetVertexFormatTypeSize(internalType);
angle::FormatID internalType = GetVertexFormatID(type, normalized, 1, pureInteger);
size_t typeSize = GetVertexFormatSize(internalType);
ASSERT(isPow2(typeSize) && typeSize > 0);
size_t sizeMask = (typeSize - 1);
......
......@@ -54,8 +54,8 @@ class MockBufferFactoryD3D : public rx::BufferFactoryD3D
}
MOCK_METHOD0(createVertexBuffer, rx::VertexBuffer *());
MOCK_CONST_METHOD1(getVertexConversionType, rx::VertexConversionType(gl::VertexFormatType));
MOCK_CONST_METHOD1(getVertexComponentType, GLenum(gl::VertexFormatType));
MOCK_CONST_METHOD1(getVertexConversionType, rx::VertexConversionType(angle::FormatID));
MOCK_CONST_METHOD1(getVertexComponentType, GLenum(angle::FormatID));
MOCK_CONST_METHOD6(getVertexSpaceRequired,
angle::Result(const gl::Context *,
const gl::VertexAttribute &,
......
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