diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 18:34:32 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 18:34:40 +0000 |
commit | c1ce2f7966babaae0deb150f93f1227ee5af9285 (patch) | |
tree | ab4caf4bd03f6e642f618739e4283eb9ef62ebaf /src/utils | |
parent | 130fb3f7aac19e40eddfc8fa85a9b39e7c99a7e8 (diff) |
Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad25c98b9a4884d5cc0edd4e290c4409.
Reason for revert: nanobench
Original change's description:
> Redefine the meaning of sample counts in GPU backend.
>
> Old: 0 -> nonMSAA
> 1+ -> MSAA
>
> New:
> 0 -> error/unsupported
> 1 -> nonMSAA
> 2+ -> MSAA
>
> We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:
>
> 1) SkSurface factories
> 2) GrBackendRenderTarget constructors
> 3) GrCaps::getSampleCnt()'s requestedCount parameter
>
> However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.
>
> This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.
>
>
> Bug: skia:
> Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
> Reviewed-on: https://skia-review.googlesource.com/101560
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/102662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/win/SkWGL.h | 8 | ||||
-rw-r--r-- | src/utils/win/SkWGL_win.cpp | 7 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/utils/win/SkWGL.h b/src/utils/win/SkWGL.h index cd19f2eeba..c6c9479abe 100644 --- a/src/utils/win/SkWGL.h +++ b/src/utils/win/SkWGL.h @@ -83,8 +83,7 @@ public: * priority are: * * Choose formats with the smallest sample count that is >= * desiredSampleCount (or the largest sample count if all formats have - * fewer samples than desiredSampleCount.) If desiredSampleCount is 1 then - * all msaa formats are excluded from consideration. + * fewer samples than desiredSampleCount.) * * Choose formats with the fewest color samples when coverage sampling * is available. * * If the above rules leave multiple formats, choose the one that @@ -131,9 +130,8 @@ enum SkWGLContextRequest { /** * Helper to create an OpenGL context for a DC using WGL. Configs with a sample count >= to * msaaSampleCount are preferred but if none is available then a context with a lower sample count - * (including non-MSAA) will be created. If msaaSampleCount is 1 then this will fail if a non-msaa - * context cannot be created. If preferCoreProfile is true but a core profile cannot be created - * then a compatible profile context will be created. + * (including non-MSAA) will be created. If preferCoreProfile is true but a core profile cannot be + * created then a compatible profile context will be created. */ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor, SkWGLContextRequest context, HGLRC shareContext = nullptr); diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp index 441d7a4ebb..b7c89944e0 100644 --- a/src/utils/win/SkWGL_win.cpp +++ b/src/utils/win/SkWGL_win.cpp @@ -126,7 +126,6 @@ int SkWGLExtensions::selectFormat(const int formats[], int formatCount, HDC dc, int desiredSampleCount) const { - SkASSERT(desiredSampleCount >= 1); if (formatCount <= 0) { return -1; } @@ -147,7 +146,7 @@ int SkWGLExtensions::selectFormat(const int formats[], &kQueryAttr, &numSamples); rankedFormats[i].fFormat = formats[i]; - rankedFormats[i].fSampleCnt = SkTMax(1, numSamples); + rankedFormats[i].fSampleCnt = numSamples; rankedFormats[i].fChoosePixelFormatRank = i; } SkTQSort(rankedFormats.begin(), @@ -160,10 +159,6 @@ int SkWGLExtensions::selectFormat(const int formats[], if (idx < 0) { idx = ~idx; } - // If the caller asked for non-MSAA fail if the closest format has MSAA. - if (desiredSampleCount == 1 && rankedFormats[idx].fSampleCnt != 1) { - return -1; - } return rankedFormats[idx].fFormat; } |