michael@0: // michael@0: // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // IndexRangeCache.h: Defines the rx::IndexRangeCache class which stores information about michael@0: // ranges of indices. michael@0: michael@0: #ifndef LIBGLESV2_RENDERER_INDEXRANGECACHE_H_ michael@0: #define LIBGLESV2_RENDERER_INDEXRANGECACHE_H_ michael@0: michael@0: #include "common/angleutils.h" michael@0: michael@0: namespace rx michael@0: { michael@0: michael@0: class IndexRangeCache michael@0: { michael@0: public: michael@0: void addRange(GLenum type, intptr_t offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx, michael@0: unsigned int streamOffset); michael@0: bool findRange(GLenum type, intptr_t offset, GLsizei count, unsigned int *outMinIndex, michael@0: unsigned int *outMaxIndex, unsigned int *outStreamOffset) const; michael@0: michael@0: void invalidateRange(unsigned int offset, unsigned int size); michael@0: void clear(); michael@0: michael@0: private: michael@0: struct IndexRange michael@0: { michael@0: GLenum type; michael@0: intptr_t offset; michael@0: GLsizei count; michael@0: michael@0: IndexRange(); michael@0: IndexRange(GLenum type, intptr_t offset, GLsizei count); michael@0: michael@0: bool operator<(const IndexRange& rhs) const; michael@0: }; michael@0: michael@0: struct IndexBounds michael@0: { michael@0: unsigned int minIndex; michael@0: unsigned int maxIndex; michael@0: unsigned int streamOffset; michael@0: michael@0: IndexBounds(); michael@0: IndexBounds(unsigned int minIdx, unsigned int maxIdx, unsigned int offset); michael@0: }; michael@0: michael@0: typedef std::map IndexRangeMap; michael@0: IndexRangeMap mIndexRangeCache; michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif LIBGLESV2_RENDERER_INDEXRANGECACHE_H