Revert "Add sizeInBytes to GrResource, make GrRenderTarget aware of its pixel config (r1951)"

Temporarily revert this change in order to roll other changes into Chrome.

TBR=bsalomon@google.com

Review URL: http://codereview.appspot.com/4807051

git-svn-id: http://skia.googlecode.com/svn/trunk@1958 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
vandebo@chromium.org 2011-07-26 03:44:05 +00:00
parent 1f16589855
commit ec36471096
23 changed files with 58 additions and 312 deletions

View File

@ -202,24 +202,6 @@ extern void GrGLRestoreResetRowLength();
GR_GL(GetIntegerv(e, p)); \ GR_GL(GetIntegerv(e, p)); \
} while (0) } while (0)
#define GR_GL_GetFramebufferAttachmentParameteriv(t, a, pname, p) \
do { \
*(p) = GR_GL_INIT_ZERO; \
GR_GL(GetFramebufferAttachmentParameteriv(t, a, pname, p)); \
} while (0)
#define GR_GL_GetRenderbufferParameteriv(t, pname, p) \
do { \
*(p) = GR_GL_INIT_ZERO; \
GR_GL(GetRenderbufferParameteriv(t, pname, p)); \
} while (0)
#define GR_GL_GetTexLevelParameteriv(t, l, pname, p) \
do { \
*(p) = GR_GL_INIT_ZERO; \
GR_GL(GetTexLevelParameteriv(t, l, pname, p)); \
} while (0)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif #endif

View File

@ -432,11 +432,11 @@
#define GR_GL_TEXTURE_ENV 0x2300 #define GR_GL_TEXTURE_ENV 0x2300
#define GR_GL_TEXTURE_ENV_MODE 0x2200 #define GR_GL_TEXTURE_ENV_MODE 0x2200
#define GR_GL_TEXTURE_1D 0x0DE0 #define GR_GL_TEXTURE_1D 0x0DE0
/* GL_TEXTURE_2D */ #define GR_GL_TEXTURE_2D 0x0DE1
/* GL_TEXTURE_WRAP_S */ /* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */ /* GL_TEXTURE_WRAP_T */
/* GL_TEXTURE_MAG_FILTER */ /* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */ /* GL_TEXTURE_MIN_FILTER */
#define GR_GL_TEXTURE_ENV_COLOR 0x2201 #define GR_GL_TEXTURE_ENV_COLOR 0x2201
#define GR_GL_TEXTURE_GEN_S 0x0C60 #define GR_GL_TEXTURE_GEN_S 0x0C60
#define GR_GL_TEXTURE_GEN_T 0x0C61 #define GR_GL_TEXTURE_GEN_T 0x0C61
@ -452,11 +452,10 @@
#define GR_GL_TEXTURE_ALPHA_SIZE 0x805F #define GR_GL_TEXTURE_ALPHA_SIZE 0x805F
#define GR_GL_TEXTURE_LUMINANCE_SIZE 0x8060 #define GR_GL_TEXTURE_LUMINANCE_SIZE 0x8060
#define GR_GL_TEXTURE_INTENSITY_SIZE 0x8061 #define GR_GL_TEXTURE_INTENSITY_SIZE 0x8061
#define GR_GL_TEXTURE_INTERNAL_FORMAT 0x1003 /* GL_NEAREST_MIPMAP_NEAREST */
/* GL_NEAREST_MIPMAP_NEAREST */ /* GL_NEAREST_MIPMAP_LINEAR */
/* GL_NEAREST_MIPMAP_LINEAR */ /* GL_LINEAR_MIPMAP_NEAREST */
/* GL_LINEAR_MIPMAP_NEAREST */ /* GL_LINEAR_MIPMAP_LINEAR */
/* GL_LINEAR_MIPMAP_LINEAR */
#define GR_GL_OBJECT_LINEAR 0x2401 #define GR_GL_OBJECT_LINEAR 0x2401
#define GR_GL_OBJECT_PLANE 0x2501 #define GR_GL_OBJECT_PLANE 0x2501
#define GR_GL_EYE_LINEAR 0x2400 #define GR_GL_EYE_LINEAR 0x2400
@ -606,11 +605,6 @@
#define GR_GL_RGB5_A1 0x8057 #define GR_GL_RGB5_A1 0x8057
#define GR_GL_RGB565 0x8D62 #define GR_GL_RGB565 0x8D62
#define GR_GL_RGBA8 0x8058 #define GR_GL_RGBA8 0x8058
#define GR_GL_RGB8 0x8051
#define GR_GL_SRGB 0x8C40
#define GR_GL_SRGB8 0x8C41
#define GR_GL_SRGB_ALPHA 0x8C42
#define GR_GL_SRGB8_ALPHA8 0x8C43
#define GR_GL_DEPTH_COMPONENT16 0x81A5 #define GR_GL_DEPTH_COMPONENT16 0x81A5
#define GR_GL_STENCIL_INDEX 0x1901 #define GR_GL_STENCIL_INDEX 0x1901
#define GR_GL_STENCIL_INDEX4 0x8D47 #define GR_GL_STENCIL_INDEX4 0x8D47
@ -635,13 +629,6 @@
#define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 #define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 #define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
#define GR_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
#define GR_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
#define GR_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
#define GR_GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
#define GR_GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
#define GR_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
#define GR_GL_COLOR_ATTACHMENT0 0x8CE0 #define GR_GL_COLOR_ATTACHMENT0 0x8CE0
#define GR_GL_DEPTH_ATTACHMENT 0x8D00 #define GR_GL_DEPTH_ATTACHMENT 0x8D00

View File

@ -133,7 +133,6 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params);
typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name); typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetTexLevelParameteriv)(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params);
typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name); typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program);
@ -191,8 +190,6 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetFramebufferAttachmentParameterivProc)(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetRenderbufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
// Multisampling Extension Functions // Multisampling Extension Functions
@ -286,7 +283,6 @@ struct GrGLInterface {
GrGLGetShaderInfoLogProc fGetShaderInfoLog; GrGLGetShaderInfoLogProc fGetShaderInfoLog;
GrGLGetShaderivProc fGetShaderiv; GrGLGetShaderivProc fGetShaderiv;
GrGLGetStringProc fGetString; GrGLGetStringProc fGetString;
GrGLGetTexLevelParameteriv fGetTexLevelParameteriv;
GrGLGetUniformLocationProc fGetUniformLocation; GrGLGetUniformLocationProc fGetUniformLocation;
GrGLLineWidthProc fLineWidth; GrGLLineWidthProc fLineWidth;
GrGLLinkProgramProc fLinkProgram; GrGLLinkProgramProc fLinkProgram;
@ -344,8 +340,6 @@ struct GrGLInterface {
GrGLFramebufferTexture2DProc fFramebufferTexture2D; GrGLFramebufferTexture2DProc fFramebufferTexture2D;
GrGLGenFramebuffersProc fGenFramebuffers; GrGLGenFramebuffersProc fGenFramebuffers;
GrGLGenRenderbuffersProc fGenRenderbuffers; GrGLGenRenderbuffersProc fGenRenderbuffers;
GrGLGetFramebufferAttachmentParameterivProc fGetFramebufferAttachmentParameteriv;
GrGLGetRenderbufferParameterivProc fGetRenderbufferParameteriv;
GrGLRenderbufferStorageProc fRenderbufferStorage; GrGLRenderbufferStorageProc fRenderbufferStorage;
// Multisampling Extension Functions // Multisampling Extension Functions

View File

@ -67,7 +67,6 @@ public:
GrGLRenderTarget(GrGpuGL* gpu, GrGLRenderTarget(GrGpuGL* gpu,
const GLRenderTargetIDs& ids, const GLRenderTargetIDs& ids,
GrGLTexID* texID, GrGLTexID* texID,
GrPixelConfig config,
GrGLuint stencilBits, GrGLuint stencilBits,
bool isMultisampled, bool isMultisampled,
const GrGLIRect& fViewport, const GrGLIRect& fViewport,
@ -178,7 +177,7 @@ public:
int height, int height,
const void* srcData, const void* srcData,
size_t rowBytes); size_t rowBytes);
virtual intptr_t getTextureHandle() const; virtual intptr_t getTextureHandle();
const TexParams& getTexParams() const { return fTexParams; } const TexParams& getTexParams() const { return fTexParams; }
void setTexParams(const TexParams& texParams) { fTexParams = texParams; } void setTexParams(const TexParams& texParams) { fTexParams = texParams; }

View File

@ -26,6 +26,12 @@ class GrGpu;
*/ */
class GrGeometryBuffer : public GrResource { class GrGeometryBuffer : public GrResource {
public: public:
/**
* Retrieves the size of the buffer
*
* @return the size of the buffer in bytes
*/
size_t size() const { return fSizeInBytes; }
/** /**
*Retrieves whether the buffer was created with the dynamic flag *Retrieves whether the buffer was created with the dynamic flag
@ -88,10 +94,6 @@ public:
virtual bool updateSubData(const void* src, virtual bool updateSubData(const void* src,
size_t srcSizeInBytes, size_t srcSizeInBytes,
size_t offset) = 0; size_t offset) = 0;
// GrResource overrides
virtual size_t sizeInBytes() const { return fSizeInBytes; }
protected: protected:
GrGeometryBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic) GrGeometryBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
: INHERITED(gpu) : INHERITED(gpu)

View File

@ -27,9 +27,7 @@ public:
* from the index buffer (using kTriangles_PrimitiveType). * from the index buffer (using kTriangles_PrimitiveType).
* @return the maximum number of quads using full size of index buffer. * @return the maximum number of quads using full size of index buffer.
*/ */
int maxQuads() const { int maxQuads() const { return size() / (sizeof(uint16_t) * 6); }
return this->sizeInBytes() / (sizeof(uint16_t) * 6);
}
protected: protected:
GrIndexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic) GrIndexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
: INHERITED(gpu, sizeInBytes, dynamic) {} : INHERITED(gpu, sizeInBytes, dynamic) {}

View File

@ -54,14 +54,6 @@ public:
*/ */
bool isValid() const { return NULL != fGpu; } bool isValid() const { return NULL != fGpu; }
/**
* Retrieves the size of the object in GPU memory. This is approximate since
* we aren't aware of additional padding or copies made by the driver.
*
* @return the size of the buffer in bytes
*/
virtual size_t sizeInBytes() const = 0;
protected: protected:
virtual void onRelease() = 0; virtual void onRelease() = 0;

View File

@ -43,13 +43,6 @@ public:
*/ */
int height() const { return fHeight; } int height() const { return fHeight; }
/**
* @return the pixel config. Can be kUnknown_GrPixelConfig
* if client asked us to render to a target that has a pixel
* config that isn't equivalent with one of our configs.
*/
int config() const { return fConfig; }
/** /**
* @return the number of stencil bits in the rendertarget * @return the number of stencil bits in the rendertarget
*/ */
@ -112,9 +105,6 @@ public:
*/ */
const GrIRect& getResolveRect() const { return fResolveRect; } const GrIRect& getResolveRect() const { return fResolveRect; }
// GrResource overrides
virtual size_t sizeInBytes() const;
/** /**
* Reads a rectangle of pixels from the render target. * Reads a rectangle of pixels from the render target.
* @param left left edge of the rectangle to read (inclusive) * @param left left edge of the rectangle to read (inclusive)
@ -145,14 +135,12 @@ protected:
GrTexture* texture, GrTexture* texture,
int width, int width,
int height, int height,
GrPixelConfig config,
int stencilBits, int stencilBits,
bool isMultisampled) bool isMultisampled)
: INHERITED(gpu) : INHERITED(gpu)
, fTexture(texture) , fTexture(texture)
, fWidth(width) , fWidth(width)
, fHeight(height) , fHeight(height)
, fConfig(config)
, fStencilBits(stencilBits) , fStencilBits(stencilBits)
, fIsMultisampled(isMultisampled) , fIsMultisampled(isMultisampled)
{ {
@ -172,12 +160,11 @@ protected:
private: private:
GrTexture* fTexture; // not ref'ed GrTexture* fTexture; // not ref'ed
int fWidth; int fWidth;
int fHeight; int fHeight;
GrPixelConfig fConfig; int fStencilBits;
int fStencilBits; bool fIsMultisampled;
bool fIsMultisampled; GrIRect fResolveRect;
GrIRect fResolveRect;
// GrGpu keeps a cached clip in the render target to avoid redundantly // GrGpu keeps a cached clip in the render target to avoid redundantly
// rendering the clip into the same stencil buffer. // rendering the clip into the same stencil buffer.
@ -221,7 +208,7 @@ public:
/** /**
* Approximate number of bytes used by the texture * Approximate number of bytes used by the texture
*/ */
virtual size_t sizeInBytes() const { size_t sizeInBytes() const {
return fWidth * fHeight * GrBytesPerPixel(fConfig); return fWidth * fHeight * GrBytesPerPixel(fConfig);
} }
@ -286,7 +273,7 @@ public:
* Return the native ID or handle to the texture, depending on the * Return the native ID or handle to the texture, depending on the
* platform. e.g. on opengl, return the texture ID. * platform. e.g. on opengl, return the texture ID.
*/ */
virtual intptr_t getTextureHandle() const = 0; virtual intptr_t getTextureHandle() = 0;
#if GR_DEBUG #if GR_DEBUG
void validate() const { void validate() const {
@ -314,7 +301,7 @@ protected:
fShiftFixedX = 31 - Gr_clz(fWidth); fShiftFixedX = 31 - Gr_clz(fWidth);
fShiftFixedY = 31 - Gr_clz(fHeight); fShiftFixedY = 31 - Gr_clz(fHeight);
} }
// GrResource overrides // GrResource overrides
virtual void onRelease() { virtual void onRelease() {
releaseRenderTarget(); releaseRenderTarget();

View File

@ -111,7 +111,7 @@ void GrBufferAllocPool::unlock() {
if (block.fBuffer->isLocked()) { if (block.fBuffer->isLocked()) {
block.fBuffer->unlock(); block.fBuffer->unlock();
} else { } else {
size_t flushSize = block.fBuffer->sizeInBytes() - block.fBytesFree; size_t flushSize = block.fBuffer->size() - block.fBytesFree;
flushCpuData(fBlocks.back().fBuffer, flushSize); flushCpuData(fBlocks.back().fBuffer, flushSize);
} }
fBufferPtr = NULL; fBufferPtr = NULL;
@ -137,7 +137,7 @@ void GrBufferAllocPool::validate(bool unusedBlockAllowed) const {
GrAssert(!fBlocks[i].fBuffer->isLocked()); GrAssert(!fBlocks[i].fBuffer->isLocked());
} }
for (int i = 0; i < fBlocks.count(); ++i) { for (int i = 0; i < fBlocks.count(); ++i) {
size_t bytes = fBlocks[i].fBuffer->sizeInBytes() - fBlocks[i].fBytesFree; size_t bytes = fBlocks[i].fBuffer->size() - fBlocks[i].fBytesFree;
bytesInUse += bytes; bytesInUse += bytes;
GrAssert(bytes || unusedBlockAllowed); GrAssert(bytes || unusedBlockAllowed);
} }
@ -163,7 +163,7 @@ void* GrBufferAllocPool::makeSpace(size_t size,
if (NULL != fBufferPtr) { if (NULL != fBufferPtr) {
BufferBlock& back = fBlocks.back(); BufferBlock& back = fBlocks.back();
size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree; size_t usedBytes = back.fBuffer->size() - back.fBytesFree;
size_t pad = GrSizeAlignUpPad(usedBytes, size_t pad = GrSizeAlignUpPad(usedBytes,
alignment); alignment);
if ((size + pad) <= back.fBytesFree) { if ((size + pad) <= back.fBytesFree) {
@ -199,7 +199,7 @@ int GrBufferAllocPool::currentBufferItems(size_t itemSize) const {
VALIDATE(); VALIDATE();
if (NULL != fBufferPtr) { if (NULL != fBufferPtr) {
const BufferBlock& back = fBlocks.back(); const BufferBlock& back = fBlocks.back();
size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree; size_t usedBytes = back.fBuffer->size() - back.fBytesFree;
size_t pad = GrSizeAlignUpPad(usedBytes, itemSize); size_t pad = GrSizeAlignUpPad(usedBytes, itemSize);
return (back.fBytesFree - pad) / itemSize; return (back.fBytesFree - pad) / itemSize;
} else if (fPreallocBuffersInUse < fPreallocBuffers.count()) { } else if (fPreallocBuffersInUse < fPreallocBuffers.count()) {
@ -223,7 +223,7 @@ void GrBufferAllocPool::putBack(size_t bytes) {
// caller shouldnt try to put back more than they've taken // caller shouldnt try to put back more than they've taken
GrAssert(!fBlocks.empty()); GrAssert(!fBlocks.empty());
BufferBlock& block = fBlocks.back(); BufferBlock& block = fBlocks.back();
size_t bytesUsed = block.fBuffer->sizeInBytes() - block.fBytesFree; size_t bytesUsed = block.fBuffer->size() - block.fBytesFree;
if (bytes >= bytesUsed) { if (bytes >= bytesUsed) {
bytes -= bytesUsed; bytes -= bytesUsed;
fBytesInUse -= bytesUsed; fBytesInUse -= bytesUsed;
@ -271,7 +271,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) {
prev.fBuffer->unlock(); prev.fBuffer->unlock();
} else { } else {
flushCpuData(prev.fBuffer, flushCpuData(prev.fBuffer,
prev.fBuffer->sizeInBytes() - prev.fBytesFree); prev.fBuffer->size() - prev.fBytesFree);
} }
fBufferPtr = NULL; fBufferPtr = NULL;
} }
@ -317,7 +317,7 @@ void GrBufferAllocPool::flushCpuData(GrGeometryBuffer* buffer,
GrAssert(NULL != buffer); GrAssert(NULL != buffer);
GrAssert(!buffer->isLocked()); GrAssert(!buffer->isLocked());
GrAssert(fCpuData.get() == fBufferPtr); GrAssert(fCpuData.get() == fBufferPtr);
GrAssert(flushSize <= buffer->sizeInBytes()); GrAssert(flushSize <= buffer->size());
bool updated = false; bool updated = false;
if (fGpu->supportsBufferLocking() && if (fGpu->supportsBufferLocking() &&

View File

@ -641,7 +641,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type, int startVertex,
maxValidVertex = geoSrc.fVertexCount; maxValidVertex = geoSrc.fVertexCount;
break; break;
case kBuffer_GeometrySrcType: case kBuffer_GeometrySrcType:
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() / maxValidVertex = geoSrc.fVertexBuffer->size() /
VertexSize(geoSrc.fVertexLayout); VertexSize(geoSrc.fVertexLayout);
break; break;
} }
@ -658,7 +658,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type, int startVertex,
maxValidIndex = geoSrc.fIndexCount; maxValidIndex = geoSrc.fIndexCount;
break; break;
case kBuffer_GeometrySrcType: case kBuffer_GeometrySrcType:
maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / sizeof(uint16_t); maxValidIndex = geoSrc.fIndexBuffer->size() / sizeof(uint16_t);
break; break;
} }
if (maxIndex > maxValidIndex) { if (maxIndex > maxValidIndex) {
@ -685,7 +685,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
maxValidVertex = geoSrc.fVertexCount; maxValidVertex = geoSrc.fVertexCount;
break; break;
case kBuffer_GeometrySrcType: case kBuffer_GeometrySrcType:
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() / maxValidVertex = geoSrc.fVertexBuffer->size() /
VertexSize(geoSrc.fVertexLayout); VertexSize(geoSrc.fVertexLayout);
break; break;
} }

View File

@ -59,8 +59,8 @@ void* GrGLIndexBuffer::lock() {
if (GPUGL->supportsBufferLocking()) { if (GPUGL->supportsBufferLocking()) {
this->bind(); this->bind();
// Let driver know it can discard the old data // Let driver know it can discard the old data
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), NULL, GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL,
this->dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW)); dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, GR_GL_WRITE_ONLY)); fLockPtr = GR_GL(MapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, GR_GL_WRITE_ONLY));
return fLockPtr; return fLockPtr;
@ -98,16 +98,16 @@ bool GrGLIndexBuffer::isLocked() const {
bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) { bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
GrAssert(fBufferID); GrAssert(fBufferID);
GrAssert(!isLocked()); GrAssert(!isLocked());
if (srcSizeInBytes > this->sizeInBytes()) { if (srcSizeInBytes > size()) {
return false; return false;
} }
this->bind(); this->bind();
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW; GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
if (this->sizeInBytes() == srcSizeInBytes) { if (size() == srcSizeInBytes) {
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage)); GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage));
} else { } else {
#if GR_GL_USE_BUFFER_DATA_NULL_HINT #if GR_GL_USE_BUFFER_DATA_NULL_HINT
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), NULL, usage)); GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL, usage));
#endif #endif
GR_GL(BufferSubData(GR_GL_ELEMENT_ARRAY_BUFFER, 0, srcSizeInBytes, src)); GR_GL(BufferSubData(GR_GL_ELEMENT_ARRAY_BUFFER, 0, srcSizeInBytes, src));
} }
@ -119,7 +119,7 @@ bool GrGLIndexBuffer::updateSubData(const void* src,
size_t offset) { size_t offset) {
GrAssert(fBufferID); GrAssert(fBufferID);
GrAssert(!isLocked()); GrAssert(!isLocked());
if (srcSizeInBytes + offset > this->sizeInBytes()) { if (srcSizeInBytes + offset > size()) {
return false; return false;
} }
this->bind(); this->bind();

View File

@ -236,8 +236,6 @@ bool GrGLInterface::validate(GrEngine engine) const {
NULL == fDeleteRenderbuffers || NULL == fDeleteRenderbuffers ||
NULL == fFramebufferRenderbuffer || NULL == fFramebufferRenderbuffer ||
NULL == fFramebufferTexture2D || NULL == fFramebufferTexture2D ||
NULL == fGetFramebufferAttachmentParameteriv ||
NULL == fGetRenderbufferParameteriv ||
NULL == fGenFramebuffers || NULL == fGenFramebuffers ||
NULL == fGenRenderbuffers || NULL == fGenRenderbuffers ||
NULL == fRenderbufferStorage) { NULL == fRenderbufferStorage) {
@ -312,11 +310,9 @@ bool GrGLInterface::validate(GrEngine engine) const {
// part of desktop GL // part of desktop GL
if (kDesktop_GrGLBinding == fBindingsExported && if (kDesktop_GrGLBinding == fBindingsExported &&
(NULL == fLineWidth || NULL == fLineWidth) {
NULL == fGetTexLevelParameteriv)) {
return false; return false;
} }
// FBO MSAA // FBO MSAA
if (kDesktop_GrGLBinding == fBindingsExported) { if (kDesktop_GrGLBinding == fBindingsExported) {
// GL 3.0 and the ARB extension have multisample + blit // GL 3.0 and the ARB extension have multisample + blit

View File

@ -23,14 +23,12 @@
GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu, GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
const GLRenderTargetIDs& ids, const GLRenderTargetIDs& ids,
GrGLTexID* texID, GrGLTexID* texID,
GrPixelConfig config,
GrGLuint stencilBits, GrGLuint stencilBits,
bool isMultisampled, bool isMultisampled,
const GrGLIRect& viewport, const GrGLIRect& viewport,
GrGLTexture* texture) GrGLTexture* texture)
: INHERITED(gpu, texture, viewport.fWidth, : INHERITED(gpu, texture, viewport.fWidth,
viewport.fHeight, config, viewport.fHeight, stencilBits, isMultisampled) {
stencilBits, isMultisampled) {
fRTFBOID = ids.fRTFBOID; fRTFBOID = ids.fRTFBOID;
fTexFBOID = ids.fTexFBOID; fTexFBOID = ids.fTexFBOID;
fStencilRenderbufferID = ids.fStencilRenderbufferID; fStencilRenderbufferID = ids.fStencilRenderbufferID;
@ -133,7 +131,6 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight; vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight;
fRenderTarget = new GrGLRenderTarget(gpu, rtIDs, fTexIDObj, fRenderTarget = new GrGLRenderTarget(gpu, rtIDs, fTexIDObj,
textureDesc.fFormat,
textureDesc.fStencilBits, textureDesc.fStencilBits,
rtIDs.fRTFBOID != rtIDs.fTexFBOID, rtIDs.fRTFBOID != rtIDs.fTexFBOID,
vp, this); vp, this);
@ -229,7 +226,7 @@ void GrGLTexture::uploadTextureData(int x,
} }
} }
intptr_t GrGLTexture::getTextureHandle() const { intptr_t GrGLTexture::getTextureHandle() {
return fTexIDObj->id(); return fTexIDObj->id();
} }

View File

@ -58,8 +58,8 @@ void* GrGLVertexBuffer::lock() {
if (GPUGL->supportsBufferLocking()) { if (GPUGL->supportsBufferLocking()) {
this->bind(); this->bind();
// Let driver know it can discard the old data // Let driver know it can discard the old data
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL, GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL,
this->dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW)); dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GR_GL_ARRAY_BUFFER, GR_GL_WRITE_ONLY)); fLockPtr = GR_GL(MapBuffer(GR_GL_ARRAY_BUFFER, GR_GL_WRITE_ONLY));
return fLockPtr; return fLockPtr;
} }
@ -97,16 +97,16 @@ bool GrGLVertexBuffer::isLocked() const {
bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) { bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
GrAssert(fBufferID); GrAssert(fBufferID);
GrAssert(!isLocked()); GrAssert(!isLocked());
if (srcSizeInBytes > this->sizeInBytes()) { if (srcSizeInBytes > size()) {
return false; return false;
} }
this->bind(); this->bind();
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW; GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
if (this->sizeInBytes() == srcSizeInBytes) { if (size() == srcSizeInBytes) {
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, srcSizeInBytes, src, usage)); GR_GL(BufferData(GR_GL_ARRAY_BUFFER, srcSizeInBytes, src, usage));
} else { } else {
#if GR_GL_USE_BUFFER_DATA_NULL_HINT #if GR_GL_USE_BUFFER_DATA_NULL_HINT
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL, usage)); GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL, usage));
#endif #endif
GR_GL(BufferSubData(GR_GL_ARRAY_BUFFER, 0, srcSizeInBytes, src)); GR_GL(BufferSubData(GR_GL_ARRAY_BUFFER, 0, srcSizeInBytes, src));
} }
@ -118,7 +118,7 @@ bool GrGLVertexBuffer::updateSubData(const void* src,
size_t offset) { size_t offset) {
GrAssert(fBufferID); GrAssert(fBufferID);
GrAssert(!isLocked()); GrAssert(!isLocked());
if (srcSizeInBytes + offset > this->sizeInBytes()) { if (srcSizeInBytes + offset > size()) {
return false; return false;
} }
this->bind(); this->bind();

View File

@ -658,152 +658,12 @@ GrResource* GrGpuGL::onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc)
viewport.fWidth = desc.fWidth; viewport.fWidth = desc.fWidth;
viewport.fHeight = desc.fHeight; viewport.fHeight = desc.fHeight;
bool isMSAA = kIsMultisampled_GrPlatformRenderTargetFlagBit & return new GrGLRenderTarget(this, rtIDs, NULL, desc.fStencilBits,
desc.fRenderTargetFlags; kIsMultisampled_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags,
viewport, NULL);
return new GrGLRenderTarget(this, rtIDs, NULL, desc.fConfig,
desc.fStencilBits, isMSAA, viewport, NULL);
} }
} }
namespace {
static const GrGLenum kUnknownGLFormat = ~0;
GrGLenum get_fbo_color_format() {
GrGLint cbType;
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
&cbType);
GrGLint cbID;
GrGLint cbFormat;
switch (cbType) {
case GR_GL_RENDERBUFFER:
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
&cbID);
GR_GL(BindRenderbuffer(GR_GL_RENDERBUFFER, cbID));
GR_GL_GetRenderbufferParameteriv(GR_GL_RENDERBUFFER,
GR_GL_RENDERBUFFER_INTERNAL_FORMAT,
&cbFormat);
return cbFormat;
break;
case GR_GL_TEXTURE:
// ES doesn't have glGetTexLevelParameter
if (GR_GL_SUPPORT_DESKTOP) {
GrGLint cbLevel;
GrGLint cbFace;
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
&cbID);
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL,
&cbLevel);
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
&cbFace);
GrGLenum bind;
GrGLenum target;
if (cbFace) {
bind = GR_GL_TEXTURE_CUBE_MAP;
target = cbFace;
} else {
bind = GR_GL_TEXTURE_2D;
target = GR_GL_TEXTURE_2D;
}
GR_GL(BindTexture(bind, cbID));
GR_GL_GetTexLevelParameteriv(target, cbLevel,
GR_GL_TEXTURE_INTERNAL_FORMAT, &cbFormat);
return cbFormat;
} else {
return kUnknownGLFormat;
}
break;
default:
// we can get here with FBO 0, not a render buffer or a texture
return kUnknownGLFormat;
}
}
GrPixelConfig internal_color_format_to_config(GrGLenum iFormat) {
switch (iFormat) {
case GR_GL_RGB565:
return kRGB_565_GrPixelConfig;
case GR_GL_RGBA4:
return kRGBA_4444_GrPixelConfig;
case GR_GL_RGBA8:
case GR_GL_SRGB8_ALPHA8:
case GR_GL_SRGB_ALPHA:
case GR_GL_RGBA:
case GR_GL_BGRA:
return kRGBA_8888_GrPixelConfig;
case GR_GL_RGB8:
case GR_GL_SRGB8:
case GR_GL_SRGB:
return kRGBX_8888_GrPixelConfig;
default:
// there are many GL formats we don't have enums
// for. We should still render to them if the client
// asks us.
return kUnknown_GrPixelConfig;
}
}
GrPixelConfig get_implied_color_config(bool arbFBOExtension) {
GrGLint rSize, bSize, gSize, aSize;
if (arbFBOExtension) {
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &rSize);
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &gSize);
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, &bSize);
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &aSize);
} else {
GR_GL_GetIntegerv(GR_GL_RED_BITS, &rSize);
GR_GL_GetIntegerv(GR_GL_GREEN_BITS, &gSize);
GR_GL_GetIntegerv(GR_GL_BLUE_BITS, &bSize);
GR_GL_GetIntegerv(GR_GL_ALPHA_BITS, &aSize);
}
if(8 == rSize && 8 == gSize && 8 == bSize) {
if (0 == aSize) {
return kRGBX_8888_GrPixelConfig;
} else if (8 == aSize) {
return kRGBA_8888_GrPixelConfig;
}
} else if (4 == rSize && 4 == gSize && 4 == bSize && 4 == aSize) {
return kRGBA_4444_GrPixelConfig;
} else if (5 == rSize && 6 == gSize && 5 == bSize && 0 == aSize) {
return kRGB_565_GrPixelConfig;
}
return kUnknown_GrPixelConfig;
}
int get_fbo_stencil_bits(bool arbFBOExtension) {
GrGLint stencilBits;
if (arbFBOExtension) {
GR_GL_GetFramebufferAttachmentParameteriv(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
GR_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
&stencilBits);
} else {
GR_GL_GetIntegerv(GR_GL_STENCIL_BITS, &stencilBits);
}
return stencilBits;
}
}
GrRenderTarget* GrGpuGL::onCreateRenderTargetFrom3DApiState() { GrRenderTarget* GrGpuGL::onCreateRenderTargetFrom3DApiState() {
GrGLRenderTarget::GLRenderTargetIDs rtIDs; GrGLRenderTarget::GLRenderTargetIDs rtIDs;
@ -813,29 +673,17 @@ GrRenderTarget* GrGpuGL::onCreateRenderTargetFrom3DApiState() {
rtIDs.fMSColorRenderbufferID = 0; rtIDs.fMSColorRenderbufferID = 0;
rtIDs.fStencilRenderbufferID = 0; rtIDs.fStencilRenderbufferID = 0;
bool arbFBO = (GR_GL_SUPPORT_DESKTOP && (fGLVersion > 3.0 ||
this->hasExtension("GL_ARB_framebuffer_object")));
GrGLIRect viewport; GrGLIRect viewport;
viewport.setFromGLViewport(); viewport.setFromGLViewport();
int stencilBits = get_fbo_stencil_bits(arbFBO); GrGLuint stencilBits;
GR_GL_GetIntegerv(GR_GL_STENCIL_BITS, (GrGLint*)&stencilBits);
GrPixelConfig config;
GrGLint samples; GrGLint samples;
GR_GL_GetIntegerv(GR_GL_SAMPLES, &samples); GR_GL_GetIntegerv(GR_GL_SAMPLES, &samples);
GrGLenum fmat = get_fbo_color_format();
if (kUnknownGLFormat == fmat) {
config = get_implied_color_config(arbFBO);
} else {
config = internal_color_format_to_config(fmat);
}
// may have to bind a texture to gets its format
this->setSpareTextureUnit();
rtIDs.fOwnIDs = false; rtIDs.fOwnIDs = false;
return new GrGLRenderTarget(this, rtIDs, NULL, config, stencilBits, return new GrGLRenderTarget(this, rtIDs, NULL, stencilBits,
(samples > 0), viewport, NULL); (samples > 0), viewport, NULL);
} }

View File

@ -277,7 +277,7 @@ HAS_ATLAS:
NULL); NULL);
} }
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads(); int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->size() / (6 * sizeof(uint16_t));
if (fMaxVertices < kMinRequestedVerts) { if (fMaxVertices < kMinRequestedVerts) {
fMaxVertices = kDefaultRequestedVerts; fMaxVertices = kDefaultRequestedVerts;
} else if (fMaxVertices > maxQuadVertices) { } else if (fMaxVertices > maxQuadVertices) {

View File

@ -29,16 +29,6 @@ bool GrRenderTarget::readPixels(int left, int top, int width, int height,
config, buffer); config, buffer);
} }
size_t GrRenderTarget::sizeInBytes() const {
int colorBits;
if (kUnknown_GrPixelConfig == fConfig) {
colorBits = 32; // don't know, make a guess
} else {
colorBits = GrBytesPerPixel(fConfig);
}
return fWidth * fHeight * (fStencilBits + colorBits);
}
void GrRenderTarget::flagAsNeedingResolve(const GrIRect* rect) { void GrRenderTarget::flagAsNeedingResolve(const GrIRect* rect) {
if (kCanResolve_ResolveType == getResolveType()) { if (kCanResolve_ResolveType == getResolveType()) {
if (NULL != rect) { if (NULL != rect) {
@ -73,4 +63,3 @@ bool GrTexture::readPixels(int left, int top, int width, int height,
width, height, width, height,
config, buffer); config, buffer);
} }

View File

@ -67,7 +67,6 @@ void GrGLSetDefaultGLInterface() {
glGetShaderInfoLog, glGetShaderInfoLog,
glGetShaderiv, glGetShaderiv,
glGetString, glGetString,
NULL, // glGetTexLevelParameteriv
glGetUniformLocation, glGetUniformLocation,
glLineWidth, glLineWidth,
glLinkProgram, glLinkProgram,
@ -123,15 +122,13 @@ void GrGLSetDefaultGLInterface() {
glFramebufferTexture2D, glFramebufferTexture2D,
glGenFramebuffers, glGenFramebuffers,
glGenRenderbuffers, glGenRenderbuffers,
glGetFramebufferAttachmentParameteriv,
glGetRenderbufferParameteriv,
glRenderbufferStorage, glRenderbufferStorage,
NULL, // glRenderbufferStorageMultisampleEXT, NULL, // glRenderbufferStorageMultisampleEXT,
NULL, // glBlitFramebufferEXT, NULL, // glBlitFramebufferEXT,
NULL, // glResolveMultisampleFramebuffer NULL, // glResolveMultisampleFramebuffer
glMapBufferOES, glMapBufferOES,
glUnmapBufferOES, glUnmapBufferOES,
NULL, // glBindFragDataLocationIndexed NULL,
GrGLInterface::kStaticInitEndGuard GrGLInterface::kStaticInitEndGuard
}; };
static bool host_StubGL_initialized = false; static bool host_StubGL_initialized = false;

View File

@ -127,8 +127,6 @@ void GrGLSetDefaultGLInterface() {
gDefaultInterface.fViewport = glViewport; gDefaultInterface.fViewport = glViewport;
gDefaultInterface.fGenFramebuffers = glGenFramebuffers; gDefaultInterface.fGenFramebuffers = glGenFramebuffers;
gDefaultInterface.fGetFramebufferAttachmentParameteriv = glFramebufferAttachmentParameteriv;
gDefaultInterface.fGetRenderbufferParameteriv = glRenderbufferParameteriv;
gDefaultInterface.fBindFramebuffer = glBindFramebuffer; gDefaultInterface.fBindFramebuffer = glBindFramebuffer;
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D; gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D;
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus; gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus;

View File

@ -72,7 +72,6 @@ void GrGLSetDefaultGLInterface() {
gDefaultInterface.fGetShaderInfoLog = glGetShaderInfoLog; gDefaultInterface.fGetShaderInfoLog = glGetShaderInfoLog;
gDefaultInterface.fGetShaderiv = glGetShaderiv; gDefaultInterface.fGetShaderiv = glGetShaderiv;
gDefaultInterface.fGetString = glGetString; gDefaultInterface.fGetString = glGetString;
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
gDefaultInterface.fGenTextures = glGenTextures; gDefaultInterface.fGenTextures = glGenTextures;
gDefaultInterface.fGetUniformLocation = glGetUniformLocation; gDefaultInterface.fGetUniformLocation = glGetUniformLocation;
gDefaultInterface.fLineWidth = glLineWidth; gDefaultInterface.fLineWidth = glLineWidth;
@ -128,8 +127,6 @@ void GrGLSetDefaultGLInterface() {
#if GL_ARB_framebuffer_object #if GL_ARB_framebuffer_object
gDefaultInterface.fGenFramebuffers = glGenFramebuffers; gDefaultInterface.fGenFramebuffers = glGenFramebuffers;
gDefaultInterface.fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv;
gDefaultInterface.fGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
gDefaultInterface.fBindFramebuffer = glBindFramebuffer; gDefaultInterface.fBindFramebuffer = glBindFramebuffer;
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D; gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D;
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus; gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus;
@ -144,8 +141,6 @@ void GrGLSetDefaultGLInterface() {
gDefaultInterface.fBlitFramebuffer = glBlitFramebuffer; gDefaultInterface.fBlitFramebuffer = glBlitFramebuffer;
#elif GL_EXT_framebuffer_object #elif GL_EXT_framebuffer_object
gDefaultInterface.fGenFramebuffers = glGenFramebuffersEXT; gDefaultInterface.fGenFramebuffers = glGenFramebuffersEXT;
gDefaultInterface.fGetFramebufferAttachmentivParameter = glGetFramebufferAttachmentParameterivEXT;
gDefaultInterface.fGLGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
gDefaultInterface.fBindFramebuffer = glBindFramebufferEXT; gDefaultInterface.fBindFramebuffer = glBindFramebufferEXT;
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2DEXT; gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2DEXT;
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatusEXT; gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatusEXT;

View File

@ -86,7 +86,6 @@ void GrGLSetDefaultGLInterface() {
GR_GL_GET_PROC(GetShaderInfoLog); GR_GL_GET_PROC(GetShaderInfoLog);
GR_GL_GET_PROC(GetShaderiv); GR_GL_GET_PROC(GetShaderiv);
gDefaultInterface.fGetString = glGetString; gDefaultInterface.fGetString = glGetString;
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
gDefaultInterface.fGenTextures = glGenTextures; gDefaultInterface.fGenTextures = glGenTextures;
GR_GL_GET_PROC(GetUniformLocation); GR_GL_GET_PROC(GetUniformLocation);
gDefaultInterface.fLineWidth = glLineWidth; gDefaultInterface.fLineWidth = glLineWidth;
@ -143,8 +142,6 @@ void GrGLSetDefaultGLInterface() {
if (major >= 3 || has_gl_extension_from_string( if (major >= 3 || has_gl_extension_from_string(
"GL_ARB_framebuffer_object", extString)) { "GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers); GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
GR_GL_GET_PROC(BindFramebuffer); GR_GL_GET_PROC(BindFramebuffer);
GR_GL_GET_PROC(FramebufferTexture2D); GR_GL_GET_PROC(FramebufferTexture2D);
GR_GL_GET_PROC(CheckFramebufferStatus); GR_GL_GET_PROC(CheckFramebufferStatus);
@ -159,8 +156,6 @@ void GrGLSetDefaultGLInterface() {
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
extString)) { extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT); GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT); GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT); GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);

View File

@ -88,7 +88,6 @@ void GrGLSetDefaultGLInterface() {
GR_GL_GET_PROC(GetShaderInfoLog); GR_GL_GET_PROC(GetShaderInfoLog);
GR_GL_GET_PROC(GetShaderiv); GR_GL_GET_PROC(GetShaderiv);
gDefaultInterface.fGetString = glGetString; gDefaultInterface.fGetString = glGetString;
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
gDefaultInterface.fGenTextures = glGenTextures; gDefaultInterface.fGenTextures = glGenTextures;
GR_GL_GET_PROC(GetUniformLocation); GR_GL_GET_PROC(GetUniformLocation);
gDefaultInterface.fLineWidth = glLineWidth; gDefaultInterface.fLineWidth = glLineWidth;
@ -145,8 +144,6 @@ void GrGLSetDefaultGLInterface() {
if (major >= 3 || has_gl_extension_from_string( if (major >= 3 || has_gl_extension_from_string(
"GL_ARB_framebuffer_object", extString)) { "GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers); GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
GR_GL_GET_PROC(BindFramebuffer); GR_GL_GET_PROC(BindFramebuffer);
GR_GL_GET_PROC(FramebufferTexture2D); GR_GL_GET_PROC(FramebufferTexture2D);
GR_GL_GET_PROC(CheckFramebufferStatus); GR_GL_GET_PROC(CheckFramebufferStatus);
@ -161,8 +158,6 @@ void GrGLSetDefaultGLInterface() {
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
extString)) { extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT); GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT); GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT); GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);

View File

@ -72,7 +72,6 @@ void GrGLSetDefaultGLInterface() {
gDefaultInterface.fGetError = glGetError; gDefaultInterface.fGetError = glGetError;
gDefaultInterface.fGetIntegerv = glGetIntegerv; gDefaultInterface.fGetIntegerv = glGetIntegerv;
gDefaultInterface.fGetString = glGetString; gDefaultInterface.fGetString = glGetString;
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
gDefaultInterface.fLineWidth = glLineWidth; gDefaultInterface.fLineWidth = glLineWidth;
gDefaultInterface.fLoadMatrixf = glLoadMatrixf; gDefaultInterface.fLoadMatrixf = glLoadMatrixf;
gDefaultInterface.fMatrixMode = glMatrixMode; gDefaultInterface.fMatrixMode = glMatrixMode;
@ -150,8 +149,6 @@ void GrGLSetDefaultGLInterface() {
// GL_ARB_framebuffer_object doesn't use ARB suffix.) // GL_ARB_framebuffer_object doesn't use ARB suffix.)
if (major >= 3 || has_gl_extension_from_string("GL_ARB_framebuffer_object", extString)) { if (major >= 3 || has_gl_extension_from_string("GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers); GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
GR_GL_GET_PROC(BindFramebuffer); GR_GL_GET_PROC(BindFramebuffer);
GR_GL_GET_PROC(FramebufferTexture2D); GR_GL_GET_PROC(FramebufferTexture2D);
GR_GL_GET_PROC(CheckFramebufferStatus); GR_GL_GET_PROC(CheckFramebufferStatus);
@ -165,8 +162,6 @@ void GrGLSetDefaultGLInterface() {
GR_GL_GET_PROC(BlitFramebuffer); GR_GL_GET_PROC(BlitFramebuffer);
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", extString)) { } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT); GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT); GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT); GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);