Commit d3e213bc by Jamie Madill Committed by Commit Bot

Add a gl::AttribArray helper type.

This is a generic std::array sized to gl::MAX_VERTEX_ATTRIBS. Bug: angleproject:2264 Change-Id: I788659ad25be5708dbab422ac4a16dff60abf154 Reviewed-on: https://chromium-review.googlesource.com/790750Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3c1da04e
...@@ -310,6 +310,9 @@ using AttachmentArray = std::array<T, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS ...@@ -310,6 +310,9 @@ using AttachmentArray = std::array<T, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS
template <typename T> template <typename T>
using DrawBuffersArray = std::array<T, IMPLEMENTATION_MAX_DRAW_BUFFERS>; using DrawBuffersArray = std::array<T, IMPLEMENTATION_MAX_DRAW_BUFFERS>;
template <typename T>
using AttribArray = std::array<T, MAX_VERTEX_ATTRIBS>;
} // namespace gl } // namespace gl
namespace rx namespace rx
......
...@@ -96,7 +96,7 @@ class BufferFactoryD3D : angle::NonCopyable ...@@ -96,7 +96,7 @@ class BufferFactoryD3D : angle::NonCopyable
GLsizei instances) const = 0; GLsizei instances) const = 0;
}; };
using AttribIndexArray = std::array<int, gl::MAX_VERTEX_ATTRIBS>; using AttribIndexArray = gl::AttribArray<int>;
class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitializer class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitializer
{ {
......
...@@ -399,7 +399,7 @@ gl::Error InputLayoutCache::createInputLayout( ...@@ -399,7 +399,7 @@ gl::Error InputLayoutCache::createInputLayout(
programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation(); programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
unsigned int inputElementCount = 0; unsigned int inputElementCount = 0;
std::array<D3D11_INPUT_ELEMENT_DESC, gl::MAX_VERTEX_ATTRIBS> inputElements; gl::AttribArray<D3D11_INPUT_ELEMENT_DESC> inputElements;
for (size_t attribIndex = 0; attribIndex < currentAttributes.size(); ++attribIndex) for (size_t attribIndex = 0; attribIndex < currentAttributes.size(); ++attribIndex)
{ {
......
...@@ -49,7 +49,7 @@ struct PackedAttributeLayout ...@@ -49,7 +49,7 @@ struct PackedAttributeLayout
uint32_t numAttributes; uint32_t numAttributes;
uint32_t flags; uint32_t flags;
std::array<uint32_t, gl::MAX_VERTEX_ATTRIBS> attributeData; gl::AttribArray<uint32_t> attributeData;
}; };
} // namespace rx } // namespace rx
......
...@@ -478,9 +478,9 @@ class StateManager11 final : angle::NonCopyable ...@@ -478,9 +478,9 @@ class StateManager11 final : angle::NonCopyable
// Current applied vertex states. // Current applied vertex states.
// TODO(jmadill): Figure out how to use ResourceSerial here. // TODO(jmadill): Figure out how to use ResourceSerial here.
std::array<ID3D11Buffer *, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexBuffers; gl::AttribArray<ID3D11Buffer *> mCurrentVertexBuffers;
std::array<UINT, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexStrides; gl::AttribArray<UINT> mCurrentVertexStrides;
std::array<UINT, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexOffsets; gl::AttribArray<UINT> mCurrentVertexOffsets;
gl::RangeUI mDirtyVertexBufferRange; gl::RangeUI mDirtyVertexBufferRange;
// Currently applied primitive topology // Currently applied primitive topology
......
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