Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1420423002: Fix gl caps for mixed sample support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add more comments. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index e1f3e1b0330215adf60948c7eb854f9aa172ef88..106a07b6d75ae01161545cadd3ef9ab82bcfeb4a 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);
@@ -380,6 +430,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) {
@@ -432,10 +483,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);
@@ -487,9 +534,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();
@@ -541,50 +586,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) {
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698