1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libGLESv2/renderer/IndexRangeCache.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +// 1.5 +// Copyright (c) 2013 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 +// IndexRangeCache.h: Defines the rx::IndexRangeCache class which stores information about 1.11 +// ranges of indices. 1.12 + 1.13 +#ifndef LIBGLESV2_RENDERER_INDEXRANGECACHE_H_ 1.14 +#define LIBGLESV2_RENDERER_INDEXRANGECACHE_H_ 1.15 + 1.16 +#include "common/angleutils.h" 1.17 + 1.18 +namespace rx 1.19 +{ 1.20 + 1.21 +class IndexRangeCache 1.22 +{ 1.23 + public: 1.24 + void addRange(GLenum type, intptr_t offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx, 1.25 + unsigned int streamOffset); 1.26 + bool findRange(GLenum type, intptr_t offset, GLsizei count, unsigned int *outMinIndex, 1.27 + unsigned int *outMaxIndex, unsigned int *outStreamOffset) const; 1.28 + 1.29 + void invalidateRange(unsigned int offset, unsigned int size); 1.30 + void clear(); 1.31 + 1.32 + private: 1.33 + struct IndexRange 1.34 + { 1.35 + GLenum type; 1.36 + intptr_t offset; 1.37 + GLsizei count; 1.38 + 1.39 + IndexRange(); 1.40 + IndexRange(GLenum type, intptr_t offset, GLsizei count); 1.41 + 1.42 + bool operator<(const IndexRange& rhs) const; 1.43 + }; 1.44 + 1.45 + struct IndexBounds 1.46 + { 1.47 + unsigned int minIndex; 1.48 + unsigned int maxIndex; 1.49 + unsigned int streamOffset; 1.50 + 1.51 + IndexBounds(); 1.52 + IndexBounds(unsigned int minIdx, unsigned int maxIdx, unsigned int offset); 1.53 + }; 1.54 + 1.55 + typedef std::map<IndexRange, IndexBounds> IndexRangeMap; 1.56 + IndexRangeMap mIndexRangeCache; 1.57 +}; 1.58 + 1.59 +} 1.60 + 1.61 +#endif LIBGLESV2_RENDERER_INDEXRANGECACHE_H