Commit c674abeb by Jamie Madill

Refactor InputLayoutCache::applyVertexBuffers.

The redesigned code places the internal buffers and input elements for instance point sprite emulation (FL9_3) at the start of the arrays, instead of swapping with the first non-instanced element. This makes the tracking logic of the caching somewhat cleaner. This facilitates the work of implementing instancing-on-instancing for FL9_3 conformance. BUG=angleproject:1279 Change-Id: Ifb030816a313b1e8b916c57ef05915914443312a Reviewed-on: https://chromium-review.googlesource.com/325090Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3a913264
......@@ -13,8 +13,9 @@
#include <GLES2/gl2.h>
#include <cstddef>
#include <array>
#include <map>
#include <unordered_map>
#include "common/angleutils.h"
#include "libANGLE/Constants.h"
......@@ -33,6 +34,9 @@ struct TranslatedIndexData;
struct SourceIndexData;
class ProgramD3D;
using SortedAttribArray = std::array<const TranslatedAttribute *, gl::MAX_VERTEX_ATTRIBS>;
using SortedIndexArray = std::array<int, gl::MAX_VERTEX_ATTRIBS>;
class InputLayoutCache : angle::NonCopyable
{
public:
......@@ -67,9 +71,8 @@ class InputLayoutCache : angle::NonCopyable
enum Flags
{
FLAG_USES_INSTANCED_SPRITES = 0x1,
FLAG_MOVE_FIRST_INDEXED = 0x2,
FLAG_INSTANCED_SPRITES_ACTIVE = 0x4,
FLAG_USES_INSTANCED_SPRITES = 0x1,
FLAG_INSTANCED_SPRITES_ACTIVE = 0x2,
};
size_t numAttributes;
......@@ -77,13 +80,17 @@ class InputLayoutCache : angle::NonCopyable
uint32_t attributeData[gl::MAX_VERTEX_ATTRIBS];
};
gl::Error findInputLayout(const PackedAttributeLayout &layout,
unsigned int inputElementCount,
const D3D11_INPUT_ELEMENT_DESC inputElements[gl::MAX_VERTEX_ATTRIBS],
ProgramD3D *programD3D,
const TranslatedAttribute *sortedAttributes[gl::MAX_VERTEX_ATTRIBS],
size_t attributeCount,
ID3D11InputLayout **inputLayout);
gl::Error updateInputLayout(gl::Program *program,
GLenum mode,
const SortedAttribArray &sortedAttributes,
const SortedIndexArray &sortedSemanticIndices,
size_t attribCount);
gl::Error createInputLayout(const SortedAttribArray &sortedAttributes,
const SortedIndexArray &sortedSemanticIndices,
size_t attribCount,
GLenum mode,
gl::Program *program,
ID3D11InputLayout **inputLayoutOut);
std::map<PackedAttributeLayout, ID3D11InputLayout *> mLayoutMap;
......
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