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

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: vk stubs Created 4 years, 9 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 29841331c01d308d45b7c1948db0dfe54547a4a6..ab9d699c50a4e1ff0d78c3b736ef6ec4f8da7180 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4138,6 +4138,39 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst,
return true;
}
+void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt,
+ const GrStencilSettings& stencil,
+ int* effectiveSampleCnt,
+ SkAutoTDeleteArray<SkPoint>* sampleLocations) {
+ 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);
+ }
+
+ SkASSERT(*effectiveSampleCnt >= rt->desc().fSampleCnt);
+
+ if (this->caps()->sampleLocationsSupport()) {
+ sampleLocations->reset(new SkPoint[*effectiveSampleCnt]);
+ for (int i = 0; i < *effectiveSampleCnt; ++i) {
+ GrGLfloat pos[2];
+ GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos));
+ if (kTopLeft_GrSurfaceOrigin == rt->origin()) {
+ (*sampleLocations)[i].set(pos[0], pos[1]);
+ } else {
+ (*sampleLocations)[i].set(pos[0], 1 - pos[1]);
+ }
+ }
+ }
+}
+
void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
SkASSERT(type);
switch (type) {
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698