// can change based on which render target is bound
fTwoFormatLimit = kGLES_GrGLStandard == standard;
+ // Frag Coords Convention support is not part of ES
// Known issue on at least some Intel platforms:
// http://code.google.com/p/skia/issues/detail?id=946
- if (kIntel_GrGLVendor != ctxInfo.vendor()) {
+ if (kIntel_GrGLVendor != ctxInfo.vendor() && kGLES_GrGLStandard != standard) {
fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGeneration ||
ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions");
}
fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) &&
ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
} else {
- fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivatives");
+ fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) ||
+ ctxInfo.hasExtension("GL_OES_standard_derivatives");
}
if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) {
fVendor = GrGLGetVendor(interface);
+ /*
+ * Qualcomm drivers have a horrendous bug with some drivers. Though they claim to
+ * support GLES 3.00, some perfectly valid GLSL300 shaders will only compile with
+ * #version 100, and will fail to compile with #version 300 es. In the long term, we
+ * need to lock this down to a specific driver version.
+ */
+ if (kQualcomm_GrGLVendor == fVendor) {
+ fGLSLGeneration = k110_GrGLSLGeneration;
+ }
+
fRenderer = GrGLGetRendererFromString(renderer);
fIsMesa = GrGLIsMesaFromVersionString(ver);
switch (gl->fStandard) {
case kGL_GrGLStandard:
SkASSERT(ver >= GR_GLSL_VER(1,10));
- if (ver >= GR_GLSL_VER(1,50)) {
+ if (ver >= GR_GLSL_VER(3,30)) {
+ *generation = k330_GrGLSLGeneration;
+ } else if (ver >= GR_GLSL_VER(1,50)) {
*generation = k150_GrGLSLGeneration;
} else if (ver >= GR_GLSL_VER(1,40)) {
*generation = k140_GrGLSLGeneration;
}
return true;
case kGLES_GrGLStandard:
- // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
SkASSERT(ver >= GR_GL_VER(1,00));
- *generation = k110_GrGLSLGeneration;
+ if (ver >= GR_GLSL_VER(3,1)) {
+ *generation = k310es_GrGLSLGeneration;
+ }
+ else if (ver >= GR_GLSL_VER(3,0)) {
+ *generation = k330_GrGLSLGeneration;
+ } else {
+ *generation = k110_GrGLSLGeneration;
+ }
return true;
default:
SkFAIL("Unknown GL Standard");
} else {
return "#version 150 compatibility\n";
}
+ case k330_GrGLSLGeneration:
+ if (kGLES_GrGLStandard == info.standard()) {
+ return "#version 300 es\n";
+ } else {
+ SkASSERT(kGL_GrGLStandard == info.standard());
+ return "#version 330 compatibility\n";
+ }
+ case k310es_GrGLSLGeneration:
+ SkASSERT(kGLES_GrGLStandard == info.standard());
+ return "#version 310 es\n";
default:
SkFAIL("Unknown GL version.");
return ""; // suppress warning
* Desktop GLSL 1.50
*/
k150_GrGLSLGeneration,
+ /**
+ * Desktop GLSL 3.30, and ES GLSL 3.00
+ */
+ k330_GrGLSLGeneration,
+ /**
+ * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
+ */
+ k310es_GrGLSLGeneration,
};
/**
out->append("layout(origin_upper_left) ");
}
if (this->getTypeModifier() != kNone_TypeModifier) {
- out->append(TypeModifierString(this->getTypeModifier(),
- ctxInfo.glslGeneration()));
+ out->append(TypeModifierString(this->getTypeModifier(), ctxInfo.glslGeneration()));
out->append(" ");
}
out->append(PrecisionString(fPrecision, ctxInfo.standard()));
}
GrGLFragmentShaderBuilder::DstReadKey
-GrGLFragmentShaderBuilder::KeyForDstRead(const GrTexture* dstCopy,
- const GrGLCaps& caps) {
+GrGLFragmentShaderBuilder::KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps& caps) {
uint32_t key = kYesDstRead_DstReadKeyBit;
if (caps.fbFetchSupport()) {
return key;
}
GrGLFragmentShaderBuilder::FragPosKey
-GrGLFragmentShaderBuilder::KeyForFragmentPosition(const GrRenderTarget* dst,
- const GrGLCaps&) {
+GrGLFragmentShaderBuilder::KeyForFragmentPosition(const GrRenderTarget* dst, const GrGLCaps&) {
if (kTopLeft_GrSurfaceOrigin == dst->origin()) {
return kTopLeftFragPosRead_FragPosKey;
} else {
if (!gpu->glCaps().shaderDerivativeSupport()) {
return false;
}
- if (kGLES_GrGLStandard == gpu->glStandard()) {
+ if (kGLES_GrGLStandard == gpu->glStandard() &&
+ k110_GrGLSLGeneration == gpu->glslGeneration()) {
this->addFeature(1 << kStandardDerivatives_GLSLFeature,
"GL_OES_standard_derivatives");
}
}
void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID) {
- if (fHasCustomColorOutput) {
+ // ES 3.00 requires custom color output but doesn't support bindFragDataLocation
+ if (fHasCustomColorOutput &&
+ kGLES_GrGLStandard != fProgramBuilder->gpu()->ctxInfo().standard()) {
GL_CALL(BindFragDataLocation(programID, 0, declared_color_output_name()));
}
if (fHasSecondaryOutput) {