2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 // VertexDeclarationCache.h: Defines a helper class to construct and cache vertex declarations.
9 #ifndef LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_
10 #define LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_
12 #include "libGLESv2/renderer/d3d/VertexDataManager.h"
16 class VertexDataManager;
22 class VertexDeclarationCache
25 VertexDeclarationCache();
26 ~VertexDeclarationCache();
28 GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw);
30 void markStateDirty();
35 enum { NUM_VERTEX_DECL_CACHE_ENTRIES = 32 };
44 VBData mAppliedVBs[gl::MAX_VERTEX_ATTRIBS];
45 IDirect3DVertexDeclaration9 *mLastSetVDecl;
46 bool mInstancingEnabled;
48 struct VertexDeclCacheEntry
50 D3DVERTEXELEMENT9 cachedElements[gl::MAX_VERTEX_ATTRIBS + 1];
52 IDirect3DVertexDeclaration9 *vertexDeclaration;
53 } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES];
58 #endif // LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_