2010-12-22 21:39:39 +00:00
|
|
|
/*
|
2011-03-18 17:38:11 +00:00
|
|
|
Copyright 2011 Google Inc.
|
2010-12-22 21:39:39 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GrGLIndexBuffer_DEFINED
|
|
|
|
#define GrGLIndexBuffer_DEFINED
|
|
|
|
|
|
|
|
#include "GrIndexBuffer.h"
|
|
|
|
#include "GrGLConfig.h"
|
|
|
|
|
|
|
|
class GrGpuGL;
|
|
|
|
|
|
|
|
class GrGLIndexBuffer : public GrIndexBuffer {
|
2011-03-30 21:26:44 +00:00
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
public:
|
2011-03-30 21:26:44 +00:00
|
|
|
|
|
|
|
virtual ~GrGLIndexBuffer() { this->release(); }
|
2010-12-22 21:39:39 +00:00
|
|
|
|
2011-03-18 17:38:11 +00:00
|
|
|
GrGLuint bufferID() const;
|
2010-12-22 21:39:39 +00:00
|
|
|
|
|
|
|
// overrides of GrIndexBuffer
|
|
|
|
virtual void* lock();
|
2011-02-14 16:51:21 +00:00
|
|
|
virtual void* lockPtr() const;
|
2010-12-22 21:39:39 +00:00
|
|
|
virtual void unlock();
|
|
|
|
virtual bool isLocked() const;
|
2011-02-14 16:51:21 +00:00
|
|
|
virtual bool updateData(const void* src, size_t srcSizeInBytes);
|
2011-03-30 21:26:44 +00:00
|
|
|
virtual bool updateSubData(const void* src,
|
|
|
|
size_t srcSizeInBytes,
|
2011-02-14 16:51:21 +00:00
|
|
|
size_t offset);
|
2011-03-30 21:26:44 +00:00
|
|
|
protected:
|
|
|
|
GrGLIndexBuffer(GrGpuGL* gpu,
|
|
|
|
GrGLuint id,
|
|
|
|
size_t sizeInBytes,
|
|
|
|
bool dynamic);
|
|
|
|
|
|
|
|
// overrides of GrResource
|
|
|
|
virtual void onAbandon();
|
|
|
|
virtual void onRelease();
|
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
private:
|
2011-02-14 16:51:21 +00:00
|
|
|
void bind() const;
|
2011-03-30 21:26:44 +00:00
|
|
|
|
2011-03-18 17:38:11 +00:00
|
|
|
GrGLuint fBufferID;
|
2010-12-22 21:39:39 +00:00
|
|
|
void* fLockPtr;
|
2011-03-30 21:26:44 +00:00
|
|
|
|
2010-12-22 21:39:39 +00:00
|
|
|
friend class GrGpuGL;
|
|
|
|
|
|
|
|
typedef GrIndexBuffer INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|