Loosen requirements for mixed samples support
Quits requiring EXT_raster_multisample and NV_sample_mask_override_coverage for mixed samples support. This will allow platforms without those latter extensions (i.e. Chrome) to still use mixed samples for path rendering. Also moves the mixed samples cap out of shader caps, since it no longer denotes shader functionality. BUG=skia: Review URL: https://codereview.chromium.org/1410383011
This commit is contained in:
parent
f3bace9392
commit
63f6c1fc5b
@ -62,7 +62,6 @@ public:
|
||||
bool pathRenderingSupport() const { return fPathRenderingSupport; }
|
||||
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
|
||||
bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
|
||||
bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
|
||||
bool programmableSampleLocationsSupport() const { return fProgrammableSampleLocationsSupport; }
|
||||
|
||||
/**
|
||||
@ -93,7 +92,6 @@ protected:
|
||||
bool fPathRenderingSupport : 1;
|
||||
bool fDstReadInShaderSupport : 1;
|
||||
bool fDualSourceBlendingSupport : 1;
|
||||
bool fMixedSamplesSupport : 1;
|
||||
bool fProgrammableSampleLocationsSupport : 1;
|
||||
|
||||
bool fShaderPrecisionVaries;
|
||||
@ -130,6 +128,7 @@ public:
|
||||
bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; }
|
||||
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
|
||||
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
|
||||
bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
|
||||
|
||||
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
|
||||
bool useDrawInsteadOfPartialRenderTargetWrite() const {
|
||||
@ -247,6 +246,7 @@ protected:
|
||||
bool fCompressedTexSubImageSupport : 1;
|
||||
bool fOversizedStencilSupport : 1;
|
||||
bool fTextureBarrierSupport : 1;
|
||||
bool fMixedSamplesSupport : 1;
|
||||
bool fSupportsInstancedDraws : 1;
|
||||
bool fFullClearIsFree : 1;
|
||||
bool fMustClearUploadedBufferData : 1;
|
||||
|
@ -15,7 +15,6 @@ GrShaderCaps::GrShaderCaps() {
|
||||
fPathRenderingSupport = false;
|
||||
fDstReadInShaderSupport = false;
|
||||
fDualSourceBlendingSupport = false;
|
||||
fMixedSamplesSupport = false;
|
||||
fProgrammableSampleLocationsSupport = false;
|
||||
fShaderPrecisionVaries = false;
|
||||
}
|
||||
@ -52,7 +51,6 @@ SkString GrShaderCaps::dump() const {
|
||||
r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]);
|
||||
r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]);
|
||||
r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]);
|
||||
r.appendf("Mixed Samples Support : %s\n", gNY[fMixedSamplesSupport]);
|
||||
r.appendf("Programmable Sample Locations Support : %s\n", gNY[fProgrammableSampleLocationsSupport]);
|
||||
|
||||
r.appendf("Shader Float Precisions (varies: %s) :\n", gNY[fShaderPrecisionVaries]);
|
||||
@ -94,6 +92,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
|
||||
fCompressedTexSubImageSupport = false;
|
||||
fOversizedStencilSupport = false;
|
||||
fTextureBarrierSupport = false;
|
||||
fMixedSamplesSupport = false;
|
||||
fSupportsInstancedDraws = false;
|
||||
fFullClearIsFree = false;
|
||||
fMustClearUploadedBufferData = false;
|
||||
@ -165,6 +164,7 @@ SkString GrCaps::dump() const {
|
||||
r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageSupport]);
|
||||
r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencilSupport]);
|
||||
r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSupport]);
|
||||
r.appendf("Mixed Samples Support : %s\n", gNY[fMixedSamplesSupport]);
|
||||
r.appendf("Supports instanced draws : %s\n", gNY[fSupportsInstancedDraws]);
|
||||
r.appendf("Full screen clear is free : %s\n", gNY[fFullClearIsFree]);
|
||||
r.appendf("Must clear buffer memory : %s\n", gNY[fMustClearUploadedBufferData]);
|
||||
|
@ -310,21 +310,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
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;
|
||||
}
|
||||
|
||||
if (kGL_GrGLStandard == standard) {
|
||||
glslCaps->fProgrammableSampleLocationsSupport =
|
||||
ctxInfo.version() >= GR_GL_VER(4, 3) &&
|
||||
@ -340,8 +325,18 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
* GrCaps fields
|
||||
**************************************************************************/
|
||||
|
||||
// fPathRenderingSupport and fMixedSampleSupport must be set before calling initFSAASupport.
|
||||
// Both of these are set in the GrShaderCaps.
|
||||
// We need dual source blending and the ability to disable multisample in order to support mixed
|
||||
// samples in every corner case.
|
||||
if (fMultisampleDisableSupport && glslCaps->dualSourceBlendingSupport()) {
|
||||
fMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples");
|
||||
// Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples.
|
||||
if (fMixedSamplesSupport && kNVIDIA_GrGLDriver == ctxInfo.driver()) {
|
||||
fDiscardRenderTargetSupport = false;
|
||||
fInvalidateFBType = kNone_InvalidateFBType;
|
||||
}
|
||||
}
|
||||
|
||||
// fPathRenderingSupport and fMixedSamplesSupport must be set before calling initFSAASupport.
|
||||
this->initFSAASupport(ctxInfo, gli);
|
||||
this->initBlendEqationSupport(ctxInfo);
|
||||
this->initStencilFormats(ctxInfo);
|
||||
@ -983,7 +978,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
|
||||
fMSFBOType = kES_EXT_MsToTexture_MSFBOType;
|
||||
} else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")) {
|
||||
fMSFBOType = kES_IMG_MsToTexture_MSFBOType;
|
||||
} else if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupport()) {
|
||||
} else if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
|
||||
fMSFBOType = kMixedSamples_MSFBOType;
|
||||
} else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
|
||||
fMSFBOType = GrGLCaps::kES_3_0_MSFBOType;
|
||||
@ -995,7 +990,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
|
||||
fMSFBOType = kES_Apple_MSFBOType;
|
||||
}
|
||||
} else {
|
||||
if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupport()) {
|
||||
if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
|
||||
fMSFBOType = kMixedSamples_MSFBOType;
|
||||
} else if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
|
||||
ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
|
||||
|
@ -333,7 +333,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
|
||||
// "opacity", which can then be blended into the color buffer to accomplish antialiasing.
|
||||
// Enable coverage modulation suitable for premultiplied alpha colors.
|
||||
// This state has no effect when not rendering to a mixed sampled target.
|
||||
if (this->glCaps().shaderCaps()->mixedSamplesSupport()) {
|
||||
if (this->caps()->mixedSamplesSupport()) {
|
||||
GL_CALL(CoverageModulation(GR_GL_RGBA));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user