aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrDrawTarget.cpp3
-rw-r--r--src/gpu/GrDrawTargetCaps.h2
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp8
-rw-r--r--src/gpu/gl/GrGLCaps.cpp22
-rw-r--r--src/gpu/gl/GrGLCaps.h4
-rw-r--r--src/gpu/gl/GrGLDefines.h8
-rw-r--r--src/gpu/gl/GrGLGpu.cpp2
-rw-r--r--src/gpu/gl/GrGLInterface.cpp6
8 files changed, 50 insertions, 5 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 847e497dab..35a19e4e24 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -538,6 +538,7 @@ void GrShaderCaps::reset() {
fPathRenderingSupport = false;
fDstReadInShaderSupport = false;
fDualSourceBlendingSupport = false;
+ fMixedSamplesSupport = false;
fShaderPrecisionVaries = false;
}
@@ -548,6 +549,7 @@ GrShaderCaps& GrShaderCaps::operator=(const GrShaderCaps& other) {
fPathRenderingSupport = other.fPathRenderingSupport;
fDstReadInShaderSupport = other.fDstReadInShaderSupport;
fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
+ fMixedSamplesSupport = other.fMixedSamplesSupport;
fShaderPrecisionVaries = other.fShaderPrecisionVaries;
for (int s = 0; s < kGrShaderTypeCount; ++s) {
@@ -590,6 +592,7 @@ 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("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVaries]);
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index c1b7381cc2..3381bd36b4 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -69,6 +69,7 @@ public:
bool pathRenderingSupport() const { return fPathRenderingSupport; }
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
+ bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
/**
* Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a
@@ -94,6 +95,7 @@ protected:
bool fPathRenderingSupport : 1;
bool fDstReadInShaderSupport : 1;
bool fDualSourceBlendingSupport : 1;
+ bool fMixedSamplesSupport : 1;
bool fShaderPrecisionVaries;
PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index 89b21fdec3..af5b336b9f 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -158,6 +158,9 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
}
GET_PROC(PixelStorei);
+ if (extensions.has("GL_EXT_raster_multisample")) {
+ GET_PROC_SUFFIX(RasterSamples, EXT);
+ }
GET_PROC(ReadBuffer);
GET_PROC(ReadPixels);
GET_PROC(Scissor);
@@ -411,6 +414,11 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC(LineWidth);
GET_PROC(LinkProgram);
GET_PROC(PixelStorei);
+
+ if (extensions.has("GL_EXT_raster_multisample")) {
+ GET_PROC_SUFFIX(RasterSamples, EXT);
+ }
+
GET_PROC(ReadPixels);
GET_PROC(Scissor);
GET_PROC(ShaderSource);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ea6b83f2b1..85a72600d0 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -44,10 +44,10 @@ void GrGLCaps::reset() {
fFragCoordsConventionSupport = false;
fVertexArrayObjectSupport = false;
fES2CompatibilitySupport = false;
+ fMultisampleDisableSupport = false;
fUseNonVBOVertexAndIndexDynamicData = false;
fIsCoreProfile = false;
fFullClearIsFree = false;
- fFBMixedSamplesSupport = false;
fReadPixelsSupportedCache.reset();
@@ -86,10 +86,10 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) {
fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
fES2CompatibilitySupport = caps.fES2CompatibilitySupport;
+ fMultisampleDisableSupport = caps.fMultisampleDisableSupport;
fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
fIsCoreProfile = caps.fIsCoreProfile;
fFullClearIsFree = caps.fFullClearIsFree;
- fFBMixedSamplesSupport = caps.fFBMixedSamplesSupport;
*(reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get())) =
*(reinterpret_cast<GrGLSLCaps*>(caps.fShaderCaps.get()));
@@ -252,6 +252,12 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fES2CompatibilitySupport = true;
}
+ if (kGL_GrGLStandard == standard) {
+ fMultisampleDisableSupport = true;
+ } else {
+ fMultisampleDisableSupport = false;
+ }
+
this->initFSAASupport(ctxInfo, gli);
this->initStencilFormats(ctxInfo);
@@ -336,8 +342,6 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
// attachment, hence this min:
fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize);
- fFBMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples");
-
fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker");
// Disable scratch texture reuse on Mali and Adreno devices
@@ -935,6 +939,7 @@ SkString GrGLCaps::dump() const {
r.appendf("Fragment coord conventions support: %s\n",
(fFragCoordsConventionSupport ? "YES": "NO"));
r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
+ r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO"));
r.appendf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO"));
@@ -1054,6 +1059,15 @@ bool GrGLSLCaps::init(const GrGLContextInfo& ctxInfo,
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 (fDualSourceBlendingSupport && glCaps.multisampleDisableSupport()) {
+ // We understand "mixed samples" to mean the collective capability of 3 different extensions
+ fMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") &&
+ ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") &&
+ ctxInfo.hasExtension("GL_EXT_raster_multisample");
+ }
+
if (glCaps.advancedBlendEquationSupport()) {
bool coherent = glCaps.advancedCoherentBlendEquationSupport();
if (ctxInfo.hasExtension(coherent ? "GL_NV_blend_equation_advanced_coherent"
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 663cd4be41..5503576b2c 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -237,6 +237,9 @@ public:
/// Is there support for ES2 compatability?
bool ES2CompatibilitySupport() const { return fES2CompatibilitySupport; }
+ /// Can we call glDisable(GL_MULTISAMPLE)?
+ bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
+
/// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
bool useNonVBOVertexAndIndexDynamicData() const {
return fUseNonVBOVertexAndIndexDynamicData;
@@ -353,6 +356,7 @@ private:
bool fFragCoordsConventionSupport : 1;
bool fVertexArrayObjectSupport : 1;
bool fES2CompatibilitySupport : 1;
+ bool fMultisampleDisableSupport : 1;
bool fUseNonVBOVertexAndIndexDynamicData : 1;
bool fIsCoreProfile : 1;
bool fFullClearIsFree : 1;
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 4c479ed863..61c5588059 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -880,4 +880,12 @@
/* ARM specific define for MSAA support on framebuffer fetch */
#define GR_GL_FETCH_PER_SAMPLE_ARM 0x8F65
+/* GL_EXT_raster_multisample */
+#define GR_GL_RASTER_MULTISAMPLE 0x9327
+#define GR_GL_RASTER_SAMPLES 0x9328
+#define GR_GL_MAX_RASTER_SAMPLES 0x9329
+#define GR_GL_RASTER_FIXED_SAMPLE_LOCATIONS 0x932A
+#define GR_GL_MULTISAMPLE_RASTERIZATION_ALLOWED 0x932B
+#define GR_GL_EFFECTIVE_RASTER_SAMPLES 0x932C
+
#endif
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6a8d83b019..1b94a1e21a 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2101,7 +2101,7 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) {
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
SkASSERT(!useHWAA || rt->isMultisampled());
- if (kGL_GrGLStandard == this->glStandard()) {
+ if (this->glCaps().multisampleDisableSupport()) {
if (useHWAA) {
if (kYes_TriState != fMSAAEnabled) {
GL_CALL(Enable(GR_GL_MULTISAMPLE));
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index 89f1f9ba65..8bbd2f3b1b 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -528,6 +528,12 @@ bool GrGLInterface::validate() const {
}
}
+ if (fExtensions.has("GL_EXT_raster_multisample")) {
+ if (NULL == fFunctions.fRasterSamples) {
+ RETURN_FALSE_INTERFACE
+ }
+ }
+
if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
if (NULL == fFunctions.fCoverageModulation) {
RETURN_FALSE_INTERFACE