Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 //
2 // Copyright (c) 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 // VertexBuffer11.h: Defines the D3D11 VertexBuffer implementation.
9 #ifndef LIBGLESV2_RENDERER_VERTEXBUFFER11_H_
10 #define LIBGLESV2_RENDERER_VERTEXBUFFER11_H_
12 #include "libGLESv2/renderer/VertexBuffer.h"
14 namespace rx
15 {
16 class Renderer11;
18 class VertexBuffer11 : public VertexBuffer
19 {
20 public:
21 explicit VertexBuffer11(rx::Renderer11 *const renderer);
22 virtual ~VertexBuffer11();
24 virtual bool initialize(unsigned int size, bool dynamicUsage);
26 static VertexBuffer11 *makeVertexBuffer11(VertexBuffer *vetexBuffer);
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,
33 unsigned int *outSpaceRequired) const;
35 virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
37 virtual unsigned int getBufferSize() const;
38 virtual bool setBufferSize(unsigned int size);
39 virtual bool discard();
41 unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
42 DXGI_FORMAT getDXGIFormat(const gl::VertexAttribute &attrib) const;
44 ID3D11Buffer *getBuffer() const;
46 private:
47 DISALLOW_COPY_AND_ASSIGN(VertexBuffer11);
49 rx::Renderer11 *const mRenderer;
51 ID3D11Buffer *mBuffer;
52 unsigned int mBufferSize;
53 bool mDynamicUsage;
55 typedef void (*VertexConversionFunction)(const void *, unsigned int, unsigned int, void *);
56 struct VertexConverter
57 {
58 VertexConversionFunction conversionFunc;
59 bool identity;
60 DXGI_FORMAT dxgiFormat;
61 unsigned int outputElementSize;
62 };
64 enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
66 // This table is used to generate mAttributeTypes.
67 static const VertexConverter mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
69 static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute);
70 };
72 }
74 #endif // LIBGLESV2_RENDERER_VERTEXBUFFER11_H_