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)); \
|
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
|
||||||
|
@ -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
|
||||||
#define GR_GL_TEXTURE_2D 0x0DE1
|
/* GL_TEXTURE_2D */
|
||||||
/* 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,10 +452,11 @@
|
|||||||
#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
|
||||||
/* GL_NEAREST_MIPMAP_NEAREST */
|
#define GR_GL_TEXTURE_INTERNAL_FORMAT 0x1003
|
||||||
/* GL_NEAREST_MIPMAP_LINEAR */
|
/* GL_NEAREST_MIPMAP_NEAREST */
|
||||||
/* GL_LINEAR_MIPMAP_NEAREST */
|
/* GL_NEAREST_MIPMAP_LINEAR */
|
||||||
/* GL_LINEAR_MIPMAP_LINEAR */
|
/* GL_LINEAR_MIPMAP_NEAREST */
|
||||||
|
/* 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
|
||||||
@ -605,6 +606,11 @@
|
|||||||
#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
|
||||||
@ -629,6 +635,13 @@
|
|||||||
#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
|
||||||
|
@ -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 *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);
|
||||||
@ -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 *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
|
||||||
@ -283,6 +286,7 @@ 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;
|
||||||
@ -340,6 +344,8 @@ 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
|
||||||
|
@ -67,6 +67,7 @@ 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,
|
||||||
@ -177,7 +178,7 @@ public:
|
|||||||
int height,
|
int height,
|
||||||
const void* srcData,
|
const void* srcData,
|
||||||
size_t rowBytes);
|
size_t rowBytes);
|
||||||
virtual intptr_t getTextureHandle();
|
virtual intptr_t getTextureHandle() const;
|
||||||
|
|
||||||
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; }
|
||||||
|
@ -26,12 +26,6 @@ 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
|
||||||
@ -94,6 +88,10 @@ 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)
|
||||||
|
@ -27,7 +27,9 @@ 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 { return size() / (sizeof(uint16_t) * 6); }
|
int maxQuads() const {
|
||||||
|
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) {}
|
||||||
|
@ -54,6 +54,14 @@ 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;
|
||||||
|
@ -43,6 +43,13 @@ 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
|
||||||
*/
|
*/
|
||||||
@ -105,6 +112,9 @@ 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)
|
||||||
@ -135,12 +145,14 @@ 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)
|
||||||
{
|
{
|
||||||
@ -160,11 +172,12 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
GrTexture* fTexture; // not ref'ed
|
GrTexture* fTexture; // not ref'ed
|
||||||
int fWidth;
|
int fWidth;
|
||||||
int fHeight;
|
int fHeight;
|
||||||
int fStencilBits;
|
GrPixelConfig fConfig;
|
||||||
bool fIsMultisampled;
|
int fStencilBits;
|
||||||
GrIRect fResolveRect;
|
bool fIsMultisampled;
|
||||||
|
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.
|
||||||
@ -208,7 +221,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Approximate number of bytes used by the texture
|
* Approximate number of bytes used by the texture
|
||||||
*/
|
*/
|
||||||
size_t sizeInBytes() const {
|
virtual size_t sizeInBytes() const {
|
||||||
return fWidth * fHeight * GrBytesPerPixel(fConfig);
|
return fWidth * fHeight * GrBytesPerPixel(fConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +286,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() = 0;
|
virtual intptr_t getTextureHandle() const = 0;
|
||||||
|
|
||||||
#if GR_DEBUG
|
#if GR_DEBUG
|
||||||
void validate() const {
|
void validate() const {
|
||||||
@ -301,7 +314,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();
|
||||||
|
@ -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->size() - block.fBytesFree;
|
size_t flushSize = block.fBuffer->sizeInBytes() - 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->size() - fBlocks[i].fBytesFree;
|
size_t bytes = fBlocks[i].fBuffer->sizeInBytes() - 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->size() - back.fBytesFree;
|
size_t usedBytes = back.fBuffer->sizeInBytes() - 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->size() - back.fBytesFree;
|
size_t usedBytes = back.fBuffer->sizeInBytes() - 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->size() - block.fBytesFree;
|
size_t bytesUsed = block.fBuffer->sizeInBytes() - 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->size() - prev.fBytesFree);
|
prev.fBuffer->sizeInBytes() - 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->size());
|
GrAssert(flushSize <= buffer->sizeInBytes());
|
||||||
|
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
if (fGpu->supportsBufferLocking() &&
|
if (fGpu->supportsBufferLocking() &&
|
||||||
|
@ -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->size() /
|
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() /
|
||||||
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->size() / sizeof(uint16_t);
|
maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / 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->size() /
|
maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() /
|
||||||
VertexSize(geoSrc.fVertexLayout);
|
VertexSize(geoSrc.fVertexLayout);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -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, size(), NULL,
|
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), NULL,
|
||||||
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
this->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 > size()) {
|
if (srcSizeInBytes > this->sizeInBytes()) {
|
||||||
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 (size() == srcSizeInBytes) {
|
if (this->sizeInBytes() == 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, size(), NULL, usage));
|
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, this->sizeInBytes(), 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 > size()) {
|
if (srcSizeInBytes + offset > this->sizeInBytes()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->bind();
|
this->bind();
|
||||||
|
@ -236,6 +236,8 @@ 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) {
|
||||||
@ -310,9 +312,11 @@ 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
|
||||||
|
@ -23,12 +23,14 @@
|
|||||||
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, stencilBits, isMultisampled) {
|
viewport.fHeight, config,
|
||||||
|
stencilBits, isMultisampled) {
|
||||||
fRTFBOID = ids.fRTFBOID;
|
fRTFBOID = ids.fRTFBOID;
|
||||||
fTexFBOID = ids.fTexFBOID;
|
fTexFBOID = ids.fTexFBOID;
|
||||||
fStencilRenderbufferID = ids.fStencilRenderbufferID;
|
fStencilRenderbufferID = ids.fStencilRenderbufferID;
|
||||||
@ -131,6 +133,7 @@ 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);
|
||||||
@ -226,7 +229,7 @@ void GrGLTexture::uploadTextureData(int x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t GrGLTexture::getTextureHandle() {
|
intptr_t GrGLTexture::getTextureHandle() const {
|
||||||
return fTexIDObj->id();
|
return fTexIDObj->id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, size(), NULL,
|
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL,
|
||||||
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
this->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 > size()) {
|
if (srcSizeInBytes > this->sizeInBytes()) {
|
||||||
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 (size() == srcSizeInBytes) {
|
if (this->sizeInBytes() == 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, size(), NULL, usage));
|
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), 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 > size()) {
|
if (srcSizeInBytes + offset > this->sizeInBytes()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->bind();
|
this->bind();
|
||||||
|
@ -658,12 +658,152 @@ GrResource* GrGpuGL::onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc)
|
|||||||
viewport.fWidth = desc.fWidth;
|
viewport.fWidth = desc.fWidth;
|
||||||
viewport.fHeight = desc.fHeight;
|
viewport.fHeight = desc.fHeight;
|
||||||
|
|
||||||
return new GrGLRenderTarget(this, rtIDs, NULL, desc.fStencilBits,
|
bool isMSAA = kIsMultisampled_GrPlatformRenderTargetFlagBit &
|
||||||
kIsMultisampled_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags,
|
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;
|
||||||
@ -673,17 +813,29 @@ 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();
|
||||||
GrGLuint stencilBits;
|
int stencilBits = get_fbo_stencil_bits(arbFBO);
|
||||||
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, stencilBits,
|
return new GrGLRenderTarget(this, rtIDs, NULL, config, stencilBits,
|
||||||
(samples > 0), viewport, NULL);
|
(samples > 0), viewport, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ HAS_ATLAS:
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->size() / (6 * sizeof(uint16_t));
|
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads();
|
||||||
if (fMaxVertices < kMinRequestedVerts) {
|
if (fMaxVertices < kMinRequestedVerts) {
|
||||||
fMaxVertices = kDefaultRequestedVerts;
|
fMaxVertices = kDefaultRequestedVerts;
|
||||||
} else if (fMaxVertices > maxQuadVertices) {
|
} else if (fMaxVertices > maxQuadVertices) {
|
||||||
|
@ -29,6 +29,16 @@ 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) {
|
||||||
@ -63,3 +73,4 @@ bool GrTexture::readPixels(int left, int top, int width, int height,
|
|||||||
width, height,
|
width, height,
|
||||||
config, buffer);
|
config, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ void GrGLSetDefaultGLInterface() {
|
|||||||
glGetShaderInfoLog,
|
glGetShaderInfoLog,
|
||||||
glGetShaderiv,
|
glGetShaderiv,
|
||||||
glGetString,
|
glGetString,
|
||||||
|
NULL, // glGetTexLevelParameteriv
|
||||||
glGetUniformLocation,
|
glGetUniformLocation,
|
||||||
glLineWidth,
|
glLineWidth,
|
||||||
glLinkProgram,
|
glLinkProgram,
|
||||||
@ -122,13 +123,15 @@ 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,
|
NULL, // glBindFragDataLocationIndexed
|
||||||
GrGLInterface::kStaticInitEndGuard
|
GrGLInterface::kStaticInitEndGuard
|
||||||
};
|
};
|
||||||
static bool host_StubGL_initialized = false;
|
static bool host_StubGL_initialized = false;
|
||||||
|
@ -127,6 +127,8 @@ 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;
|
||||||
|
@ -72,6 +72,7 @@ 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;
|
||||||
@ -127,6 +128,8 @@ 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;
|
||||||
@ -141,6 +144,8 @@ 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;
|
||||||
|
@ -86,6 +86,7 @@ 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;
|
||||||
@ -142,6 +143,8 @@ 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);
|
||||||
@ -156,6 +159,8 @@ 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);
|
||||||
|
@ -88,6 +88,7 @@ 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;
|
||||||
@ -144,6 +145,8 @@ 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);
|
||||||
@ -158,6 +161,8 @@ 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);
|
||||||
|
@ -72,6 +72,7 @@ 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;
|
||||||
@ -149,6 +150,8 @@ 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);
|
||||||
@ -162,6 +165,8 @@ 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user