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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/libGLESv2/renderer/VertexBuffer9.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,91 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-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 +// VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
    1.11 +
    1.12 +#ifndef LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
    1.13 +#define LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
    1.14 +
    1.15 +#include "libGLESv2/renderer/VertexBuffer.h"
    1.16 +
    1.17 +namespace rx
    1.18 +{
    1.19 +class Renderer9;
    1.20 +
    1.21 +class VertexBuffer9 : public VertexBuffer
    1.22 +{
    1.23 +  public:
    1.24 +    explicit VertexBuffer9(rx::Renderer9 *const renderer);
    1.25 +    virtual ~VertexBuffer9();
    1.26 +
    1.27 +    virtual bool initialize(unsigned int size, bool dynamicUsage);
    1.28 +
    1.29 +    static VertexBuffer9 *makeVertexBuffer9(VertexBuffer *vertexBuffer);
    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, unsigned int *outSpaceRequired) const;
    1.36 +
    1.37 +    virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
    1.38 +
    1.39 +    unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
    1.40 +    D3DDECLTYPE getDeclType(const gl::VertexAttribute &attrib) const;
    1.41 +
    1.42 +    virtual unsigned int getBufferSize() const;
    1.43 +    virtual bool setBufferSize(unsigned int size);
    1.44 +    virtual bool discard();
    1.45 +
    1.46 +    IDirect3DVertexBuffer9 *getBuffer() const;
    1.47 +
    1.48 +  private:
    1.49 +    DISALLOW_COPY_AND_ASSIGN(VertexBuffer9);
    1.50 +
    1.51 +    rx::Renderer9 *const mRenderer;
    1.52 +
    1.53 +    IDirect3DVertexBuffer9 *mVertexBuffer;
    1.54 +    unsigned int mBufferSize;
    1.55 +    bool mDynamicUsage;
    1.56 +
    1.57 +    // Attribute format conversion
    1.58 +    enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
    1.59 +
    1.60 +    struct FormatConverter
    1.61 +    {
    1.62 +        bool identity;
    1.63 +        std::size_t outputElementSize;
    1.64 +        void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
    1.65 +        D3DDECLTYPE d3dDeclType;
    1.66 +    };
    1.67 +
    1.68 +    static bool mTranslationsInitialized;
    1.69 +    static void initializeTranslations(DWORD declTypes);
    1.70 +
    1.71 +    // [GL types as enumerated by typeIndex()][normalized][size - 1]
    1.72 +    static FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
    1.73 +
    1.74 +    struct TranslationDescription
    1.75 +    {
    1.76 +        DWORD capsFlag;
    1.77 +        FormatConverter preferredConversion;
    1.78 +        FormatConverter fallbackConversion;
    1.79 +    };
    1.80 +
    1.81 +    // This table is used to generate mFormatConverters.
    1.82 +    // [GL types as enumerated by typeIndex()][normalized][size - 1]
    1.83 +    static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
    1.84 +
    1.85 +    static unsigned int typeIndex(GLenum type);
    1.86 +    static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
    1.87 +
    1.88 +    static bool spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
    1.89 +                              unsigned int *outSpaceRequired);
    1.90 +};
    1.91 +
    1.92 +}
    1.93 +
    1.94 +#endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_

mercurial