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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/libGLESv2/renderer/VertexBuffer11.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +//
     1.5 +// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// VertexBuffer11.h: Defines the D3D11 VertexBuffer implementation.
    1.11 +
    1.12 +#ifndef LIBGLESV2_RENDERER_VERTEXBUFFER11_H_
    1.13 +#define LIBGLESV2_RENDERER_VERTEXBUFFER11_H_
    1.14 +
    1.15 +#include "libGLESv2/renderer/VertexBuffer.h"
    1.16 +
    1.17 +namespace rx
    1.18 +{
    1.19 +class Renderer11;
    1.20 +
    1.21 +class VertexBuffer11 : public VertexBuffer
    1.22 +{
    1.23 +  public:
    1.24 +    explicit VertexBuffer11(rx::Renderer11 *const renderer);
    1.25 +    virtual ~VertexBuffer11();
    1.26 +
    1.27 +    virtual bool initialize(unsigned int size, bool dynamicUsage);
    1.28 +
    1.29 +    static VertexBuffer11 *makeVertexBuffer11(VertexBuffer *vetexBuffer);
    1.30 +
    1.31 +    virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
    1.32 +                                       unsigned int offset);
    1.33 +    virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
    1.34 +
    1.35 +    virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
    1.36 +                                  unsigned int *outSpaceRequired) const;
    1.37 +
    1.38 +    virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
    1.39 +
    1.40 +    virtual unsigned int getBufferSize() const;
    1.41 +    virtual bool setBufferSize(unsigned int size);
    1.42 +    virtual bool discard();
    1.43 +
    1.44 +    unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
    1.45 +    DXGI_FORMAT getDXGIFormat(const gl::VertexAttribute &attrib) const;
    1.46 +
    1.47 +    ID3D11Buffer *getBuffer() const;
    1.48 +
    1.49 +  private:
    1.50 +    DISALLOW_COPY_AND_ASSIGN(VertexBuffer11);
    1.51 +
    1.52 +    rx::Renderer11 *const mRenderer;
    1.53 +
    1.54 +    ID3D11Buffer *mBuffer;
    1.55 +    unsigned int mBufferSize;
    1.56 +    bool mDynamicUsage;
    1.57 +
    1.58 +    typedef void (*VertexConversionFunction)(const void *, unsigned int, unsigned int, void *);
    1.59 +    struct VertexConverter
    1.60 +    {
    1.61 +        VertexConversionFunction conversionFunc;
    1.62 +        bool identity;
    1.63 +        DXGI_FORMAT dxgiFormat;
    1.64 +        unsigned int outputElementSize;
    1.65 +    };
    1.66 +
    1.67 +    enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
    1.68 +
    1.69 +    // This table is used to generate mAttributeTypes.
    1.70 +    static const VertexConverter mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
    1.71 +
    1.72 +    static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute);
    1.73 +};
    1.74 +
    1.75 +}
    1.76 +
    1.77 +#endif // LIBGLESV2_RENDERER_VERTEXBUFFER11_H_

mercurial