aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-19 13:58:55 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-19 13:58:55 +0000
commit8a70eef71cf369803e97ffea786f43f944de758e (patch)
treebf5e1a117147a5ad926a69aa757ae5660211be72 /src/gpu
parent8c3f84d13ff9eb61d9deb93197da4596b79841b0 (diff)
Add MSAA configs to bench.
Review URL: https://codereview.chromium.org/12607013 git-svn-id: http://skia.googlecode.com/svn/trunk@8217 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrDrawTarget.h4
-rw-r--r--src/gpu/gl/GrGLCaps.cpp8
-rw-r--r--src/gpu/gl/GrGLCaps.h6
-rw-r--r--src/gpu/gl/GrGpuGL.cpp29
5 files changed, 26 insertions, 25 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 271923aedf..b719ec5a53 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -549,6 +549,10 @@ int GrContext::getMaxRenderTargetSize() const {
return fGpu->getCaps().maxRenderTargetSize();
}
+int GrContext::getMaxSampleCount() const {
+ return fGpu->getCaps().maxSampleCount();
+}
+
///////////////////////////////////////////////////////////////////////////////
GrTexture* GrContext::wrapBackendTexture(const GrBackendTextureDesc& desc) {
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 965b1b6176..a011aaef99 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -45,8 +45,10 @@ protected:
bool fDualSourceBlendingSupport : 1;
bool fBufferLockSupport : 1;
bool fPathStencilingSupport : 1;
+
int fMaxRenderTargetSize;
int fMaxTextureSize;
+ int fMaxSampleCount;
};
class DrawInfo;
@@ -81,6 +83,8 @@ public:
int maxRenderTargetSize() const { return fInternals.fMaxRenderTargetSize; }
int maxTextureSize() const { return fInternals.fMaxTextureSize; }
+ // Will be 0 if MSAA is not supported
+ int maxSampleCount() const { return fInternals.fMaxSampleCount; }
private:
CapsInternals fInternals;
friend class GrDrawTarget; // to set values of fInternals
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 82b042fca7..04c2c3c720 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -19,7 +19,6 @@ void GrGLCaps::reset() {
fStencilFormats.reset();
fStencilVerifiedColorConfigs.reset();
fMSFBOType = kNone_MSFBOType;
- fMaxSampleCount = 0;
fCoverageAAType = kNone_CoverageAAType;
fMaxFragmentUniformVectors = 0;
fMaxVertexAttributes = 0;
@@ -53,7 +52,6 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
fMaxVertexAttributes = caps.fMaxVertexAttributes;
fMSFBOType = caps.fMSFBOType;
- fMaxSampleCount = caps.fMaxSampleCount;
fCoverageAAType = caps.fCoverageAAType;
fMSAACoverageModes = caps.fMSAACoverageModes;
fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
@@ -284,13 +282,9 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
SkCastForQSort(coverage_mode_compare));
}
}
- if (kNone_MSFBOType != fMSFBOType) {
- GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount);
- }
}
-const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(
- int desiredSampleCount) const {
+const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(int desiredSampleCount) const {
static const MSAACoverageMode kNoneMode = {0, 0};
if (0 == fMSAACoverageModes.count()) {
return kNoneMode;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 91689562d4..2ecfb85840 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -138,11 +138,6 @@ public:
MSFBOType msFBOType() const { return fMSFBOType; }
/**
- * Reports the maximum number of samples supported.
- */
- int maxSampleCount() const { return fMaxSampleCount; }
-
- /**
* Reports the type of coverage sample AA support.
*/
CoverageAAType coverageAAType() const { return fCoverageAAType; }
@@ -289,7 +284,6 @@ private:
int fMaxVertexAttributes;
MSFBOType fMSFBOType;
- int fMaxSampleCount;
CoverageAAType fCoverageAAType;
SkTDArray<MSAACoverageMode> fMSAACoverageModes;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 343cae39f0..33e3d6173b 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -278,18 +278,20 @@ void GrGpuGL::initCaps() {
// Enable supported shader-related caps
if (kDesktop_GrGLBinding == this->glBinding()) {
- caps->fDualSourceBlendingSupport =
- this->glVersion() >= GR_GL_VER(3,3) ||
- this->hasExtension("GL_ARB_blend_func_extended");
+ caps->fDualSourceBlendingSupport = this->glVersion() >= GR_GL_VER(3,3) ||
+ this->hasExtension("GL_ARB_blend_func_extended");
caps->fShaderDerivativeSupport = true;
// we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
- caps->fGeometryShaderSupport =
- this->glVersion() >= GR_GL_VER(3,2) &&
- this->glslGeneration() >= k150_GrGLSLGeneration;
+ caps->fGeometryShaderSupport = this->glVersion() >= GR_GL_VER(3,2) &&
+ this->glslGeneration() >= k150_GrGLSLGeneration;
} else {
caps->fShaderDerivativeSupport =
this->hasExtension("GL_OES_standard_derivatives");
}
+
+ if (GrGLCaps::kNone_MSFBOType != this->glCaps().msFBOType()) {
+ GR_GL_GetIntegerv(this->glInterface(), GR_GL_MAX_SAMPLES, &caps->fMaxSampleCount);
+ }
}
void GrGpuGL::fillInConfigRenderableTable() {
@@ -316,8 +318,7 @@ void GrGpuGL::fillInConfigRenderableTable() {
// color renderable: RGBA4, RGB5_A1, RGB565
// GL_EXT_texture_rg adds support for R8 as a color render target
// GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8
- // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888
- // added BGRA support
+ // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 added BGRA support
if (kDesktop_GrGLBinding == this->glBinding()) {
// Post 3.0 we will get R8
@@ -849,8 +850,6 @@ bool renderbuffer_storage_msaa(GrGLContext& ctx,
created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));
}
if (!created) {
- // glRBMS will fail if requested samples is > max samples.
- sampleCount = GrMin(sampleCount, ctx.info().caps().maxSampleCount());
GL_ALLOC_CALL(ctx.interface(),
RenderbufferStorageMultisample(GR_GL_RENDERBUFFER,
sampleCount,
@@ -976,12 +975,18 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
// Attempt to catch un- or wrongly initialized sample counts;
GrAssert(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
+ // We fail if the MSAA was requested and is not available.
+ if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() && desc.fSampleCnt) {
+ //GrPrintf("MSAA RT requested but not supported on this platform.");
+ return return_null_texture();
+ }
+ // If the sample count exceeds the max then we clamp it.
+ glTexDesc.fSampleCnt = GrMin(desc.fSampleCnt, this->getCaps().maxSampleCount());
glTexDesc.fFlags = desc.fFlags;
glTexDesc.fWidth = desc.fWidth;
glTexDesc.fHeight = desc.fHeight;
glTexDesc.fConfig = desc.fConfig;
- glTexDesc.fSampleCnt = desc.fSampleCnt;
glTexDesc.fIsWrapped = false;
glRTDesc.fMSColorRenderbufferID = 0;
@@ -997,7 +1002,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget);
glRTDesc.fOrigin = glTexDesc.fOrigin;
- glRTDesc.fSampleCnt = desc.fSampleCnt;
+ glRTDesc.fSampleCnt = glTexDesc.fSampleCnt;
if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() &&
desc.fSampleCnt) {
//GrPrintf("MSAA RT requested but not supported on this platform.");