aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrCaps.h21
-rw-r--r--src/gpu/GrCaps.cpp10
-rw-r--r--src/gpu/GrContext.cpp3
-rw-r--r--src/gpu/gl/GrGLCaps.cpp19
-rw-r--r--src/gpu/gl/GrGLGpu.cpp2
5 files changed, 36 insertions, 19 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 679777f9dd..e2e59c30a4 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -122,7 +122,7 @@ public:
bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; }
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
- bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
+ bool usesMixedSamples() const { return fUsesMixedSamples; }
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
bool useDrawInsteadOfPartialRenderTargetWrite() const {
@@ -188,7 +188,19 @@ public:
int maxTileSize() const { SkASSERT(fMaxTileSize <= fMaxTextureSize); return fMaxTileSize; }
// Will be 0 if MSAA is not supported
- int maxSampleCount() const { return fMaxSampleCount; }
+ int maxColorSampleCount() const { return fMaxColorSampleCount; }
+ // Will be 0 if MSAA is not supported
+ int maxStencilSampleCount() const { return fMaxStencilSampleCount; }
+ // We require the sample count to be less than maxColorSampleCount and maxStencilSampleCount.
+ // If we are using mixed samples, we only care about stencil.
+ int maxSampleCount() const {
+ if (this->usesMixedSamples()) {
+ return this->maxStencilSampleCount();
+ } else {
+ return SkTMin(this->maxColorSampleCount(), this->maxStencilSampleCount());
+ }
+ }
+
virtual bool isConfigTexturable(GrPixelConfig config) const = 0;
virtual bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const = 0;
@@ -235,7 +247,7 @@ protected:
bool fCompressedTexSubImageSupport : 1;
bool fOversizedStencilSupport : 1;
bool fTextureBarrierSupport : 1;
- bool fMixedSamplesSupport : 1;
+ bool fUsesMixedSamples : 1;
bool fSupportsInstancedDraws : 1;
bool fFullClearIsFree : 1;
bool fMustClearUploadedBufferData : 1;
@@ -257,7 +269,8 @@ protected:
int fMaxRenderTargetSize;
int fMaxTextureSize;
int fMaxTileSize;
- int fMaxSampleCount;
+ int fMaxColorSampleCount;
+ int fMaxStencilSampleCount;
private:
virtual void onApplyOptionsOverrides(const GrContextOptions&) {};
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 101d5f445b..f4c64c3333 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -90,7 +90,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fCompressedTexSubImageSupport = false;
fOversizedStencilSupport = false;
fTextureBarrierSupport = false;
- fMixedSamplesSupport = false;
+ fUsesMixedSamples = false;
fSupportsInstancedDraws = false;
fFullClearIsFree = false;
fMustClearUploadedBufferData = false;
@@ -104,7 +104,8 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fMaxRenderTargetSize = 1;
fMaxTextureSize = 1;
- fMaxSampleCount = 0;
+ fMaxColorSampleCount = 0;
+ fMaxStencilSampleCount = 0;
fSuppressPrints = options.fSuppressPrints;
fImmediateFlush = options.fImmediateMode;
@@ -160,7 +161,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("Uses Mixed Samples : %s\n", gNY[fUsesMixedSamples]);
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]);
@@ -175,7 +176,8 @@ SkString GrCaps::dump() const {
r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
- r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
+ r.appendf("Max Color Sample Count : %d\n", fMaxColorSampleCount);
+ r.appendf("Max Stencil Sample Count : %d\n", fMaxStencilSampleCount);
static const char* kBlendEquationSupportNames[] = {
"Basic",
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index e92014415c..79bbb5cb36 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -572,8 +572,7 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config,
chosenSampleCount = 16;
}
}
- return chosenSampleCount <= fGpu->caps()->maxSampleCount() ?
- chosenSampleCount : 0;
+ return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCount : 0;
}
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ddc52cc378..30181f692a 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -283,17 +283,19 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// 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") ||
+ if (fMultisampleDisableSupport &&
+ glslCaps->dualSourceBlendingSupport() &&
+ fShaderCaps->pathRenderingSupport()) {
+ fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") ||
ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples");
// Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples.
- if (fMixedSamplesSupport && kNVIDIA_GrGLDriver == ctxInfo.driver()) {
+ if (fUsesMixedSamples && kNVIDIA_GrGLDriver == ctxInfo.driver()) {
fDiscardRenderTargetSupport = false;
fInvalidateFBType = kNone_InvalidateFBType;
}
}
- // fPathRenderingSupport and fMixedSamplesSupport must be set before calling initFSAASupport.
+ // fUsesMixedSamples must be set before calling initFSAASupport.
this->initFSAASupport(ctxInfo, gli);
this->initBlendEqationSupport(ctxInfo);
this->initStencilFormats(ctxInfo);
@@ -402,10 +404,11 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// 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);
+ GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxColorSampleCount);
} else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) {
- GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount);
+ GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxColorSampleCount);
}
+ fMaxStencilSampleCount = fMaxColorSampleCount;
if (kPowerVR54x_GrGLRenderer == ctxInfo.renderer() ||
kPowerVRRogue_GrGLRenderer == ctxInfo.renderer() ||
@@ -684,7 +687,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 (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
+ } else if (fUsesMixedSamples) {
fMSFBOType = kMixedSamples_MSFBOType;
} else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
fMSFBOType = GrGLCaps::kES_3_0_MSFBOType;
@@ -696,7 +699,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fMSFBOType = kES_Apple_MSFBOType;
}
} else {
- if (fMixedSamplesSupport && fShaderCaps->pathRenderingSupport()) {
+ if (fUsesMixedSamples) {
fMSFBOType = kMixedSamples_MSFBOType;
} else if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 248a5dfbd2..185cdc26f3 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -341,7 +341,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->caps()->mixedSamplesSupport()) {
+ if (this->caps()->usesMixedSamples()) {
GL_CALL(CoverageModulation(GR_GL_RGBA));
}
}