gfx/angle/src/libGLESv2/renderer/IndexBuffer.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 //
michael@0 2 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
michael@0 3 // Use of this source code is governed by a BSD-style license that can be
michael@0 4 // found in the LICENSE file.
michael@0 5 //
michael@0 6
michael@0 7 // IndexBuffer.h: Defines the abstract IndexBuffer class and IndexBufferInterface
michael@0 8 // class with derivations, classes that perform graphics API agnostic index buffer operations.
michael@0 9
michael@0 10 #ifndef LIBGLESV2_RENDERER_INDEXBUFFER_H_
michael@0 11 #define LIBGLESV2_RENDERER_INDEXBUFFER_H_
michael@0 12
michael@0 13 #include "common/angleutils.h"
michael@0 14 #include "libGLESv2/renderer/IndexRangeCache.h"
michael@0 15
michael@0 16 namespace rx
michael@0 17 {
michael@0 18 class Renderer;
michael@0 19
michael@0 20 class IndexBuffer
michael@0 21 {
michael@0 22 public:
michael@0 23 IndexBuffer();
michael@0 24 virtual ~IndexBuffer();
michael@0 25
michael@0 26 virtual bool initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) = 0;
michael@0 27
michael@0 28 virtual bool mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory) = 0;
michael@0 29 virtual bool unmapBuffer() = 0;
michael@0 30
michael@0 31 virtual bool discard() = 0;
michael@0 32
michael@0 33 virtual GLenum getIndexType() const = 0;
michael@0 34 virtual unsigned int getBufferSize() const = 0;
michael@0 35 virtual bool setSize(unsigned int bufferSize, GLenum indexType) = 0;
michael@0 36
michael@0 37 unsigned int getSerial() const;
michael@0 38
michael@0 39 protected:
michael@0 40 void updateSerial();
michael@0 41
michael@0 42 private:
michael@0 43 DISALLOW_COPY_AND_ASSIGN(IndexBuffer);
michael@0 44
michael@0 45 unsigned int mSerial;
michael@0 46 static unsigned int mNextSerial;
michael@0 47 };
michael@0 48
michael@0 49 class IndexBufferInterface
michael@0 50 {
michael@0 51 public:
michael@0 52 IndexBufferInterface(Renderer *renderer, bool dynamic);
michael@0 53 virtual ~IndexBufferInterface();
michael@0 54
michael@0 55 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType) = 0;
michael@0 56
michael@0 57 GLenum getIndexType() const;
michael@0 58 unsigned int getBufferSize() const;
michael@0 59
michael@0 60 unsigned int getSerial() const;
michael@0 61
michael@0 62 bool mapBuffer(unsigned int size, void** outMappedMemory, unsigned int *streamOffset);
michael@0 63 bool unmapBuffer();
michael@0 64
michael@0 65 IndexBuffer *getIndexBuffer() const;
michael@0 66
michael@0 67 protected:
michael@0 68 unsigned int getWritePosition() const;
michael@0 69 void setWritePosition(unsigned int writePosition);
michael@0 70
michael@0 71 bool discard();
michael@0 72
michael@0 73 bool setBufferSize(unsigned int bufferSize, GLenum indexType);
michael@0 74
michael@0 75 private:
michael@0 76 DISALLOW_COPY_AND_ASSIGN(IndexBufferInterface);
michael@0 77
michael@0 78 rx::Renderer *const mRenderer;
michael@0 79
michael@0 80 IndexBuffer* mIndexBuffer;
michael@0 81
michael@0 82 unsigned int mWritePosition;
michael@0 83 bool mDynamic;
michael@0 84 };
michael@0 85
michael@0 86 class StreamingIndexBufferInterface : public IndexBufferInterface
michael@0 87 {
michael@0 88 public:
michael@0 89 StreamingIndexBufferInterface(Renderer *renderer);
michael@0 90 ~StreamingIndexBufferInterface();
michael@0 91
michael@0 92 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType);
michael@0 93 };
michael@0 94
michael@0 95 class StaticIndexBufferInterface : public IndexBufferInterface
michael@0 96 {
michael@0 97 public:
michael@0 98 explicit StaticIndexBufferInterface(Renderer *renderer);
michael@0 99 ~StaticIndexBufferInterface();
michael@0 100
michael@0 101 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType);
michael@0 102
michael@0 103 IndexRangeCache *getIndexRangeCache();
michael@0 104
michael@0 105 private:
michael@0 106 IndexRangeCache mIndexRangeCache;
michael@0 107 };
michael@0 108
michael@0 109 }
michael@0 110
michael@0 111 #endif // LIBGLESV2_RENDERER_INDEXBUFFER_H_

mercurial