Add bit to GrGLCaps for fixed function support

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23587014

git-svn-id: http://skia.googlecode.com/svn/trunk@11043 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-08-30 19:43:47 +00:00
parent 0d60db6010
commit 3628ad9f13
3 changed files with 13 additions and 4 deletions

View File

@ -47,6 +47,7 @@ void GrGLCaps::reset() {
fVertexArrayObjectSupport = false;
fUseNonVBOVertexAndIndexDynamicData = false;
fIsCoreProfile = false;
fFixedFunctionSupport = false;
fDiscardFBSupport = false;
}
@ -84,6 +85,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
fIsCoreProfile = caps.fIsCoreProfile;
fFixedFunctionSupport = caps.fFixedFunctionSupport;
fDiscardFBSupport = caps.fDiscardFBSupport;
return *this;
@ -117,6 +119,7 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
}
if (!fIsCoreProfile) {
fFixedFunctionSupport = true;
GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionTextureCoords);
// Sanity check
SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionTextureCoords < 128);
@ -589,9 +592,15 @@ void GrGLCaps::print() const {
GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1);
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
GrPrintf("Fixed Function Support: %s\n", (fFixedFunctionSupport ? "YES" : "NO"));
GrPrintf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]);
GrPrintf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]);
GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
GrPrintf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
if (fFixedFunctionSupport) {
GrPrintf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTextureCoords);
}
GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO"));
@ -612,6 +621,5 @@ void GrGLCaps::print() const {
GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
GrPrintf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO"));
}

View File

@ -282,6 +282,8 @@ public:
bool isCoreProfile() const { return fIsCoreProfile; }
bool fixedFunctionSupport() const { return fFixedFunctionSupport; }
/// Is there support for discarding the frame buffer
bool discardFBSupport() const { return fDiscardFBSupport; }
@ -364,6 +366,7 @@ private:
bool fVertexArrayObjectSupport : 1;
bool fUseNonVBOVertexAndIndexDynamicData : 1;
bool fIsCoreProfile : 1;
bool fFixedFunctionSupport : 1;
bool fDiscardFBSupport : 1;
typedef GrDrawTargetCaps INHERITED;

View File

@ -364,9 +364,7 @@ void GrGpuGL::onResetContext(uint32_t resetBits) {
fHWBoundRenderTarget = NULL;
}
if (resetBits & kFixedFunction_GrGLBackendState &&
kDesktop_GrGLBinding == this->glBinding() &&
!this->glCaps().isCoreProfile()) {
if (resetBits & kFixedFunction_GrGLBackendState && this->glCaps().fixedFunctionSupport()) {
fHWProjectionMatrixState.invalidate();
// we don't use the model view matrix.