Revert "Revert "Avoid checking extension string in GrGLGpu::onResetContext.""
This reverts commit 04c1cccaa4
.
Reland that preserves GL_NV_shader_framebuffer_fetch support.
Change-Id: I8d51321a552d0abfd0a8fa36c4d00b9b0e0d8663
Reviewed-on: https://skia-review.googlesource.com/c/187300
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
fd0bba81c0
commit
8bc352c305
@ -68,6 +68,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
|
||||
fDontSetBaseOrMaxLevelForExternalTextures = false;
|
||||
fProgramBinarySupport = false;
|
||||
fSamplerObjectSupport = false;
|
||||
fFBFetchRequiresEnablePerSample = false;
|
||||
|
||||
fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag;
|
||||
fMaxInstancesPerDrawWithoutCrashing = 0;
|
||||
@ -708,25 +709,28 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli
|
||||
GrShaderCaps* shaderCaps = fShaderCaps.get();
|
||||
shaderCaps->fGLSLGeneration = ctxInfo.glslGeneration();
|
||||
if (kGLES_GrGLStandard == standard) {
|
||||
// fFBFetchRequiresEnablePerSample is not a shader cap but is initialized below to keep it
|
||||
// with related FB fetch logic.
|
||||
if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) {
|
||||
shaderCaps->fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0));
|
||||
shaderCaps->fFBFetchSupport = true;
|
||||
shaderCaps->fFBFetchColorName = "gl_LastFragData[0]";
|
||||
shaderCaps->fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch";
|
||||
}
|
||||
else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) {
|
||||
// Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know
|
||||
fFBFetchRequiresEnablePerSample = false;
|
||||
} else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) {
|
||||
// Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know.
|
||||
shaderCaps->fFBFetchNeedsCustomOutput = false;
|
||||
shaderCaps->fFBFetchSupport = true;
|
||||
shaderCaps->fFBFetchColorName = "gl_LastFragData[0]";
|
||||
shaderCaps->fFBFetchExtensionString = "GL_NV_shader_framebuffer_fetch";
|
||||
}
|
||||
else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) {
|
||||
// The arm extension also requires an additional flag which we will set onResetContext
|
||||
fFBFetchRequiresEnablePerSample = false;
|
||||
} else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) {
|
||||
// The arm extension also requires an additional flag which we will set onResetContext.
|
||||
shaderCaps->fFBFetchNeedsCustomOutput = false;
|
||||
shaderCaps->fFBFetchSupport = true;
|
||||
shaderCaps->fFBFetchColorName = "gl_LastFragColorARM";
|
||||
shaderCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch";
|
||||
fFBFetchRequiresEnablePerSample = true;
|
||||
}
|
||||
shaderCaps->fUsesPrecisionModifiers = true;
|
||||
}
|
||||
|
@ -417,6 +417,8 @@ public:
|
||||
|
||||
bool samplerObjectSupport() const { return fSamplerObjectSupport; }
|
||||
|
||||
bool fbFetchRequiresEnablePerSample() const { return fFBFetchRequiresEnablePerSample; }
|
||||
|
||||
GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
|
||||
SkColorType) const override;
|
||||
|
||||
@ -503,6 +505,7 @@ private:
|
||||
bool fClearTextureSupport : 1;
|
||||
bool fProgramBinarySupport : 1;
|
||||
bool fSamplerObjectSupport : 1;
|
||||
bool fFBFetchRequiresEnablePerSample : 1;
|
||||
|
||||
// Driver workarounds
|
||||
bool fDoManualMipmapping : 1;
|
||||
|
@ -987,7 +987,7 @@
|
||||
#define GR_GL_PATH_MODELVIEW 0x1700
|
||||
|
||||
/* ARM specific define for MSAA support on framebuffer fetch */
|
||||
#define GR_GL_FETCH_PER_SAMPLE_ARM 0x8F65
|
||||
#define GR_GL_FETCH_PER_SAMPLE 0x8F65
|
||||
|
||||
/* GL_EXT_raster_multisample */
|
||||
#define GR_GL_RASTER_MULTISAMPLE 0x9327
|
||||
|
@ -539,10 +539,10 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
|
||||
}
|
||||
|
||||
if (kGLES_GrGLStandard == this->glStandard() &&
|
||||
this->hasExtension("GL_ARM_shader_framebuffer_fetch")) {
|
||||
this->glCaps().fbFetchRequiresEnablePerSample()) {
|
||||
// The arm extension requires specifically enabling MSAA fetching per sample.
|
||||
// On some devices this may have a perf hit. Also multiple render targets are disabled
|
||||
GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM));
|
||||
GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE));
|
||||
}
|
||||
fHWWriteToColor = kUnknown_TriState;
|
||||
// we only ever use lines in hairline mode
|
||||
|
Loading…
Reference in New Issue
Block a user