From 33ad701bc30387127c427fb1e38c781d5de33491 Mon Sep 17 00:00:00 2001 From: cdalton Date: Mon, 22 Feb 2016 07:55:44 -0800 Subject: Add gl_SampleMask functionality to fragment builders Adds methods for overriding and masking a fragment's sample mask. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1690963003 Committed: https://skia.googlesource.com/skia/+/533cefe5b9c7cec2592fc7ca00ee4cf69a26c094 Review URL: https://codereview.chromium.org/1690963003 --- src/gpu/gl/GrGLCaps.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gpu/gl/GrGLCaps.cpp') diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index f23a5b80bc..546b0bf692 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -564,9 +564,19 @@ const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration return "#version 330 compatibility\n"; } } + case k400_GrGLSLGeneration: + SkASSERT(kGL_GrGLStandard == standard); + if (isCoreProfile) { + return "#version 400\n"; + } else { + return "#version 400 compatibility\n"; + } case k310es_GrGLSLGeneration: SkASSERT(kGLES_GrGLStandard == standard); return "#version 310 es\n"; + case k320es_GrGLSLGeneration: + SkASSERT(kGLES_GrGLStandard == standard); + return "#version 320 es\n"; } return ""; } @@ -625,6 +635,22 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { } } + if (kGL_GrGLStandard == standard) { + glslCaps->fSampleVariablesSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration; + } else { + if (ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { + glslCaps->fSampleVariablesSupport = true; + } else if (ctxInfo.hasExtension("GL_OES_sample_variables")) { + glslCaps->fSampleVariablesSupport = true; + glslCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables"; + } + } + + if (glslCaps->fSampleVariablesSupport) { + glslCaps->fSampleMaskOverrideCoverageSupport = + ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage"); + } + // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); -- cgit v1.2.3