Home | History | Annotate | Download | only in d3d
      1 //
      2 // Copyright 2014 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 //
      6 
      7 // BufferImpl.h: Defines the abstract rx::BufferImpl class.
      8 
      9 #ifndef LIBGLESV2_RENDERER_BUFFERD3D_H_
     10 #define LIBGLESV2_RENDERER_BUFFERD3D_H_
     11 
     12 #include "libGLESv2/renderer/BufferImpl.h"
     13 #include "libGLESv2/angletypes.h"
     14 
     15 namespace rx
     16 {
     17 
     18 class Renderer;
     19 class StaticIndexBufferInterface;
     20 class StaticVertexBufferInterface;
     21 
     22 class BufferD3D : public BufferImpl
     23 {
     24   public:
     25     BufferD3D();
     26     virtual ~BufferD3D();
     27 
     28     static BufferD3D *makeBufferD3D(BufferImpl *buffer);
     29 
     30     unsigned int getSerial() const { return mSerial; }
     31 
     32     virtual size_t getSize() const = 0;
     33     virtual bool supportsDirectBinding() const = 0;
     34     virtual Renderer* getRenderer() = 0;
     35 
     36     rx::StaticVertexBufferInterface *getStaticVertexBuffer() { return mStaticVertexBuffer; }
     37     rx::StaticIndexBufferInterface *getStaticIndexBuffer() { return mStaticIndexBuffer; }
     38 
     39     void initializeStaticData();
     40     void invalidateStaticData();
     41     void promoteStaticUsage(int dataSize);
     42 
     43   protected:
     44     unsigned int mSerial;
     45     static unsigned int mNextSerial;
     46 
     47     void updateSerial();
     48 
     49     rx::StaticVertexBufferInterface *mStaticVertexBuffer;
     50     rx::StaticIndexBufferInterface *mStaticIndexBuffer;
     51     unsigned int mUnmodifiedDataUse;
     52 };
     53 
     54 }
     55 
     56 #endif // LIBGLESV2_RENDERER_BUFFERIMPLD3D_H_
     57