diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-01 14:16:02 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 21:15:39 +0000 |
commit | d0d7270fcc32546005b8e847df516cb11592cd30 (patch) | |
tree | 032f102536ecb8e665c348b733b230a062a1c010 /src/utils | |
parent | 2331c82e0d10ee519d9afb3f9e85485c6cf0b3c3 (diff) |
Revert "Revert "Redefine the meaning of sample counts in GPU backend.""
Fixes gpu config default samples to be 1 and updates config parsing test accordingly.
This reverts commit c1ce2f7966babaae0deb150f93f1227ee5af9285.
Bug: skia:
Change-Id: I456973b1f52ced85a2011ea10fc49449bfc5846f
Reviewed-on: https://skia-review.googlesource.com/102147
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, 11 insertions, 4 deletions
diff --git a/src/utils/win/SkWGL.h b/src/utils/win/SkWGL.h index c6c9479abe..cd19f2eeba 100644 --- a/src/utils/win/SkWGL.h +++ b/src/utils/win/SkWGL.h @@ -83,7 +83,8 @@ 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.) + * fewer samples than desiredSampleCount.) If desiredSampleCount is 1 then + * all msaa formats are excluded from consideration. * * Choose formats with the fewest color samples when coverage sampling * is available. * * If the above rules leave multiple formats, choose the one that @@ -130,8 +131,9 @@ 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 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 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. */ 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 b7c89944e0..441d7a4ebb 100644 --- a/src/utils/win/SkWGL_win.cpp +++ b/src/utils/win/SkWGL_win.cpp @@ -126,6 +126,7 @@ int SkWGLExtensions::selectFormat(const int formats[], int formatCount, HDC dc, int desiredSampleCount) const { + SkASSERT(desiredSampleCount >= 1); if (formatCount <= 0) { return -1; } @@ -146,7 +147,7 @@ int SkWGLExtensions::selectFormat(const int formats[], &kQueryAttr, &numSamples); rankedFormats[i].fFormat = formats[i]; - rankedFormats[i].fSampleCnt = numSamples; + rankedFormats[i].fSampleCnt = SkTMax(1, numSamples); rankedFormats[i].fChoosePixelFormatRank = i; } SkTQSort(rankedFormats.begin(), @@ -159,6 +160,10 @@ 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; } |