1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libGLESv2/renderer/VertexDeclarationCache.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +// 1.5 +// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +// VertexDeclarationCache.h: Defines a helper class to construct and cache vertex declarations. 1.11 + 1.12 +#ifndef LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_ 1.13 +#define LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_ 1.14 + 1.15 +#include "libGLESv2/renderer/VertexDataManager.h" 1.16 + 1.17 +namespace gl 1.18 +{ 1.19 +class VertexDataManager; 1.20 +} 1.21 + 1.22 +namespace rx 1.23 +{ 1.24 + 1.25 +class VertexDeclarationCache 1.26 +{ 1.27 + public: 1.28 + VertexDeclarationCache(); 1.29 + ~VertexDeclarationCache(); 1.30 + 1.31 + GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw); 1.32 + 1.33 + void markStateDirty(); 1.34 + 1.35 + private: 1.36 + UINT mMaxLru; 1.37 + 1.38 + enum { NUM_VERTEX_DECL_CACHE_ENTRIES = 32 }; 1.39 + 1.40 + struct VBData 1.41 + { 1.42 + unsigned int serial; 1.43 + unsigned int stride; 1.44 + unsigned int offset; 1.45 + }; 1.46 + 1.47 + VBData mAppliedVBs[gl::MAX_VERTEX_ATTRIBS]; 1.48 + IDirect3DVertexDeclaration9 *mLastSetVDecl; 1.49 + bool mInstancingEnabled; 1.50 + 1.51 + struct VertexDeclCacheEntry 1.52 + { 1.53 + D3DVERTEXELEMENT9 cachedElements[gl::MAX_VERTEX_ATTRIBS + 1]; 1.54 + UINT lruCount; 1.55 + IDirect3DVertexDeclaration9 *vertexDeclaration; 1.56 + } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES]; 1.57 +}; 1.58 + 1.59 +} 1.60 + 1.61 +#endif // LIBGLESV2_RENDERER_VERTEXDECLARATIONCACHE_H_