Plumbed in discard_framebuffer extension
https://codereview.chromium.org/14461006/ git-svn-id: http://skia.googlecode.com/svn/trunk@8906 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
5c341d1ff1
commit
a6ffb58b10
@ -143,6 +143,7 @@ extern "C" {
|
|||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
|
||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameterivProc)(GrGLenum target, GrGLenum pname, const GrGLint* params);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameterivProc)(GrGLenum target, GrGLenum pname, const GrGLint* params);
|
||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexStorage2DProc)(GrGLenum target, GrGLsizei levels, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexStorage2DProc)(GrGLenum target, GrGLsizei levels, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
|
||||||
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDiscardFramebufferProc)(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments);
|
||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
|
||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniform1fProc)(GrGLint location, GrGLfloat v0);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniform1fProc)(GrGLint location, GrGLfloat v0);
|
||||||
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniform1iProc)(GrGLint location, GrGLint v0);
|
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniform1iProc)(GrGLint location, GrGLint v0);
|
||||||
|
@ -235,6 +235,7 @@ public:
|
|||||||
GLPtr<GrGLTexParameterivProc> fTexParameteriv;
|
GLPtr<GrGLTexParameterivProc> fTexParameteriv;
|
||||||
GLPtr<GrGLTexSubImage2DProc> fTexSubImage2D;
|
GLPtr<GrGLTexSubImage2DProc> fTexSubImage2D;
|
||||||
GLPtr<GrGLTexStorage2DProc> fTexStorage2D;
|
GLPtr<GrGLTexStorage2DProc> fTexStorage2D;
|
||||||
|
GLPtr<GrGLDiscardFramebufferProc> fDiscardFramebuffer;
|
||||||
GLPtr<GrGLUniform1fProc> fUniform1f;
|
GLPtr<GrGLUniform1fProc> fUniform1f;
|
||||||
GLPtr<GrGLUniform1iProc> fUniform1i;
|
GLPtr<GrGLUniform1iProc> fUniform1i;
|
||||||
GLPtr<GrGLUniform1fvProc> fUniform1fv;
|
GLPtr<GrGLUniform1fvProc> fUniform1fv;
|
||||||
|
@ -43,6 +43,7 @@ void GrGLCaps::reset() {
|
|||||||
fVertexArrayObjectSupport = false;
|
fVertexArrayObjectSupport = false;
|
||||||
fUseNonVBOVertexAndIndexDynamicData = false;
|
fUseNonVBOVertexAndIndexDynamicData = false;
|
||||||
fIsCoreProfile = false;
|
fIsCoreProfile = false;
|
||||||
|
fDiscardFBSupport = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
|
GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
|
||||||
@ -76,6 +77,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
|
|||||||
fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
|
fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
|
||||||
fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
|
fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
|
||||||
fIsCoreProfile = caps.fIsCoreProfile;
|
fIsCoreProfile = caps.fIsCoreProfile;
|
||||||
|
fDiscardFBSupport = caps.fDiscardFBSupport;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -194,6 +196,8 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
|
|||||||
fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
|
fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer");
|
||||||
|
|
||||||
if (kDesktop_GrGLBinding == binding) {
|
if (kDesktop_GrGLBinding == binding) {
|
||||||
fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
|
fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
|
||||||
ctxInfo.hasExtension("GL_ARB_vertex_array_object");
|
ctxInfo.hasExtension("GL_ARB_vertex_array_object");
|
||||||
@ -548,4 +552,5 @@ void GrGLCaps::print() const {
|
|||||||
GrPrintf("Use non-VBO for dynamic data: %s\n",
|
GrPrintf("Use non-VBO for dynamic data: %s\n",
|
||||||
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
|
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
|
||||||
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
|
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
|
||||||
|
GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO"));
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,9 @@ public:
|
|||||||
|
|
||||||
bool isCoreProfile() const { return fIsCoreProfile; }
|
bool isCoreProfile() const { return fIsCoreProfile; }
|
||||||
|
|
||||||
|
/// Is there support for discarding the frame buffer
|
||||||
|
bool discardFBSupport() const { return fDiscardFBSupport; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Maintains a bit per GrPixelConfig. It is used to avoid redundantly
|
* Maintains a bit per GrPixelConfig. It is used to avoid redundantly
|
||||||
@ -311,6 +314,7 @@ private:
|
|||||||
bool fVertexArrayObjectSupport : 1;
|
bool fVertexArrayObjectSupport : 1;
|
||||||
bool fUseNonVBOVertexAndIndexDynamicData : 1;
|
bool fUseNonVBOVertexAndIndexDynamicData : 1;
|
||||||
bool fIsCoreProfile : 1;
|
bool fIsCoreProfile : 1;
|
||||||
|
bool fDiscardFBSupport : 1;
|
||||||
|
|
||||||
typedef GrDrawTargetCaps INHERITED;
|
typedef GrDrawTargetCaps INHERITED;
|
||||||
};
|
};
|
||||||
|
@ -241,6 +241,7 @@ const GrGLInterface* GrGLCreateNullInterface() {
|
|||||||
interface->fTexParameteriv = noOpGLTexParameteriv;
|
interface->fTexParameteriv = noOpGLTexParameteriv;
|
||||||
interface->fTexSubImage2D = noOpGLTexSubImage2D;
|
interface->fTexSubImage2D = noOpGLTexSubImage2D;
|
||||||
interface->fTexStorage2D = noOpGLTexStorage2D;
|
interface->fTexStorage2D = noOpGLTexStorage2D;
|
||||||
|
interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
|
||||||
interface->fUniform1f = noOpGLUniform1f;
|
interface->fUniform1f = noOpGLUniform1f;
|
||||||
interface->fUniform1i = noOpGLUniform1i;
|
interface->fUniform1i = noOpGLUniform1i;
|
||||||
interface->fUniform1fv = noOpGLUniform1fv;
|
interface->fUniform1fv = noOpGLUniform1fv;
|
||||||
|
@ -295,6 +295,15 @@ bool GrGLInterface::validate(GrGLBinding binding) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extensions.has("GL_EXT_discard_framebuffer")) {
|
||||||
|
// FIXME: Remove this once Chromium is updated to provide this function
|
||||||
|
#if 0
|
||||||
|
if (NULL == fDiscardFramebuffer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// FBO MSAA
|
// FBO MSAA
|
||||||
if (kDesktop_GrGLBinding == binding) {
|
if (kDesktop_GrGLBinding == binding) {
|
||||||
// GL 3.0 and the ARB extension have multisample + blit
|
// GL 3.0 and the ARB extension have multisample + blit
|
||||||
|
@ -238,6 +238,11 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexStorage2D(GrGLenum target,
|
|||||||
GrGLsizei height) {
|
GrGLsizei height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
|
||||||
|
GrGLsizei numAttachments,
|
||||||
|
const GrGLenum* attachments) {
|
||||||
|
}
|
||||||
|
|
||||||
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
|
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
|
||||||
GrGLint level,
|
GrGLint level,
|
||||||
GrGLint xoffset,
|
GrGLint xoffset,
|
||||||
|
@ -159,6 +159,10 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexStorage2D(GrGLenum target,
|
|||||||
GrGLsizei width,
|
GrGLsizei width,
|
||||||
GrGLsizei height);
|
GrGLsizei height);
|
||||||
|
|
||||||
|
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
|
||||||
|
GrGLsizei numAttachments,
|
||||||
|
const GrGLenum* attachments);
|
||||||
|
|
||||||
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
|
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
|
||||||
GrGLint level,
|
GrGLint level,
|
||||||
GrGLint xoffset,
|
GrGLint xoffset,
|
||||||
|
@ -1519,13 +1519,13 @@ void GrGpuGL::flushRenderTarget(const GrIRect* bound) {
|
|||||||
|
|
||||||
if (fHWBoundRenderTarget != rt) {
|
if (fHWBoundRenderTarget != rt) {
|
||||||
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID()));
|
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID()));
|
||||||
#if GR_DEBUG
|
#if GR_DEBUG
|
||||||
GrGLenum status;
|
GrGLenum status;
|
||||||
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
|
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
|
||||||
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
|
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
|
||||||
GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n", status);
|
GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n", status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fHWBoundRenderTarget = rt;
|
fHWBoundRenderTarget = rt;
|
||||||
const GrGLIRect& vp = rt->getViewport();
|
const GrGLIRect& vp = rt->getViewport();
|
||||||
if (fHWViewport != vp) {
|
if (fHWViewport != vp) {
|
||||||
|
@ -94,6 +94,9 @@ const GrGLInterface* GrGLCreateNativeInterface() {
|
|||||||
interface->fTexStorage2D = glTexStorage2DEXT;
|
interface->fTexStorage2D = glTexStorage2DEXT;
|
||||||
#else
|
#else
|
||||||
interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
|
interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
|
||||||
|
#endif
|
||||||
|
#if GL_EXT_discard_framebuffer
|
||||||
|
interface->fDiscardFramebuffer = glDiscardFramebufferEXT;
|
||||||
#endif
|
#endif
|
||||||
interface->fUniform1f = glUniform1f;
|
interface->fUniform1f = glUniform1f;
|
||||||
interface->fUniform1i = glUniform1i;
|
interface->fUniform1i = glUniform1i;
|
||||||
|
@ -861,6 +861,7 @@ const GrGLInterface* GrGLCreateDebugInterface() {
|
|||||||
interface->fTexParameteriv = noOpGLTexParameteriv;
|
interface->fTexParameteriv = noOpGLTexParameteriv;
|
||||||
interface->fTexSubImage2D = noOpGLTexSubImage2D;
|
interface->fTexSubImage2D = noOpGLTexSubImage2D;
|
||||||
interface->fTexStorage2D = noOpGLTexStorage2D;
|
interface->fTexStorage2D = noOpGLTexStorage2D;
|
||||||
|
interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
|
||||||
interface->fUniform1f = noOpGLUniform1f;
|
interface->fUniform1f = noOpGLUniform1f;
|
||||||
interface->fUniform1i = noOpGLUniform1i;
|
interface->fUniform1i = noOpGLUniform1i;
|
||||||
interface->fUniform1fv = noOpGLUniform1fv;
|
interface->fUniform1fv = noOpGLUniform1fv;
|
||||||
|
@ -84,6 +84,9 @@ const GrGLInterface* GrGLCreateNativeInterface() {
|
|||||||
interface->fTexStorage2D = glTexStorage2D;
|
interface->fTexStorage2D = glTexStorage2D;
|
||||||
#elif GL_EXT_texture_storage
|
#elif GL_EXT_texture_storage
|
||||||
interface->fTexStorage2D = glTexStorage2DEXT;
|
interface->fTexStorage2D = glTexStorage2DEXT;
|
||||||
|
#endif
|
||||||
|
#if GL_EXT_discard_framebuffer
|
||||||
|
interface->fDiscardFramebuffer = glDiscardFramebufferEXT;
|
||||||
#endif
|
#endif
|
||||||
interface->fTexParameteri = glTexParameteri;
|
interface->fTexParameteri = glTexParameteri;
|
||||||
interface->fTexParameteriv = glTexParameteriv;
|
interface->fTexParameteriv = glTexParameteriv;
|
||||||
|
Loading…
Reference in New Issue
Block a user