GrGLInterface: Add support for NV_framebuffer_mixed_samples

Import glCoverageModulation if NV_framebuffer_mixed samples
is available

BUG=skia:3177

Review URL: https://codereview.chromium.org/993363002
This commit is contained in:
vbuzinov 2015-04-01 06:29:49 -07:00 committed by Commit bot
parent 7c0273f107
commit 08b4d29a0a
6 changed files with 25 additions and 0 deletions

View File

@ -259,6 +259,8 @@ extern "C" {
// NV_path_rendering v1.3
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLProgramPathFragmentInputGenProc)(GrGLuint program, GrGLint location, GrGLenum genMode, GrGLint components,const GrGLfloat *coeffs);
typedef GrGLenum (GR_GL_FUNCTION_TYPE* GrGLPathMemoryGlyphIndexArrayProc)(GrGLuint firstPathName, GrGLenum fontTarget, GrGLsizeiptr fontSize, const GrGLvoid *fontData, GrGLsizei faceIndex, GrGLuint firstGlyphIndex, GrGLsizei numGlyphs, GrGLuint pathParameterTemplate, GrGLfloat emScale);
// GL_NV_framebuffer_mixed_samples
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverageModulationProc)(GrGLenum components);
} // extern "C"
#endif

View File

@ -348,6 +348,8 @@ public:
// NV_path_rendering v1.3
GLPtr<GrGLProgramPathFragmentInputGenProc> fProgramPathFragmentInputGen;
GLPtr<GrGLPathMemoryGlyphIndexArrayProc> fPathMemoryGlyphIndexArray;
// NV_framebuffer_mixed_samples
GLPtr<GrGLCoverageModulationProc> fCoverageModulation;
} fFunctions;
// Per-GL func callback

View File

@ -278,6 +278,10 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(PathMemoryGlyphIndexArray, NV);
}
if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
GET_PROC_SUFFIX(CoverageModulation, NV);
}
if (extensions.has("GL_EXT_debug_marker")) {
GET_PROC_SUFFIX(InsertEventMarker, EXT);
GET_PROC_SUFFIX(PushGroupMarker, EXT);
@ -519,6 +523,10 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(PathMemoryGlyphIndexArray, NV);
}
if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
GET_PROC_SUFFIX(CoverageModulation, NV);
}
interface->fStandard = kGLES_GrGLStandard;
interface->fExtensions.swap(&extensions);

View File

@ -54,6 +54,7 @@ void GrGLCaps::reset() {
fFBFetchNeedsCustomOutput = false;
fFBFetchColorName = NULL;
fFBFetchExtensionString = NULL;
fFBMixedSamplesSupport = false;
fReadPixelsSupportedCache.reset();
}
@ -99,6 +100,7 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) {
fFBFetchNeedsCustomOutput = caps.fFBFetchNeedsCustomOutput;
fFBFetchColorName = caps.fFBFetchColorName;
fFBFetchExtensionString = caps.fFBFetchExtensionString;
fFBMixedSamplesSupport = caps.fFBMixedSamplesSupport;
return *this;
}
@ -371,6 +373,8 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fNvprSupport = kNone_NvprSupport;
}
fFBMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples");
fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker");
// For now these two are equivalent but we could have dst read in shader via some other method

View File

@ -178,6 +178,8 @@ public:
const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
bool fbMixedSamplesSupport() const { return fFBMixedSamplesSupport; }
InvalidateFBType invalidateFBType() const { return fInvalidateFBType; }
/// What type of buffer mapping is supported?
@ -389,6 +391,7 @@ private:
bool fDropsTileOnZeroDivide : 1;
bool fFBFetchSupport : 1;
bool fFBFetchNeedsCustomOutput : 1;
bool fFBMixedSamplesSupport : 1;
const char* fFBFetchColorName;
const char* fFBFetchExtensionString;

View File

@ -505,5 +505,11 @@ bool GrGLInterface::validate() const {
}
}
if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
if (NULL == fFunctions.fCoverageModulation) {
RETURN_FALSE_INTERFACE
}
}
return true;
}