gfx/angle/src/libGLESv2/renderer/InputLayoutCache.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) 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 // InputLayoutCache.h: Defines InputLayoutCache, a class that builds and caches
michael@0 8 // D3D11 input layouts.
michael@0 9
michael@0 10 #ifndef LIBGLESV2_RENDERER_INPUTLAYOUTCACHE_H_
michael@0 11 #define LIBGLESV2_RENDERER_INPUTLAYOUTCACHE_H_
michael@0 12
michael@0 13 #include "libGLESv2/Constants.h"
michael@0 14 #include "common/angleutils.h"
michael@0 15
michael@0 16 namespace gl
michael@0 17 {
michael@0 18 class ProgramBinary;
michael@0 19 }
michael@0 20
michael@0 21 namespace rx
michael@0 22 {
michael@0 23 struct TranslatedAttribute;
michael@0 24
michael@0 25 class InputLayoutCache
michael@0 26 {
michael@0 27 public:
michael@0 28 InputLayoutCache();
michael@0 29 virtual ~InputLayoutCache();
michael@0 30
michael@0 31 void initialize(ID3D11Device *device, ID3D11DeviceContext *context);
michael@0 32 void clear();
michael@0 33 void markDirty();
michael@0 34
michael@0 35 GLenum applyVertexBuffers(TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS],
michael@0 36 gl::ProgramBinary *programBinary);
michael@0 37
michael@0 38 private:
michael@0 39 DISALLOW_COPY_AND_ASSIGN(InputLayoutCache);
michael@0 40
michael@0 41 struct InputLayoutKey
michael@0 42 {
michael@0 43 unsigned int elementCount;
michael@0 44 D3D11_INPUT_ELEMENT_DESC elements[gl::MAX_VERTEX_ATTRIBS];
michael@0 45 GLenum glslElementType[gl::MAX_VERTEX_ATTRIBS];
michael@0 46 };
michael@0 47
michael@0 48 struct InputLayoutCounterPair
michael@0 49 {
michael@0 50 ID3D11InputLayout *inputLayout;
michael@0 51 unsigned long long lastUsedTime;
michael@0 52 };
michael@0 53
michael@0 54 ID3D11InputLayout *mCurrentIL;
michael@0 55 unsigned int mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
michael@0 56 UINT mCurrentVertexStrides[gl::MAX_VERTEX_ATTRIBS];
michael@0 57 UINT mCurrentVertexOffsets[gl::MAX_VERTEX_ATTRIBS];
michael@0 58
michael@0 59 static std::size_t hashInputLayout(const InputLayoutKey &inputLayout);
michael@0 60 static bool compareInputLayouts(const InputLayoutKey &a, const InputLayoutKey &b);
michael@0 61
michael@0 62 typedef std::size_t (*InputLayoutHashFunction)(const InputLayoutKey &);
michael@0 63 typedef bool (*InputLayoutEqualityFunction)(const InputLayoutKey &, const InputLayoutKey &);
michael@0 64 typedef std::unordered_map<InputLayoutKey,
michael@0 65 InputLayoutCounterPair,
michael@0 66 InputLayoutHashFunction,
michael@0 67 InputLayoutEqualityFunction> InputLayoutMap;
michael@0 68 InputLayoutMap mInputLayoutMap;
michael@0 69
michael@0 70 static const unsigned int kMaxInputLayouts;
michael@0 71
michael@0 72 unsigned long long mCounter;
michael@0 73
michael@0 74 ID3D11Device *mDevice;
michael@0 75 ID3D11DeviceContext *mDeviceContext;
michael@0 76 };
michael@0 77
michael@0 78 }
michael@0 79
michael@0 80 #endif // LIBGLESV2_RENDERER_INPUTLAYOUTCACHE_H_

mercurial