Add sizeInBytes to GrResource, make GrRenderTarget aware of its pixel config
Review URL: http://codereview.appspot.com/4802058/ git-svn-id: http://skia.googlecode.com/svn/trunk@1951 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
4067d7d5cd
commit
aab1fd921c
@ -202,6 +202,24 @@ extern void GrGLRestoreResetRowLength();
|
||||
GR_GL(GetIntegerv(e, p)); \
|
||||
} 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
|
||||
|
@ -432,7 +432,7 @@
|
||||
#define GR_GL_TEXTURE_ENV 0x2300
|
||||
#define GR_GL_TEXTURE_ENV_MODE 0x2200
|
||||
#define GR_GL_TEXTURE_1D 0x0DE0
|
||||
#define GR_GL_TEXTURE_2D 0x0DE1
|
||||
/* GL_TEXTURE_2D */
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
/* GL_TEXTURE_MAG_FILTER */
|
||||
@ -452,6 +452,7 @@
|
||||
#define GR_GL_TEXTURE_ALPHA_SIZE 0x805F
|
||||
#define GR_GL_TEXTURE_LUMINANCE_SIZE 0x8060
|
||||
#define GR_GL_TEXTURE_INTENSITY_SIZE 0x8061
|
||||
#define GR_GL_TEXTURE_INTERNAL_FORMAT 0x1003
|
||||
/* GL_NEAREST_MIPMAP_NEAREST */
|
||||
/* GL_NEAREST_MIPMAP_LINEAR */
|
||||
/* GL_LINEAR_MIPMAP_NEAREST */
|
||||
@ -605,6 +606,11 @@
|
||||
#define GR_GL_RGB5_A1 0x8057
|
||||
#define GR_GL_RGB565 0x8D62
|
||||
#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_STENCIL_INDEX 0x1901
|
||||
#define GR_GL_STENCIL_INDEX4 0x8D47
|
||||
@ -629,6 +635,13 @@
|
||||
#define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#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_DEPTH_ATTACHMENT 0x8D00
|
||||
|
@ -133,6 +133,7 @@ extern "C" {
|
||||
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 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 GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width);
|
||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program);
|
||||
@ -190,6 +191,8 @@ 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 *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers);
|
||||
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);
|
||||
|
||||
// Multisampling Extension Functions
|
||||
@ -283,6 +286,7 @@ struct GrGLInterface {
|
||||
GrGLGetShaderInfoLogProc fGetShaderInfoLog;
|
||||
GrGLGetShaderivProc fGetShaderiv;
|
||||
GrGLGetStringProc fGetString;
|
||||
GrGLGetTexLevelParameteriv fGetTexLevelParameteriv;
|
||||
GrGLGetUniformLocationProc fGetUniformLocation;
|
||||
GrGLLineWidthProc fLineWidth;
|
||||
GrGLLinkProgramProc fLinkProgram;
|
||||
@ -340,6 +344,8 @@ struct GrGLInterface {
|
||||
GrGLFramebufferTexture2DProc fFramebufferTexture2D;
|
||||
GrGLGenFramebuffersProc fGenFramebuffers;
|
||||
GrGLGenRenderbuffersProc fGenRenderbuffers;
|
||||
GrGLGetFramebufferAttachmentParameterivProc fGetFramebufferAttachmentParameteriv;
|
||||
GrGLGetRenderbufferParameterivProc fGetRenderbufferParameteriv;
|
||||
GrGLRenderbufferStorageProc fRenderbufferStorage;
|
||||
|
||||
// Multisampling Extension Functions
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
GrGLRenderTarget(GrGpuGL* gpu,
|
||||
const GLRenderTargetIDs& ids,
|
||||
GrGLTexID* texID,
|
||||
GrPixelConfig config,
|
||||
GrGLuint stencilBits,
|
||||
bool isMultisampled,
|
||||
const GrGLIRect& fViewport,
|
||||
@ -177,7 +178,7 @@ public:
|
||||
int height,
|
||||
const void* srcData,
|
||||
size_t rowBytes);
|
||||
virtual intptr_t getTextureHandle();
|
||||
virtual intptr_t getTextureHandle() const;
|
||||
|
||||
const TexParams& getTexParams() const { return fTexParams; }
|
||||
void setTexParams(const TexParams& texParams) { fTexParams = texParams; }
|
||||
|
@ -26,12 +26,6 @@ class GrGpu;
|
||||
*/
|
||||
class GrGeometryBuffer : public GrResource {
|
||||
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
|
||||
@ -94,6 +88,10 @@ public:
|
||||
virtual bool updateSubData(const void* src,
|
||||
size_t srcSizeInBytes,
|
||||
size_t offset) = 0;
|
||||
|
||||
// GrResource overrides
|
||||
virtual size_t sizeInBytes() const { return fSizeInBytes; }
|
||||
|
||||
protected:
|
||||
GrGeometryBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
|
||||
: INHERITED(gpu)
|
||||
|
@ -27,7 +27,9 @@ public:
|
||||
* from the index buffer (using kTriangles_PrimitiveType).
|
||||
* @return the maximum number of quads using full size of index buffer.
|
||||
*/
|
||||
int maxQuads() const { return size() / (sizeof(uint16_t) * 6); }
|
||||
int maxQuads() const {
|
||||
return this->sizeInBytes() / (sizeof(uint16_t) * 6);
|
||||
}
|
||||
protected:
|
||||
GrIndexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
|
||||
: INHERITED(gpu, sizeInBytes, dynamic) {}
|
||||
|
@ -54,6 +54,14 @@ public:
|
||||
*/
|
||||
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:
|
||||
|
||||
virtual void onRelease() = 0;
|
||||
|
@ -43,6 +43,13 @@ public:
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -105,6 +112,9 @@ public:
|
||||
*/
|
||||
const GrIRect& getResolveRect() const { return fResolveRect; }
|
||||
|
||||
// GrResource overrides
|
||||
virtual size_t sizeInBytes() const;
|
||||
|
||||
/**
|
||||
* Reads a rectangle of pixels from the render target.
|
||||
* @param left left edge of the rectangle to read (inclusive)
|
||||
@ -135,12 +145,14 @@ protected:
|
||||
GrTexture* texture,
|
||||
int width,
|
||||
int height,
|
||||
GrPixelConfig config,
|
||||
int stencilBits,
|
||||
bool isMultisampled)
|
||||
: INHERITED(gpu)
|
||||
, fTexture(texture)
|
||||
, fWidth(width)
|
||||
, fHeight(height)
|
||||
, fConfig(config)
|
||||
, fStencilBits(stencilBits)
|
||||
, fIsMultisampled(isMultisampled)
|
||||
{
|
||||
@ -162,6 +174,7 @@ private:
|
||||
GrTexture* fTexture; // not ref'ed
|
||||
int fWidth;
|
||||
int fHeight;
|
||||
GrPixelConfig fConfig;
|
||||
int fStencilBits;
|
||||
bool fIsMultisampled;
|
||||
GrIRect fResolveRect;
|
||||
@ -208,7 +221,7 @@ public:
|
||||
/**
|
||||
* Approximate number of bytes used by the texture
|
||||
*/
|
||||
size_t sizeInBytes() const {
|
||||
virtual size_t sizeInBytes() const {
|
||||
return fWidth * fHeight * GrBytesPerPixel(fConfig);
|
||||
}
|
||||
|
||||
@ -273,7 +286,7 @@ public:
|
||||
* Return the native ID or handle to the texture, depending on the
|
||||
* platform. e.g. on opengl, return the texture ID.
|
||||
*/
|
||||
virtual intptr_t getTextureHandle() = 0;
|
||||
virtual intptr_t getTextureHandle() const = 0;
|
||||
|
||||
#if GR_DEBUG
|
||||
void validate() const {
|
||||
|
@ -111,7 +111,7 @@ void GrBufferAllocPool::unlock() {
|
||||
if (block.fBuffer->isLocked()) {
|
||||
block.fBuffer->unlock();
|
||||
} else {
|
||||
size_t flushSize = block.fBuffer->size() - block.fBytesFree;
|
||||
size_t flushSize = block.fBuffer->sizeInBytes() - block.fBytesFree;
|
||||
flushCpuData(fBlocks.back().fBuffer, flushSize);
|
||||
}
|
||||
fBufferPtr = NULL;
|
||||
@ -137,7 +137,7 @@ void GrBufferAllocPool::validate(bool unusedBlockAllowed) const {
|
||||
GrAssert(!fBlocks[i].fBuffer->isLocked());
|
||||
}
|
||||
for (int i = 0; i < fBlocks.count(); ++i) {
|
||||
size_t bytes = fBlocks[i].fBuffer->size() - fBlocks[i].fBytesFree;
|
||||
size_t bytes = fBlocks[i].fBuffer->sizeInBytes() - fBlocks[i].fBytesFree;
|
||||
bytesInUse += bytes;
|
||||
GrAssert(bytes || unusedBlockAllowed);
|
||||
}
|
||||
@ -163,7 +163,7 @@ void* GrBufferAllocPool::makeSpace(size_t size,
|
||||
|
||||
if (NULL != fBufferPtr) {
|
||||
BufferBlock& back = fBlocks.back();
|
||||
size_t usedBytes = back.fBuffer->size() - back.fBytesFree;
|
||||
size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree;
|
||||
size_t pad = GrSizeAlignUpPad(usedBytes,
|
||||
alignment);
|
||||
if ((size + pad) <= back.fBytesFree) {
|
||||
@ -199,7 +199,7 @@ int GrBufferAllocPool::currentBufferItems(size_t itemSize) const {
|
||||
VALIDATE();
|
||||
if (NULL != fBufferPtr) {
|
||||
const BufferBlock& back = fBlocks.back();
|
||||
size_t usedBytes = back.fBuffer->size() - back.fBytesFree;
|
||||
size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree;
|
||||
size_t pad = GrSizeAlignUpPad(usedBytes, itemSize);
|
||||
return (back.fBytesFree - pad) / itemSize;
|
||||
} 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
|
||||
GrAssert(!fBlocks.empty());
|
||||
BufferBlock& block = fBlocks.back();
|
||||
size_t bytesUsed = block.fBuffer->size() - block.fBytesFree;
|
||||
size_t bytesUsed = block.fBuffer->sizeInBytes() - block.fBytesFree;
|
||||
if (bytes >= bytesUsed) {
|
||||
bytes -= bytesUsed;
|
||||
fBytesInUse -= bytesUsed;
|
||||
@ -271,7 +271,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) {
|
||||
prev.fBuffer->unlock();
|
||||
} else {
|
||||
flushCpuData(prev.fBuffer,
|
||||
prev.fBuffer->size() - prev.fBytesFree);
|
||||
prev.fBuffer->sizeInBytes() - prev.fBytesFree);
|
||||
}
|
||||
fBufferPtr = NULL;
|
||||
}
|
||||
@ -317,7 +317,7 @@ void GrBufferAllocPool::flushCpuData(GrGeometryBuffer* buffer,
|
||||
GrAssert(NULL != buffer);
|
||||
GrAssert(!buffer->isLocked());
|
||||
GrAssert(fCpuData.get() == fBufferPtr);
|
||||
GrAssert(flushSize <= buffer->size());
|
||||
GrAssert(flushSize <= buffer->sizeInBytes());
|
||||
|
||||
bool updated = false;
|
||||
if (fGpu->supportsBufferLocking() &&
|
||||
|
@ -641,7 +641,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type, int startVertex,
|
||||
maxValidVertex = geoSrc.fVertexCount;
|
||||
break;
|
||||
case kBuffer_GeometrySrcType:
|
||||
maxValidVertex = geoSrc.fVertexBuffer->size() /
|
||||
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() /
|
||||
VertexSize(geoSrc.fVertexLayout);
|
||||
break;
|
||||
}
|
||||
@ -658,7 +658,7 @@ void GrDrawTarget::drawIndexed(GrPrimitiveType type, int startVertex,
|
||||
maxValidIndex = geoSrc.fIndexCount;
|
||||
break;
|
||||
case kBuffer_GeometrySrcType:
|
||||
maxValidIndex = geoSrc.fIndexBuffer->size() / sizeof(uint16_t);
|
||||
maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / sizeof(uint16_t);
|
||||
break;
|
||||
}
|
||||
if (maxIndex > maxValidIndex) {
|
||||
@ -685,7 +685,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
|
||||
maxValidVertex = geoSrc.fVertexCount;
|
||||
break;
|
||||
case kBuffer_GeometrySrcType:
|
||||
maxValidVertex = geoSrc.fVertexBuffer->size() /
|
||||
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() /
|
||||
VertexSize(geoSrc.fVertexLayout);
|
||||
break;
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ void* GrGLIndexBuffer::lock() {
|
||||
if (GPUGL->supportsBufferLocking()) {
|
||||
this->bind();
|
||||
// Let driver know it can discard the old data
|
||||
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL,
|
||||
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), NULL,
|
||||
this->dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
fLockPtr = GR_GL(MapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, GR_GL_WRITE_ONLY));
|
||||
|
||||
return fLockPtr;
|
||||
@ -98,16 +98,16 @@ bool GrGLIndexBuffer::isLocked() const {
|
||||
bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
|
||||
GrAssert(fBufferID);
|
||||
GrAssert(!isLocked());
|
||||
if (srcSizeInBytes > size()) {
|
||||
if (srcSizeInBytes > this->sizeInBytes()) {
|
||||
return false;
|
||||
}
|
||||
this->bind();
|
||||
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
|
||||
if (size() == srcSizeInBytes) {
|
||||
if (this->sizeInBytes() == srcSizeInBytes) {
|
||||
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage));
|
||||
} else {
|
||||
#if GR_GL_USE_BUFFER_DATA_NULL_HINT
|
||||
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL, usage));
|
||||
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), NULL, usage));
|
||||
#endif
|
||||
GR_GL(BufferSubData(GR_GL_ELEMENT_ARRAY_BUFFER, 0, srcSizeInBytes, src));
|
||||
}
|
||||
@ -119,7 +119,7 @@ bool GrGLIndexBuffer::updateSubData(const void* src,
|
||||
size_t offset) {
|
||||
GrAssert(fBufferID);
|
||||
GrAssert(!isLocked());
|
||||
if (srcSizeInBytes + offset > size()) {
|
||||
if (srcSizeInBytes + offset > this->sizeInBytes()) {
|
||||
return false;
|
||||
}
|
||||
this->bind();
|
||||
|
@ -236,6 +236,8 @@ bool GrGLInterface::validate(GrEngine engine) const {
|
||||
NULL == fDeleteRenderbuffers ||
|
||||
NULL == fFramebufferRenderbuffer ||
|
||||
NULL == fFramebufferTexture2D ||
|
||||
NULL == fGetFramebufferAttachmentParameteriv ||
|
||||
NULL == fGetRenderbufferParameteriv ||
|
||||
NULL == fGenFramebuffers ||
|
||||
NULL == fGenRenderbuffers ||
|
||||
NULL == fRenderbufferStorage) {
|
||||
@ -310,9 +312,11 @@ bool GrGLInterface::validate(GrEngine engine) const {
|
||||
|
||||
// part of desktop GL
|
||||
if (kDesktop_GrGLBinding == fBindingsExported &&
|
||||
NULL == fLineWidth) {
|
||||
(NULL == fLineWidth ||
|
||||
NULL == fGetTexLevelParameteriv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// FBO MSAA
|
||||
if (kDesktop_GrGLBinding == fBindingsExported) {
|
||||
// GL 3.0 and the ARB extension have multisample + blit
|
||||
|
@ -23,12 +23,14 @@
|
||||
GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
|
||||
const GLRenderTargetIDs& ids,
|
||||
GrGLTexID* texID,
|
||||
GrPixelConfig config,
|
||||
GrGLuint stencilBits,
|
||||
bool isMultisampled,
|
||||
const GrGLIRect& viewport,
|
||||
GrGLTexture* texture)
|
||||
: INHERITED(gpu, texture, viewport.fWidth,
|
||||
viewport.fHeight, stencilBits, isMultisampled) {
|
||||
viewport.fHeight, config,
|
||||
stencilBits, isMultisampled) {
|
||||
fRTFBOID = ids.fRTFBOID;
|
||||
fTexFBOID = ids.fTexFBOID;
|
||||
fStencilRenderbufferID = ids.fStencilRenderbufferID;
|
||||
@ -131,6 +133,7 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
|
||||
vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight;
|
||||
|
||||
fRenderTarget = new GrGLRenderTarget(gpu, rtIDs, fTexIDObj,
|
||||
textureDesc.fFormat,
|
||||
textureDesc.fStencilBits,
|
||||
rtIDs.fRTFBOID != rtIDs.fTexFBOID,
|
||||
vp, this);
|
||||
@ -226,7 +229,7 @@ void GrGLTexture::uploadTextureData(int x,
|
||||
}
|
||||
}
|
||||
|
||||
intptr_t GrGLTexture::getTextureHandle() {
|
||||
intptr_t GrGLTexture::getTextureHandle() const {
|
||||
return fTexIDObj->id();
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ void* GrGLVertexBuffer::lock() {
|
||||
if (GPUGL->supportsBufferLocking()) {
|
||||
this->bind();
|
||||
// Let driver know it can discard the old data
|
||||
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL,
|
||||
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL,
|
||||
this->dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
fLockPtr = GR_GL(MapBuffer(GR_GL_ARRAY_BUFFER, GR_GL_WRITE_ONLY));
|
||||
return fLockPtr;
|
||||
}
|
||||
@ -97,16 +97,16 @@ bool GrGLVertexBuffer::isLocked() const {
|
||||
bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
|
||||
GrAssert(fBufferID);
|
||||
GrAssert(!isLocked());
|
||||
if (srcSizeInBytes > size()) {
|
||||
if (srcSizeInBytes > this->sizeInBytes()) {
|
||||
return false;
|
||||
}
|
||||
this->bind();
|
||||
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
|
||||
if (size() == srcSizeInBytes) {
|
||||
if (this->sizeInBytes() == srcSizeInBytes) {
|
||||
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, srcSizeInBytes, src, usage));
|
||||
} else {
|
||||
#if GR_GL_USE_BUFFER_DATA_NULL_HINT
|
||||
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL, usage));
|
||||
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL, usage));
|
||||
#endif
|
||||
GR_GL(BufferSubData(GR_GL_ARRAY_BUFFER, 0, srcSizeInBytes, src));
|
||||
}
|
||||
@ -118,7 +118,7 @@ bool GrGLVertexBuffer::updateSubData(const void* src,
|
||||
size_t offset) {
|
||||
GrAssert(fBufferID);
|
||||
GrAssert(!isLocked());
|
||||
if (srcSizeInBytes + offset > size()) {
|
||||
if (srcSizeInBytes + offset > this->sizeInBytes()) {
|
||||
return false;
|
||||
}
|
||||
this->bind();
|
||||
|
@ -658,12 +658,152 @@ GrResource* GrGpuGL::onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc)
|
||||
viewport.fWidth = desc.fWidth;
|
||||
viewport.fHeight = desc.fHeight;
|
||||
|
||||
return new GrGLRenderTarget(this, rtIDs, NULL, desc.fStencilBits,
|
||||
kIsMultisampled_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags,
|
||||
viewport, NULL);
|
||||
bool isMSAA = kIsMultisampled_GrPlatformRenderTargetFlagBit &
|
||||
desc.fRenderTargetFlags;
|
||||
|
||||
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() {
|
||||
|
||||
GrGLRenderTarget::GLRenderTargetIDs rtIDs;
|
||||
@ -673,17 +813,29 @@ GrRenderTarget* GrGpuGL::onCreateRenderTargetFrom3DApiState() {
|
||||
rtIDs.fMSColorRenderbufferID = 0;
|
||||
rtIDs.fStencilRenderbufferID = 0;
|
||||
|
||||
bool arbFBO = (GR_GL_SUPPORT_DESKTOP && (fGLVersion > 3.0 ||
|
||||
this->hasExtension("GL_ARB_framebuffer_object")));
|
||||
|
||||
GrGLIRect viewport;
|
||||
viewport.setFromGLViewport();
|
||||
GrGLuint stencilBits;
|
||||
GR_GL_GetIntegerv(GR_GL_STENCIL_BITS, (GrGLint*)&stencilBits);
|
||||
int stencilBits = get_fbo_stencil_bits(arbFBO);
|
||||
|
||||
GrPixelConfig config;
|
||||
GrGLint 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;
|
||||
|
||||
return new GrGLRenderTarget(this, rtIDs, NULL, stencilBits,
|
||||
return new GrGLRenderTarget(this, rtIDs, NULL, config, stencilBits,
|
||||
(samples > 0), viewport, NULL);
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ HAS_ATLAS:
|
||||
NULL);
|
||||
}
|
||||
|
||||
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->size() / (6 * sizeof(uint16_t));
|
||||
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads();
|
||||
if (fMaxVertices < kMinRequestedVerts) {
|
||||
fMaxVertices = kDefaultRequestedVerts;
|
||||
} else if (fMaxVertices > maxQuadVertices) {
|
||||
|
@ -29,6 +29,16 @@ bool GrRenderTarget::readPixels(int left, int top, int width, int height,
|
||||
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) {
|
||||
if (kCanResolve_ResolveType == getResolveType()) {
|
||||
if (NULL != rect) {
|
||||
@ -63,3 +73,4 @@ bool GrTexture::readPixels(int left, int top, int width, int height,
|
||||
width, height,
|
||||
config, buffer);
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ void GrGLSetDefaultGLInterface() {
|
||||
glGetShaderInfoLog,
|
||||
glGetShaderiv,
|
||||
glGetString,
|
||||
NULL, // glGetTexLevelParameteriv
|
||||
glGetUniformLocation,
|
||||
glLineWidth,
|
||||
glLinkProgram,
|
||||
@ -122,13 +123,15 @@ void GrGLSetDefaultGLInterface() {
|
||||
glFramebufferTexture2D,
|
||||
glGenFramebuffers,
|
||||
glGenRenderbuffers,
|
||||
glGetFramebufferAttachmentParameteriv,
|
||||
glGetRenderbufferParameteriv,
|
||||
glRenderbufferStorage,
|
||||
NULL, // glRenderbufferStorageMultisampleEXT,
|
||||
NULL, // glBlitFramebufferEXT,
|
||||
NULL, // glResolveMultisampleFramebuffer
|
||||
glMapBufferOES,
|
||||
glUnmapBufferOES,
|
||||
NULL,
|
||||
NULL, // glBindFragDataLocationIndexed
|
||||
GrGLInterface::kStaticInitEndGuard
|
||||
};
|
||||
static bool host_StubGL_initialized = false;
|
||||
|
@ -127,6 +127,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
gDefaultInterface.fViewport = glViewport;
|
||||
|
||||
gDefaultInterface.fGenFramebuffers = glGenFramebuffers;
|
||||
gDefaultInterface.fGetFramebufferAttachmentParameteriv = glFramebufferAttachmentParameteriv;
|
||||
gDefaultInterface.fGetRenderbufferParameteriv = glRenderbufferParameteriv;
|
||||
gDefaultInterface.fBindFramebuffer = glBindFramebuffer;
|
||||
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D;
|
||||
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus;
|
||||
|
@ -72,6 +72,7 @@ void GrGLSetDefaultGLInterface() {
|
||||
gDefaultInterface.fGetShaderInfoLog = glGetShaderInfoLog;
|
||||
gDefaultInterface.fGetShaderiv = glGetShaderiv;
|
||||
gDefaultInterface.fGetString = glGetString;
|
||||
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
|
||||
gDefaultInterface.fGenTextures = glGenTextures;
|
||||
gDefaultInterface.fGetUniformLocation = glGetUniformLocation;
|
||||
gDefaultInterface.fLineWidth = glLineWidth;
|
||||
@ -127,6 +128,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
|
||||
#if GL_ARB_framebuffer_object
|
||||
gDefaultInterface.fGenFramebuffers = glGenFramebuffers;
|
||||
gDefaultInterface.fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv;
|
||||
gDefaultInterface.fGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
|
||||
gDefaultInterface.fBindFramebuffer = glBindFramebuffer;
|
||||
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2D;
|
||||
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatus;
|
||||
@ -141,6 +144,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
gDefaultInterface.fBlitFramebuffer = glBlitFramebuffer;
|
||||
#elif GL_EXT_framebuffer_object
|
||||
gDefaultInterface.fGenFramebuffers = glGenFramebuffersEXT;
|
||||
gDefaultInterface.fGetFramebufferAttachmentivParameter = glGetFramebufferAttachmentParameterivEXT;
|
||||
gDefaultInterface.fGLGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
|
||||
gDefaultInterface.fBindFramebuffer = glBindFramebufferEXT;
|
||||
gDefaultInterface.fFramebufferTexture2D = glFramebufferTexture2DEXT;
|
||||
gDefaultInterface.fCheckFramebufferStatus = glCheckFramebufferStatusEXT;
|
||||
|
@ -86,6 +86,7 @@ void GrGLSetDefaultGLInterface() {
|
||||
GR_GL_GET_PROC(GetShaderInfoLog);
|
||||
GR_GL_GET_PROC(GetShaderiv);
|
||||
gDefaultInterface.fGetString = glGetString;
|
||||
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
|
||||
gDefaultInterface.fGenTextures = glGenTextures;
|
||||
GR_GL_GET_PROC(GetUniformLocation);
|
||||
gDefaultInterface.fLineWidth = glLineWidth;
|
||||
@ -142,6 +143,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
if (major >= 3 || has_gl_extension_from_string(
|
||||
"GL_ARB_framebuffer_object", extString)) {
|
||||
GR_GL_GET_PROC(GenFramebuffers);
|
||||
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GR_GL_GET_PROC(GetRenderbufferParameteriv);
|
||||
GR_GL_GET_PROC(BindFramebuffer);
|
||||
GR_GL_GET_PROC(FramebufferTexture2D);
|
||||
GR_GL_GET_PROC(CheckFramebufferStatus);
|
||||
@ -156,6 +159,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
|
||||
extString)) {
|
||||
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(FramebufferTexture2D, EXT);
|
||||
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
|
||||
|
@ -88,6 +88,7 @@ void GrGLSetDefaultGLInterface() {
|
||||
GR_GL_GET_PROC(GetShaderInfoLog);
|
||||
GR_GL_GET_PROC(GetShaderiv);
|
||||
gDefaultInterface.fGetString = glGetString;
|
||||
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
|
||||
gDefaultInterface.fGenTextures = glGenTextures;
|
||||
GR_GL_GET_PROC(GetUniformLocation);
|
||||
gDefaultInterface.fLineWidth = glLineWidth;
|
||||
@ -144,6 +145,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
if (major >= 3 || has_gl_extension_from_string(
|
||||
"GL_ARB_framebuffer_object", extString)) {
|
||||
GR_GL_GET_PROC(GenFramebuffers);
|
||||
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GR_GL_GET_PROC(GetRenderbufferParameteriv);
|
||||
GR_GL_GET_PROC(BindFramebuffer);
|
||||
GR_GL_GET_PROC(FramebufferTexture2D);
|
||||
GR_GL_GET_PROC(CheckFramebufferStatus);
|
||||
@ -158,6 +161,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
|
||||
extString)) {
|
||||
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(FramebufferTexture2D, EXT);
|
||||
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
|
||||
|
@ -72,6 +72,7 @@ void GrGLSetDefaultGLInterface() {
|
||||
gDefaultInterface.fGetError = glGetError;
|
||||
gDefaultInterface.fGetIntegerv = glGetIntegerv;
|
||||
gDefaultInterface.fGetString = glGetString;
|
||||
gDefaultInterface.fGetTexLevelParameteriv = glGetTexLevelParameteriv;
|
||||
gDefaultInterface.fLineWidth = glLineWidth;
|
||||
gDefaultInterface.fLoadMatrixf = glLoadMatrixf;
|
||||
gDefaultInterface.fMatrixMode = glMatrixMode;
|
||||
@ -149,6 +150,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
|
||||
if (major >= 3 || has_gl_extension_from_string("GL_ARB_framebuffer_object", extString)) {
|
||||
GR_GL_GET_PROC(GenFramebuffers);
|
||||
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GR_GL_GET_PROC(GetRenderbufferParameteriv);
|
||||
GR_GL_GET_PROC(BindFramebuffer);
|
||||
GR_GL_GET_PROC(FramebufferTexture2D);
|
||||
GR_GL_GET_PROC(CheckFramebufferStatus);
|
||||
@ -162,6 +165,8 @@ void GrGLSetDefaultGLInterface() {
|
||||
GR_GL_GET_PROC(BlitFramebuffer);
|
||||
} else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", extString)) {
|
||||
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(FramebufferTexture2D, EXT);
|
||||
GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
|
||||
|
Loading…
Reference in New Issue
Block a user