aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-04-27 18:48:15 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-27 18:48:19 +0000
commite3bd422fafc74dd3410c3de24a576635be92c3b4 (patch)
tree63bc3f6768299f8e4dde996df333ea4022855efe /src
parentdf7e075c74110fcfebdc49ca503684162e118af5 (diff)
Revert "Plumb the use of GrBackendRenderTarget throughout Skia"
This reverts commit fdd77daedbba3b7c53be74a82fb9fae891b51696. Reason for revert: Apparently I have a few more build files to update before this can land. Original change's description: > Plumb the use of GrBackendRenderTarget throughout Skia > > Bug: skia: > Change-Id: Ib99a58d9552f5c7b8d77c09dcc72fa88326c26aa > Reviewed-on: https://skia-review.googlesource.com/14148 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Reviewed-by: Robert Phillips <robertphillips@google.com> > Commit-Queue: Greg Daniel <egdaniel@google.com> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I984e1909870182474c4c3cce257f01b6a9d8581f Reviewed-on: https://skia-review.googlesource.com/14531 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrBackendSurface.cpp31
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrContextPriv.h4
-rw-r--r--src/gpu/GrGpu.cpp7
-rw-r--r--src/gpu/GrGpu.h6
-rw-r--r--src/gpu/GrResourceProvider.cpp4
-rw-r--r--src/gpu/GrResourceProvider.h3
-rw-r--r--src/gpu/gl/GrGLGpu.cpp34
-rw-r--r--src/gpu/gl/GrGLGpu.h3
-rw-r--r--src/gpu/vk/GrVkGpu.cpp25
-rw-r--r--src/gpu/vk/GrVkGpu.h3
-rw-r--r--src/image/SkSurface_Gpu.cpp33
-rw-r--r--src/views/SkWindow.cpp34
13 files changed, 80 insertions, 113 deletions
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 6a1448e17c..97b3b6ee03 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -70,14 +70,14 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width,
int height,
int sampleCnt,
int stencilBits,
- const GrVkImageInfo& vkInfo)
+ const GrVkImageInfo* vkInfo)
: fWidth(width)
, fHeight(height)
, fSampleCnt(sampleCnt)
, fStencilBits(stencilBits)
, fConfig(
#ifdef SK_VULKAN
- GrVkFormatToPixelConfig(vkInfo.fFormat)
+ GrVkFormatToPixelConfig(vkInfo->fFormat)
#else
kUnknown_GrPixelConfig
#endif
@@ -90,7 +90,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width,
int sampleCnt,
int stencilBits,
GrPixelConfig config,
- const GrGLFramebufferInfo& glInfo)
+ const GrGLTextureInfo* glInfo)
: fWidth(width)
, fHeight(height)
, fSampleCnt(sampleCnt)
@@ -105,33 +105,26 @@ GrBackendRenderTarget::GrBackendRenderTarget(const GrBackendRenderTargetDesc& de
, fHeight(desc.fHeight)
, fSampleCnt(desc.fSampleCnt)
, fStencilBits(desc.fStencilBits)
- , fConfig(desc.fConfig)
- , fBackend(backend) {
- if (kOpenGL_GrBackend == backend) {
- fGLInfo = *reinterpret_cast<const GrGLFramebufferInfo*>(desc.fRenderTargetHandle);
- } else {
- SkASSERT(kVulkan_GrBackend == backend);
+ , fConfig(kVulkan_GrBackend == backend
#ifdef SK_VULKAN
- const GrVkImageInfo* vkInfo =
- reinterpret_cast<const GrVkImageInfo*>(desc.fRenderTargetHandle);
- fConfig = GrVkFormatToPixelConfig(vkInfo->fFormat);
- fVkInfo = *vkInfo;
+ ? GrVkFormatToPixelConfig(((GrVkImageInfo*)desc.fRenderTargetHandle)->fFormat)
#else
- fConfig = kUnknown_GrPixelConfig;
+ ? kUnknown_GrPixelConfig
#endif
- }
-}
+ : desc.fConfig)
+ , fBackend(backend)
+ , fHandle(desc.fRenderTargetHandle) {}
const GrVkImageInfo* GrBackendRenderTarget::getVkImageInfo() const {
if (kVulkan_GrBackend == fBackend) {
- return &fVkInfo;
+ return fVkInfo;
}
return nullptr;
}
-const GrGLFramebufferInfo* GrBackendRenderTarget::getGLFramebufferInfo() const {
+const GrGLTextureInfo* GrBackendRenderTarget::getGLTextureInfo() const {
if (kOpenGL_GrBackend == fBackend) {
- return &fGLInfo;
+ return fGLInfo;
}
return nullptr;
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index aa245b5672..a2f227226d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -702,14 +702,12 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetContext(
- const GrBackendRenderTarget& backendRT,
- GrSurfaceOrigin origin,
+ const GrBackendRenderTargetDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
- sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT,
- origin));
+ sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(desc));
if (!rt) {
return nullptr;
}
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 08b26e56d5..c85ac2c9b6 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -11,7 +11,6 @@
#include "GrContext.h"
#include "GrSurfaceContext.h"
-class GrBackendRenderTarget;
class GrSemaphore;
class GrSurfaceProxy;
class GrPreFlushCallbackObject;
@@ -53,8 +52,7 @@ public:
const SkSurfaceProps* = nullptr);
sk_sp<GrRenderTargetContext> makeBackendRenderTargetRenderTargetContext(
- const GrBackendRenderTarget&,
- GrSurfaceOrigin origin,
+ const GrBackendRenderTargetDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* = nullptr);
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 5ce8274215..4bf0c87bf1 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -223,13 +223,12 @@ sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex,
return tex;
}
-sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
- GrSurfaceOrigin origin) {
- if (!this->caps()->isConfigRenderable(backendRT.config(), backendRT.sampleCnt() > 0)) {
+sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
+ if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
return nullptr;
}
this->handleDirtyContext();
- return this->onWrapBackendRenderTarget(backendRT, origin);
+ return this->onWrapBackendRenderTarget(desc);
}
sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 000b32421b..523add5cb7 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -20,7 +20,6 @@
#include "SkTArray.h"
#include <map>
-class GrBackendRenderTarget;
class GrBuffer;
class GrContext;
struct GrContextOptions;
@@ -136,7 +135,7 @@ public:
/**
* Implements GrResourceProvider::wrapBackendRenderTarget
*/
- sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin);
+ sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc&);
/**
* Implements GrResourceProvider::wrapBackendTextureAsRenderTarget
@@ -557,8 +556,7 @@ private:
GrBackendTextureFlags,
int sampleCnt,
GrWrapOwnership) = 0;
- virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
- GrSurfaceOrigin) = 0;
+ virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) = 0;
virtual sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
GrSurfaceOrigin,
int sampleCnt)=0;
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index d7b90873ed..a250f6826f 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -254,10 +254,10 @@ sk_sp<GrTexture> GrResourceProvider::wrapBackendTexture(const GrBackendTexture&
}
sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendRenderTarget(
- const GrBackendRenderTarget& backendRT, GrSurfaceOrigin origin)
+ const GrBackendRenderTargetDesc& desc)
{
ASSERT_SINGLE_OWNER
- return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(backendRT, origin);
+ return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(desc);
}
void GrResourceProvider::assignUniqueKeyToResource(const GrUniqueKey& key,
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index e22a0d8428..c3d96ff803 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -12,7 +12,6 @@
#include "GrGpu.h"
#include "GrPathRange.h"
-class GrBackendRenderTarget;
class GrPath;
class GrRenderTarget;
class GrSingleOwner;
@@ -101,7 +100,7 @@ public:
*
* @return GrRenderTarget object or NULL on failure.
*/
- sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin);
+ sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
static const int kMinScratchTextureSize;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 646524a8e7..da3ec49a29 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -504,6 +504,17 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
}
}
+static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) {
+ // By default, GrRenderTargets are GL's normal orientation so that they
+ // can be drawn to by the outside world without the client having
+ // to render upside down.
+ if (kDefault_GrSurfaceOrigin == origin) {
+ return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
+ } else {
+ return origin;
+ }
+}
+
sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTex,
GrSurfaceOrigin origin,
GrBackendTextureFlags flags,
@@ -580,30 +591,23 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
}
}
-sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
- GrSurfaceOrigin origin) {
- const GrGLFramebufferInfo* info = backendRT.getGLFramebufferInfo();
- if (!info) {
- return nullptr;
- }
-
+sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc){
GrGLRenderTarget::IDDesc idDesc;
- idDesc.fRTFBOID = info->fFBOID;
+ idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
idDesc.fMSColorRenderbufferID = 0;
idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
idDesc.fIsMixedSampled = false;
GrSurfaceDesc desc;
- desc.fConfig = backendRT.config();
+ desc.fConfig = wrapDesc.fConfig;
desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
- desc.fWidth = backendRT.width();
- desc.fHeight = backendRT.height();
- desc.fSampleCnt = SkTMin(backendRT.sampleCnt(), this->caps()->maxSampleCount());
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- desc.fOrigin = origin;
+ desc.fWidth = wrapDesc.fWidth;
+ desc.fHeight = wrapDesc.fHeight;
+ desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount());
+ desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
- return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, backendRT.stencilBits());
+ return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, wrapDesc.fStencilBits);
}
sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index f74673faf0..f7e75cc2e7 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -176,8 +176,7 @@ private:
GrBackendTextureFlags,
int sampleCnt,
GrWrapOwnership) override;
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
- GrSurfaceOrigin origin) override;
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) override;
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
GrSurfaceOrigin,
int sampleCnt) override;
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 1eec506a42..be5b0c7f49 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -815,36 +815,32 @@ sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
return GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(this, surfDesc, ownership, info);
}
-sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
- GrSurfaceOrigin origin){
+sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc){
// Currently the Vulkan backend does not support wrapping of msaa render targets directly. In
// general this is not an issue since swapchain images in vulkan are never multisampled. Thus if
// you want a multisampled RT it is best to wrap the swapchain images and then let Skia handle
// creating and owning the MSAA images.
- if (backendRT.sampleCnt()) {
+ if (wrapDesc.fSampleCnt) {
return nullptr;
}
- const GrVkImageInfo* info = backendRT.getVkImageInfo();
- if (!info) {
- return nullptr;
- }
+ const GrVkImageInfo* info =
+ reinterpret_cast<const GrVkImageInfo*>(wrapDesc.fRenderTargetHandle);
if (VK_NULL_HANDLE == info->fImage) {
return nullptr;
}
GrSurfaceDesc desc;
- desc.fConfig = backendRT.config();
+ desc.fConfig = wrapDesc.fConfig;
desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
- desc.fWidth = backendRT.width();
- desc.fHeight = backendRT.height();
+ desc.fWidth = wrapDesc.fWidth;
+ desc.fHeight = wrapDesc.fHeight;
desc.fSampleCnt = 0;
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- desc.fOrigin = origin;
+ desc.fOrigin = resolve_origin(wrapDesc.fOrigin);
sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, info);
- if (tgt && backendRT.stencilBits()) {
+ if (tgt && wrapDesc.fStencilBits) {
if (!createStencilAttachmentForRenderTarget(tgt.get(), desc.fWidth, desc.fHeight)) {
return nullptr;
}
@@ -857,9 +853,6 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
int sampleCnt) {
const GrVkImageInfo* info = tex.getVkImageInfo();
- if (!info) {
- return nullptr;
- }
if (VK_NULL_HANDLE == info->fImage) {
return nullptr;
}
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 6ae34bd105..d3e155581e 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -180,8 +180,7 @@ private:
GrBackendTextureFlags,
int sampleCnt,
GrWrapOwnership) override;
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
- GrSurfaceOrigin) override;
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) override;
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
GrSurfaceOrigin,
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 5001811cea..96ac31e16c 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -261,36 +261,19 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
if (!context) {
return nullptr;
}
-
- GrBackendRenderTarget backendRT(desc, context->contextPriv().getBackend());
- return MakeFromBackendRenderTarget(context, backendRT, desc.fOrigin,
- std::move(colorSpace), props);
-
-}
-
-sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
- const GrBackendRenderTarget& backendRT,
- GrSurfaceOrigin origin,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
- if (!context) {
- return nullptr;
- }
- if (!SkSurface_Gpu::Valid(context, backendRT.config(), colorSpace.get())) {
+ if (!SkSurface_Gpu::Valid(context, desc.fConfig, colorSpace.get())) {
return nullptr;
}
sk_sp<GrRenderTargetContext> rtc(
- context->contextPriv().makeBackendRenderTargetRenderTargetContext(backendRT,
- origin,
+ context->contextPriv().makeBackendRenderTargetRenderTargetContext(desc,
std::move(colorSpace),
props));
if (!rtc) {
return nullptr;
}
- sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc),
- backendRT.width(), backendRT.height(),
+ sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), desc.fWidth, desc.fHeight,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return nullptr;
@@ -299,6 +282,16 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
+sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*,
+ const GrBackendRenderTarget&,
+ GrSurfaceOrigin origin,
+ sk_sp<SkColorSpace>,
+ const SkSurfaceProps*) {
+ // This function is not implemented yet
+ sk_throw();
+ return nullptr;
+}
+
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
const GrBackendTextureDesc& desc,
sk_sp<SkColorSpace> colorSpace,
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index ba06a1f3c2..f86bb9f9ef 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -316,7 +316,6 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
#if SK_SUPPORT_GPU
-#include "GrBackendSurface.h"
#include "GrContext.h"
#include "gl/GrGLInterface.h"
#include "gl/GrGLUtil.h"
@@ -325,9 +324,10 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
sk_sp<SkSurface> SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachmentInfo,
const GrGLInterface* interface,
GrContext* grContext) {
- int width = SkScalarRoundToInt(this->width());
- int height = SkScalarRoundToInt(this->height());
- if (0 == width || 0 == height) {
+ GrBackendRenderTargetDesc desc;
+ desc.fWidth = SkScalarRoundToInt(this->width());
+ desc.fHeight = SkScalarRoundToInt(this->height());
+ if (0 == desc.fWidth || 0 == desc.fHeight) {
return nullptr;
}
@@ -340,28 +340,22 @@ sk_sp<SkSurface> SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachment
//
// ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversion on write,
// so pretend that it's non-sRGB 8888:
- GrPixelConfig config = grContext->caps()->srgbSupport() &&
- info().colorSpace() &&
- (attachmentInfo.fColorBits != 30)
- ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
- GrGLFramebufferInfo fbInfo;
+ desc.fConfig =
+ grContext->caps()->srgbSupport() &&
+ info().colorSpace() &&
+ (attachmentInfo.fColorBits != 30)
+ ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ desc.fSampleCnt = attachmentInfo.fSampleCount;
+ desc.fStencilBits = attachmentInfo.fStencilBits;
GrGLint buffer;
GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
- fbInfo.fFBOID = buffer;
-
- GrBackendRenderTarget backendRT(width,
- height,
- attachmentInfo.fSampleCount,
- attachmentInfo.fStencilBits,
- config,
- fbInfo);
-
+ desc.fRenderTargetHandle = buffer;
sk_sp<SkColorSpace> colorSpace =
grContext->caps()->srgbSupport() && info().colorSpace()
? SkColorSpace::MakeSRGB() : nullptr;
- return SkSurface::MakeFromBackendRenderTarget(grContext, backendRT, kBottomLeft_GrSurfaceOrigin,
- colorSpace, &fSurfaceProps);
+ return SkSurface::MakeFromBackendRenderTarget(grContext, desc, colorSpace, &fSurfaceProps);
}
#endif