gfx/angle/src/libGLESv2/renderer/VertexBuffer9.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.

     1 //
     2 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
     3 // Use of this source code is governed by a BSD-style license that can be
     4 // found in the LICENSE file.
     5 //
     7 // VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
     9 #ifndef LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
    10 #define LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
    12 #include "libGLESv2/renderer/VertexBuffer.h"
    14 namespace rx
    15 {
    16 class Renderer9;
    18 class VertexBuffer9 : public VertexBuffer
    19 {
    20   public:
    21     explicit VertexBuffer9(rx::Renderer9 *const renderer);
    22     virtual ~VertexBuffer9();
    24     virtual bool initialize(unsigned int size, bool dynamicUsage);
    26     static VertexBuffer9 *makeVertexBuffer9(VertexBuffer *vertexBuffer);
    28     virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
    29                                        unsigned int offset);
    30     virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
    32     virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances, unsigned int *outSpaceRequired) const;
    34     virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
    36     unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
    37     D3DDECLTYPE getDeclType(const gl::VertexAttribute &attrib) const;
    39     virtual unsigned int getBufferSize() const;
    40     virtual bool setBufferSize(unsigned int size);
    41     virtual bool discard();
    43     IDirect3DVertexBuffer9 *getBuffer() const;
    45   private:
    46     DISALLOW_COPY_AND_ASSIGN(VertexBuffer9);
    48     rx::Renderer9 *const mRenderer;
    50     IDirect3DVertexBuffer9 *mVertexBuffer;
    51     unsigned int mBufferSize;
    52     bool mDynamicUsage;
    54     // Attribute format conversion
    55     enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
    57     struct FormatConverter
    58     {
    59         bool identity;
    60         std::size_t outputElementSize;
    61         void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
    62         D3DDECLTYPE d3dDeclType;
    63     };
    65     static bool mTranslationsInitialized;
    66     static void initializeTranslations(DWORD declTypes);
    68     // [GL types as enumerated by typeIndex()][normalized][size - 1]
    69     static FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
    71     struct TranslationDescription
    72     {
    73         DWORD capsFlag;
    74         FormatConverter preferredConversion;
    75         FormatConverter fallbackConversion;
    76     };
    78     // This table is used to generate mFormatConverters.
    79     // [GL types as enumerated by typeIndex()][normalized][size - 1]
    80     static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
    82     static unsigned int typeIndex(GLenum type);
    83     static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
    85     static bool spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
    86                               unsigned int *outSpaceRequired);
    87 };
    89 }
    91 #endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_

mercurial