Restore support for multisample locations
Bug: skia:
Change-Id: I971455867e54d431cc1094fca041f773f78748ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196218
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index a61f48b..1ae4a41 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3918,6 +3918,23 @@
return true;
}
+void GrGLGpu::querySampleLocations(
+ GrRenderTarget* renderTarget, const GrStencilSettings& stencilSettings,
+ SkTArray<SkPoint>* sampleLocations) {
+ this->flushStencil(stencilSettings);
+ this->flushHWAAState(renderTarget, true);
+ this->flushRenderTarget(static_cast<GrGLRenderTarget*>(renderTarget));
+
+ int effectiveSampleCnt;
+ GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, &effectiveSampleCnt);
+ SkASSERT(effectiveSampleCnt >= renderTarget->numStencilSamples());
+
+ sampleLocations->reset(effectiveSampleCnt);
+ for (int i = 0; i < effectiveSampleCnt; ++i) {
+ GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, &(*sampleLocations)[i].fX));
+ }
+}
+
void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
SkASSERT(type);
switch (type) {
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 5c23924..497ea89 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -184,6 +184,9 @@
void onResetTextureBindings() override;
+ void querySampleLocations(
+ GrRenderTarget*, const GrStencilSettings&, SkTArray<SkPoint>*) override;
+
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index ade5b49..2cb5726 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -81,7 +81,7 @@
// Get GrGLProgramDesc
GrProgramDesc desc;
- if (!GrProgramDesc::Build(&desc, renderTarget->config(), primProc, isPoints, pipeline, gpu)) {
+ if (!GrProgramDesc::Build(&desc, renderTarget, primProc, isPoints, pipeline, gpu)) {
GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n");
return nullptr;
}