aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-10-26 07:38:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-26 07:38:05 -0700
commit05ded891272772d43acc16345b2f90a4560df090 (patch)
treefb3920bfb79856e20702664af6a6196e016c5c4d /src/gpu/gl
parente72bd028d9046f42adb97eaf878e3a54f208ada8 (diff)
Fix gl caps for mixed sample support
The dependencies between glsl caps and some gl ones were more complex than I had thought with original change especially in regards to mix samples, advanced blends, and similar features. This changes simply reverts back to the original order of setting the caps so it should fix all perf issues that were seen in the X1 BUG=skia:4505 Review URL: https://codereview.chromium.org/1420423002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp103
-rw-r--r--src/gpu/gl/GrGLCaps.h2
2 files changed, 53 insertions, 52 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 9917c1f2a8..91bcd72ea7 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -64,6 +64,9 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
GrGLStandard standard = ctxInfo.standard();
GrGLVersion version = ctxInfo.version();
+ this->initGLSL(ctxInfo);
+ GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
+
/**************************************************************************
* Caps specific to GrGLCaps
**************************************************************************/
@@ -283,9 +286,56 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
#endif
/**************************************************************************
+ * GrShaderCaps fields
+ **************************************************************************/
+
+ glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli);
+
+ // For now these two are equivalent but we could have dst read in shader via some other method.
+ // Before setting this, initGLSL() must have been called.
+ glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport;
+
+ // Enable supported shader-related caps
+ if (kGL_GrGLStandard == standard) {
+ glslCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) ||
+ ctxInfo.hasExtension("GL_ARB_blend_func_extended")) &&
+ GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration());
+ glslCaps->fShaderDerivativeSupport = true;
+ // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
+ glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) &&
+ ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
+ }
+ else {
+ glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended");
+
+ glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) ||
+ ctxInfo.hasExtension("GL_OES_standard_derivatives");
+ }
+
+ // We need dual source blending and the ability to disable multisample in order to support mixed
+ // samples in every corner case.
+ if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) {
+ // We understand "mixed samples" to mean the collective capability of 3 different extensions
+ glslCaps->fMixedSamplesSupport =
+ ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") &&
+ ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") &&
+ ctxInfo.hasExtension("GL_EXT_raster_multisample");
+ }
+ // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples.
+ if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSupport()) {
+ fDiscardRenderTargetSupport = false;
+ fInvalidateFBType = kNone_InvalidateFBType;
+ }
+ glslCaps->fProgrammableSampleLocationsSupport =
+ ctxInfo.hasExtension("GL_NV_sample_locations") ||
+ ctxInfo.hasExtension("GL_ARB_sample_locations");
+
+ /**************************************************************************
* GrCaps fields
**************************************************************************/
+ // fPathRenderingSupport and fMixedSampleSupport must be set before calling initFSAASupport.
+ // Both of these are set in the GrShaderCaps.
this->initFSAASupport(ctxInfo, gli);
this->initBlendEqationSupport(ctxInfo);
this->initStencilFormats(ctxInfo);
@@ -385,6 +435,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
kQualcomm_GrGLVendor != ctxInfo.vendor();
#endif
+ // initFSAASupport() must have been called before this point
if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) {
GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount);
} else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) {
@@ -437,10 +488,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
ctxInfo.hasExtension("GL_EXT_instanced_arrays"));
}
- // Must init GLSLCaps after setting GLCaps
- this->initGLSL(contextOptions, ctxInfo, gli);
- GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
-
this->initConfigTexturableTable(ctxInfo, gli, srgbSupport);
this->initConfigRenderableTable(ctxInfo, srgbSupport);
this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
@@ -492,9 +539,7 @@ const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration
return "<no version>";
}
-void GrGLCaps::initGLSL(const GrContextOptions& contextOptions,
- const GrGLContextInfo& ctxInfo,
- const GrGLInterface* gli) {
+void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) {
GrGLStandard standard = ctxInfo.standard();
GrGLVersion version = ctxInfo.version();
@@ -546,50 +591,6 @@ void GrGLCaps::initGLSL(const GrContextOptions& contextOptions,
glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCaps->fGLSLGeneration,
fIsCoreProfile);
-
- /**************************************************************************
- * GrShaderCaps fields
- **************************************************************************/
-
- glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli);
-
- // For now these two are equivalent but we could have dst read in shader via some other method
- glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport;
-
- // Enable supported shader-related caps
- if (kGL_GrGLStandard == standard) {
- glslCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) ||
- ctxInfo.hasExtension("GL_ARB_blend_func_extended")) &&
- GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration());
- glslCaps->fShaderDerivativeSupport = true;
- // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
- glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) &&
- ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
- }
- else {
- glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended");
-
- glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) ||
- ctxInfo.hasExtension("GL_OES_standard_derivatives");
- }
-
- // We need dual source blending and the ability to disable multisample in order to support mixed
- // samples in every corner case.
- if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) {
- // We understand "mixed samples" to mean the collective capability of 3 different extensions
- glslCaps->fMixedSamplesSupport =
- ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") &&
- ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") &&
- ctxInfo.hasExtension("GL_EXT_raster_multisample");
- }
- // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples.
- if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSupport()) {
- fDiscardRenderTargetSupport = false;
- fInvalidateFBType = kNone_InvalidateFBType;
- }
- glslCaps->fProgrammableSampleLocationsSupport =
- ctxInfo.hasExtension("GL_NV_sample_locations") ||
- ctxInfo.hasExtension("GL_ARB_sample_locations");
}
bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 8c901deade..2ad5827075 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -270,7 +270,7 @@ public:
private:
void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*);
- void initGLSL(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*);
+ void initGLSL(const GrGLContextInfo&);
bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*);
/**