Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2079)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1717393002: Add "sample locations" feature to GrProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_getmultisamp
Patch Set: assert Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 73d219d03323dcc863786736df427dd4ad7e0348..bfed57e88191c1d9aff6d19decba8d09b0e00bad 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3783,6 +3783,33 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst,
return true;
}
+void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt,
+ const GrStencilSettings& stencil,
+ int* effectiveSampleCnt,
+ SamplePattern* pattern) {
+ SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachment() ||
+ stencil.isDisabled());
+
+ this->flushStencil(stencil);
+ this->flushHWAAState(rt, true, !stencil.isDisabled());
+ this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyIRect());
+
+ if (0 != this->caps()->maxRasterSamples()) {
+ GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, effectiveSampleCnt);
+ } else {
+ GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt);
+ }
+ if (this->caps()->sampleLocationsSupport()) {
+ pattern->reset(*effectiveSampleCnt);
+ for (int i = 0; i < *effectiveSampleCnt; ++i) {
+ GrGLfloat pos[2];
+ GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos));
+ // OpenGL pixel space and Skia device space have inverted y directions.
+ (*pattern)[i].set(pos[0] - 0.5f, 0.5f - pos[1]);
Mark Kilgard 2016/02/22 18:41:04 so do samples in Skia are in a [-0.5, 0.5) range w
Chris Dalton 2016/02/22 19:10:43 The 0.5, 0.5 offset was added by me just because i
bsalomon 2016/02/22 20:28:26 Skia's device coordinates have integers at the bor
Chris Dalton 2016/02/22 21:19:11 Agreed. Now that I think about it I also prefer 0.
Chris Dalton 2016/02/22 22:17:55 Done.
+ }
+ }
+}
+
void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
SkASSERT(type);
switch (type) {

Powered by Google App Engine
This is Rietveld 408576698