fix for calling bindFragDataLocation on OpenGL 2.1
BUG=skia:3966
Review URL: https://codereview.chromium.org/1201623003
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index c7dc862..b23619d 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -47,6 +47,7 @@
fUseNonVBOVertexAndIndexDynamicData = false;
fIsCoreProfile = false;
fFullClearIsFree = false;
+ fBindFragDataLocationSupport = false;
fReadPixelsSupportedCache.reset();
@@ -270,6 +271,10 @@
fMultisampleDisableSupport = false;
}
+ if (kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) {
+ fBindFragDataLocationSupport = true;
+ }
+
/**************************************************************************
* GrShaderCaps fields
**************************************************************************/
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 1f5d6c2..3d33199 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -257,6 +257,8 @@
bool fullClearIsFree() const { return fFullClearIsFree; }
+ bool bindFragDataLocationSupport() const { return fBindFragDataLocationSupport; }
+
/**
* Returns a string containing the caps info.
*/
@@ -367,6 +369,7 @@
bool fUseNonVBOVertexAndIndexDynamicData : 1;
bool fIsCoreProfile : 1;
bool fFullClearIsFree : 1;
+ bool fBindFragDataLocationSupport : 1;
struct ReadPixelsSupportedFormat {
GrGLenum fFormat;
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index e6c07c2..557cdbf 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -264,9 +264,7 @@
}
void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID) {
- // ES 3.00 requires custom color output but doesn't support bindFragDataLocation
- if (fHasCustomColorOutput &&
- kGLES_GrGLStandard != fProgramBuilder->gpu()->ctxInfo().standard()) {
+ if (fHasCustomColorOutput && fProgramBuilder->gpu()->glCaps().bindFragDataLocationSupport()) {
GL_CALL(BindFragDataLocation(programID, 0, declared_color_output_name()));
}
if (fHasSecondaryOutput) {