aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrSurface.h9
-rw-r--r--src/gpu/GrAHardwareBufferImageGenerator.cpp1
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.cpp11
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.h5
-rw-r--r--src/gpu/GrContext.cpp27
-rw-r--r--src/gpu/GrDrawingManager.cpp2
-rw-r--r--src/gpu/GrGpu.cpp71
-rw-r--r--src/gpu/GrGpu.h57
-rw-r--r--src/gpu/GrOpFlushState.cpp8
-rw-r--r--src/gpu/GrPipeline.cpp1
-rw-r--r--src/gpu/GrResourceProvider.cpp19
-rw-r--r--src/gpu/GrResourceProvider.h5
-rw-r--r--src/gpu/GrSurfaceProxy.cpp10
-rw-r--r--src/gpu/GrTexture.cpp31
-rw-r--r--src/gpu/GrTexturePriv.h2
-rw-r--r--src/gpu/gl/GrGLGpu.cpp201
-rw-r--r--src/gpu/gl/GrGLGpu.h68
-rw-r--r--src/gpu/gl/GrGLGpuCommandBuffer.h14
-rw-r--r--src/gpu/gl/GrGLProgram.cpp20
-rw-r--r--src/gpu/gl/GrGLProgram.h2
-rw-r--r--src/gpu/mock/GrMockGpu.h30
-rw-r--r--src/gpu/mock/GrMockTexture.h2
-rw-r--r--src/gpu/mtl/GrMtlGpu.h27
-rw-r--r--src/gpu/ops/GrClearOp.cpp14
-rw-r--r--src/gpu/ops/GrCopySurfaceOp.cpp5
-rw-r--r--src/gpu/vk/GrVkCopyManager.cpp13
-rw-r--r--src/gpu/vk/GrVkCopyManager.h8
-rw-r--r--src/gpu/vk/GrVkGpu.cpp141
-rw-r--r--src/gpu/vk/GrVkGpu.h67
-rw-r--r--src/gpu/vk/GrVkGpuCommandBuffer.cpp16
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp5
-rw-r--r--src/gpu/vk/GrVkPipeline.h2
-rw-r--r--src/image/SkImage_Gpu.cpp7
-rw-r--r--tests/GrSurfaceTest.cpp2
-rw-r--r--tests/ProxyConversionTest.cpp2
-rw-r--r--tests/ProxyTest.cpp4
-rw-r--r--tests/ResourceAllocatorTest.cpp7
-rw-r--r--tests/ResourceCacheTest.cpp11
-rwxr-xr-xtests/TransferPixelsTest.cpp4
-rw-r--r--tests/VkWrapTests.cpp59
40 files changed, 546 insertions, 444 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 65ac7ec337..4caa842b4a 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -35,6 +35,11 @@ public:
*/
SkRect getBoundsRect() const { return SkRect::MakeIWH(this->width(), this->height()); }
+ GrSurfaceOrigin origin() const {
+ SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
+ return fOrigin;
+ }
+
/**
* Retrieves the pixel config specified when the surface was created.
* For render targets this can be kUnknown_GrPixelConfig
@@ -76,7 +81,8 @@ protected:
: INHERITED(gpu)
, fConfig(desc.fConfig)
, fWidth(desc.fWidth)
- , fHeight(desc.fHeight) {}
+ , fHeight(desc.fHeight)
+ , fOrigin(desc.fOrigin) {}
~GrSurface() override {}
@@ -87,6 +93,7 @@ private:
GrPixelConfig fConfig;
int fWidth;
int fHeight;
+ GrSurfaceOrigin fOrigin;
typedef GrGpuResource INHERITED;
};
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index ba8e9d7486..ca74772158 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -192,6 +192,7 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont
return nullptr;
}
sk_sp<GrTexture> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
kAdopt_GrWrapOwnership);
if (!tex) {
glDeleteTextures(1, &texID);
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 22cdec395a..ac4fee37ac 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -54,8 +54,7 @@ static GrBackendTexture make_backend_texture_from_handle(GrBackend backend,
}
std::unique_ptr<SkImageGenerator>
-GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, GrSurfaceOrigin origin,
- sk_sp<GrSemaphore> semaphore,
+GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, sk_sp<GrSemaphore> semaphore,
SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace) {
if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
return nullptr;
@@ -83,12 +82,11 @@ GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, GrSurfaceOrigin o
SkImageInfo info = SkImageInfo::Make(texture->width(), texture->height(), colorType, alphaType,
std::move(colorSpace));
return std::unique_ptr<SkImageGenerator>(new GrBackendTextureImageGenerator(
- info, texture.get(), origin, context->uniqueID(), std::move(semaphore), backendTexture));
+ info, texture.get(), context->uniqueID(), std::move(semaphore), backendTexture));
}
GrBackendTextureImageGenerator::GrBackendTextureImageGenerator(const SkImageInfo& info,
GrTexture* texture,
- GrSurfaceOrigin origin,
uint32_t owningContextID,
sk_sp<GrSemaphore> semaphore,
const GrBackendTexture& backendTex)
@@ -97,7 +95,7 @@ GrBackendTextureImageGenerator::GrBackendTextureImageGenerator(const SkImageInfo
, fSemaphore(std::move(semaphore))
, fLastBorrowingContextID(SK_InvalidGenID)
, fBackendTexture(backendTex)
- , fSurfaceOrigin(origin) { }
+ , fSurfaceOrigin(texture->origin()) { }
GrBackendTextureImageGenerator::~GrBackendTextureImageGenerator() {
fRefHelper->unref();
@@ -148,13 +146,12 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
}
}
- SkASSERT(kDefault_GrSurfaceOrigin != fSurfaceOrigin);
// We just gained access to the texture. If we're on the original context, we could use the
// original texture, but we'd have no way of detecting that it's no longer in-use. So we
// always make a wrapped copy, where the release proc informs us that the context is done
// with it. This is unfortunate - we'll have two texture objects referencing the same GPU
// object. However, no client can ever see the original texture, so this should be safe.
- tex = context->resourceProvider()->wrapBackendTexture(fBackendTexture,
+ tex = context->resourceProvider()->wrapBackendTexture(fBackendTexture, fSurfaceOrigin,
kBorrow_GrWrapOwnership);
if (!tex) {
fRefHelper->fBorrowingContextID = SK_InvalidGenID;
diff --git a/src/gpu/GrBackendTextureImageGenerator.h b/src/gpu/GrBackendTextureImageGenerator.h
index f99055ab86..1124b9628b 100644
--- a/src/gpu/GrBackendTextureImageGenerator.h
+++ b/src/gpu/GrBackendTextureImageGenerator.h
@@ -16,8 +16,7 @@ class GrSemaphore;
class GrBackendTextureImageGenerator : public SkImageGenerator {
public:
- static std::unique_ptr<SkImageGenerator> Make(sk_sp<GrTexture>, GrSurfaceOrigin,
- sk_sp<GrSemaphore>,
+ static std::unique_ptr<SkImageGenerator> Make(sk_sp<GrTexture>, sk_sp<GrSemaphore>,
SkAlphaType, sk_sp<SkColorSpace>);
~GrBackendTextureImageGenerator() override;
@@ -34,7 +33,7 @@ protected:
#endif
private:
- GrBackendTextureImageGenerator(const SkImageInfo& info, GrTexture*, GrSurfaceOrigin,
+ GrBackendTextureImageGenerator(const SkImageInfo& info, GrTexture*,
uint32_t owningContextID, sk_sp<GrSemaphore>,
const GrBackendTexture&);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index cd8aa7b94a..347f0b5153 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -433,7 +433,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst,
GrGpu::DrawPreference drawPreference = premulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference
: GrGpu::kNoDraw_DrawPreference;
GrGpu::WritePixelTempDrawInfo tempDrawInfo;
- if (!fContext->fGpu->getWritePixelsInfo(dstSurface, dstProxy->origin(), width, height,
+ if (!fContext->fGpu->getWritePixelsInfo(dstSurface, width, height,
srcConfig, &drawPreference, &tempDrawInfo)) {
return false;
}
@@ -486,8 +486,8 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst,
return false;
}
GrTexture* texture = tempProxy->priv().peekTexture();
- if (!fContext->fGpu->writePixels(texture, tempProxy->origin(), 0, 0, width, height,
- tempDrawInfo.fWriteConfig, buffer, rowBytes)) {
+ if (!fContext->fGpu->writePixels(texture, 0, 0, width, height, tempDrawInfo.fWriteConfig,
+ buffer, rowBytes)) {
return false;
}
SkMatrix matrix;
@@ -509,8 +509,8 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst,
this->flushSurfaceWrites(renderTargetContext->asRenderTargetProxy());
}
} else {
- return fContext->fGpu->writePixels(dstSurface, dstProxy->origin(), left, top, width,
- height, srcConfig, buffer, rowBytes);
+ return fContext->fGpu->writePixels(dstSurface, left, top, width, height, srcConfig,
+ buffer, rowBytes);
}
return true;
}
@@ -564,7 +564,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
GrGpu::DrawPreference drawPreference = unpremulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference
: GrGpu::kNoDraw_DrawPreference;
GrGpu::ReadPixelTempDrawInfo tempDrawInfo;
- if (!fContext->fGpu->getReadPixelsInfo(srcSurface, srcProxy->origin(), width, height, rowBytes,
+ if (!fContext->fGpu->getReadPixelsInfo(srcSurface, width, height, rowBytes,
dstConfig, &drawPreference, &tempDrawInfo)) {
return false;
}
@@ -641,7 +641,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
this->flushSurfaceWrites(proxyToRead.get());
configToRead = tempDrawInfo.fReadConfig;
}
- if (!fContext->fGpu->readPixels(surfaceToRead, proxyToRead->origin(),
+ if (!fContext->fGpu->readPixels(surfaceToRead,
left, top, width, height, configToRead, buffer, rowBytes)) {
return false;
}
@@ -742,8 +742,7 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
sk_sp<SkColorSpace> colorSpace) {
ASSERT_SINGLE_OWNER_PRIV
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(tex));
+ sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(tex, origin));
if (!surface) {
return nullptr;
}
@@ -764,10 +763,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
const SkSurfaceProps* props) {
ASSERT_SINGLE_OWNER_PRIV
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
-
sk_sp<GrSurface> surface(
- fContext->resourceProvider()->wrapRenderableBackendTexture(tex, sampleCnt));
+ fContext->resourceProvider()->wrapRenderableBackendTexture(tex, origin, sampleCnt));
if (!surface) {
return nullptr;
}
@@ -788,8 +785,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT));
+ sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT,
+ origin));
if (!rt) {
return nullptr;
}
@@ -812,9 +809,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsRenderTarget(
tex,
+ origin,
sampleCnt));
if (!surface) {
return nullptr;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 809063ba11..eeb107118c 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -220,7 +220,7 @@ void GrDrawingManager::prepareSurfaceForExternalIO(GrSurfaceProxy* proxy) {
GrSurface* surface = proxy->priv().peekSurface();
if (fContext->getGpu() && surface->asRenderTarget()) {
- fContext->getGpu()->resolveRenderTarget(surface->asRenderTarget(), proxy->origin());
+ fContext->getGpu()->resolveRenderTarget(surface->asRenderTarget());
}
}
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 50bb776182..3487f6fea0 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -68,6 +68,17 @@ bool GrGpu::isACopyNeededForTextureParams(int width, int height,
return false;
}
+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;
+ }
+}
+
/**
* Prior to creating a texture, make sure the type of texture being created is
* supported by calling check_texture_creation_params.
@@ -135,7 +146,8 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted
desc.fSampleCnt = caps->getSampleCount(desc.fSampleCnt, desc.fConfig);
// Attempt to catch un- or wrongly initialized sample counts.
SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
- SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
+
+ desc.fOrigin = resolve_origin(desc.fOrigin, isRT);
if (mipLevelCount && (desc.fFlags & kPerformInitialClear_GrSurfaceFlag)) {
return nullptr;
@@ -162,6 +174,7 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, SkBudgeted budg
}
sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex,
+ GrSurfaceOrigin origin,
GrWrapOwnership ownership) {
this->handleDirtyContext();
if (!this->caps()->isConfigTexturable(backendTex.config())) {
@@ -171,7 +184,7 @@ sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex,
backendTex.height() > this->caps()->maxTextureSize()) {
return nullptr;
}
- sk_sp<GrTexture> tex = this->onWrapBackendTexture(backendTex, ownership);
+ sk_sp<GrTexture> tex = this->onWrapBackendTexture(backendTex, origin, ownership);
if (!tex) {
return nullptr;
}
@@ -179,7 +192,8 @@ sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex,
}
sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& backendTex,
- int sampleCnt, GrWrapOwnership ownership) {
+ GrSurfaceOrigin origin, int sampleCnt,
+ GrWrapOwnership ownership) {
this->handleDirtyContext();
if (!this->caps()->isConfigTexturable(backendTex.config()) ||
!this->caps()->isConfigRenderable(backendTex.config(), sampleCnt > 0)) {
@@ -191,7 +205,7 @@ sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& bac
return nullptr;
}
sk_sp<GrTexture> tex =
- this->onWrapRenderableBackendTexture(backendTex, sampleCnt, ownership);
+ this->onWrapRenderableBackendTexture(backendTex, origin, sampleCnt, ownership);
if (!tex) {
return nullptr;
}
@@ -205,15 +219,17 @@ sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& bac
return tex;
}
-sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTarget& backendRT) {
+sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
+ GrSurfaceOrigin origin) {
if (!this->caps()->isConfigRenderable(backendRT.config(), backendRT.sampleCnt() > 0)) {
return nullptr;
}
this->handleDirtyContext();
- return this->onWrapBackendRenderTarget(backendRT);
+ return this->onWrapBackendRenderTarget(backendRT, origin);
}
sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
int sampleCnt) {
this->handleDirtyContext();
if (!this->caps()->isConfigRenderable(tex.config(), sampleCnt > 0)) {
@@ -223,7 +239,7 @@ sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTex
if (tex.width() > maxSize || tex.height() > maxSize) {
return nullptr;
}
- return this->onWrapBackendTextureAsRenderTarget(tex, sampleCnt);
+ return this->onWrapBackendTextureAsRenderTarget(tex, origin, sampleCnt);
}
GrBuffer* GrGpu::createBuffer(size_t size, GrBufferType intendedType,
@@ -246,9 +262,10 @@ gr_instanced::InstancedRendering* GrGpu::createInstancedRendering() {
return this->onCreateInstancedRendering();
}
-bool GrGpu::copySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) {
+bool GrGpu::copySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
GR_CREATE_TRACE_MARKER_CONTEXT("GrGpu", "copySurface", fContext);
SkASSERT(dst && src);
this->handleDirtyContext();
@@ -256,11 +273,10 @@ bool GrGpu::copySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
if (GrPixelConfigIsSint(dst->config()) != GrPixelConfigIsSint(src->config())) {
return false;
}
- return this->onCopySurface(dst, dstOrigin, src, srcOrigin, srcRect, dstPoint);
+ return this->onCopySurface(dst, src, srcRect, dstPoint);
}
-bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int width, int height, size_t rowBytes,
+bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference* drawPreference,
ReadPixelTempDrawInfo* tempDrawInfo) {
SkASSERT(drawPreference);
@@ -274,8 +290,8 @@ bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
return false;
}
- if (!this->onGetReadPixelsInfo(srcSurface, srcOrigin, width, height, rowBytes, readConfig,
- drawPreference, tempDrawInfo)) {
+ if (!this->onGetReadPixelsInfo(srcSurface, width, height, rowBytes, readConfig, drawPreference,
+ tempDrawInfo)) {
return false;
}
@@ -291,8 +307,7 @@ bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
return true;
}
-bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference* drawPreference,
WritePixelTempDrawInfo* tempDrawInfo) {
SkASSERT(drawPreference);
@@ -300,7 +315,7 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
SkASSERT(dstSurface);
SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference);
- if (!this->onGetWritePixelsInfo(dstSurface, dstOrigin, width, height, srcConfig, drawPreference,
+ if (!this->onGetWritePixelsInfo(dstSurface, width, height, srcConfig, drawPreference,
tempDrawInfo)) {
return false;
}
@@ -318,7 +333,7 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
return true;
}
-bool GrGpu::readPixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrGpu::readPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, void* buffer,
size_t rowBytes) {
@@ -339,13 +354,13 @@ bool GrGpu::readPixels(GrSurface* surface, GrSurfaceOrigin origin,
this->handleDirtyContext();
- return this->onReadPixels(surface, origin,
+ return this->onReadPixels(surface,
left, top, width, height,
config, buffer,
rowBytes);
}
-bool GrGpu::writePixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrGpu::writePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const GrMipLevel texels[], int mipLevelCount) {
SkASSERT(surface);
@@ -373,8 +388,7 @@ bool GrGpu::writePixels(GrSurface* surface, GrSurfaceOrigin origin,
}
this->handleDirtyContext();
- if (this->onWritePixels(surface, origin, left, top, width, height, config,
- texels, mipLevelCount)) {
+ if (this->onWritePixels(surface, left, top, width, height, config, texels, mipLevelCount)) {
SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
this->didWriteToSurface(surface, &rect, mipLevelCount);
fStats.incTextureUploads();
@@ -383,13 +397,13 @@ bool GrGpu::writePixels(GrSurface* surface, GrSurfaceOrigin origin,
return false;
}
-bool GrGpu::writePixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrGpu::writePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes) {
GrMipLevel mipLevel = { buffer, rowBytes };
- return this->writePixels(surface, origin, left, top, width, height, config, &mipLevel, 1);
+ return this->writePixels(surface, left, top, width, height, config, &mipLevel, 1);
}
bool GrGpu::transferPixels(GrTexture* texture,
@@ -422,10 +436,10 @@ bool GrGpu::transferPixels(GrTexture* texture,
return false;
}
-void GrGpu::resolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin origin) {
+void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
SkASSERT(target);
this->handleDirtyContext();
- this->onResolveRenderTarget(target, origin);
+ this->onResolveRenderTarget(target);
}
void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_t mipLevels) const {
@@ -456,8 +470,7 @@ const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(const GrPipeline& pi
int effectiveSampleCnt;
SkSTArray<16, SkPoint, true> pattern;
- this->onQueryMultisampleSpecs(rt, pipeline.proxy()->origin(), stencil,
- &effectiveSampleCnt, &pattern);
+ this->onQueryMultisampleSpecs(rt, stencil, &effectiveSampleCnt, &pattern);
SkASSERT(effectiveSampleCnt >= rt->numStencilSamples());
uint8_t id;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index e10bc6f374..27a2d7958e 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -118,23 +118,24 @@ public:
/**
* Implements GrResourceProvider::wrapBackendTexture
*/
- sk_sp<GrTexture> wrapBackendTexture(const GrBackendTexture&, GrWrapOwnership);
+ sk_sp<GrTexture> wrapBackendTexture(const GrBackendTexture&, GrSurfaceOrigin, GrWrapOwnership);
/**
* Implements GrResourceProvider::wrapRenderableBackendTexture
*/
- sk_sp<GrTexture> wrapRenderableBackendTexture(const GrBackendTexture&,
+ sk_sp<GrTexture> wrapRenderableBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
int sampleCnt, GrWrapOwnership);
/**
* Implements GrResourceProvider::wrapBackendRenderTarget
*/
- sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&);
+ sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin);
/**
* Implements GrResourceProvider::wrapBackendTextureAsRenderTarget
*/
sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt);
/**
@@ -159,7 +160,7 @@ public:
/**
* Resolves MSAA.
*/
- void resolveRenderTarget(GrRenderTarget*, GrSurfaceOrigin);
+ void resolveRenderTarget(GrRenderTarget* target);
/** Info struct returned by getReadPixelsInfo about performing intermediate draws before
reading pixels for performance or correctness. */
@@ -209,8 +210,7 @@ public:
* that would allow a successful readPixels call. The passed width, height, and rowBytes,
* must be non-zero and already reflect clipping to the src bounds.
*/
- bool getReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
+ bool getReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*, ReadPixelTempDrawInfo*);
/** Info struct returned by getWritePixelsInfo about performing an intermediate draw in order
@@ -236,7 +236,7 @@ public:
* that would allow a successful transfer of the src pixels to the dst. The passed width,
* height, and rowBytes, must be non-zero and already reflect clipping to the dst bounds.
*/
- bool getWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin, int width, int height,
+ bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*, WritePixelTempDrawInfo*);
/**
@@ -258,7 +258,7 @@ public:
* because of a unsupported pixel config or because no render
* target is currently set.
*/
- bool readPixels(GrSurface* surface, GrSurfaceOrigin,
+ bool readPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, void* buffer, size_t rowBytes);
@@ -274,7 +274,7 @@ public:
* @param texels array of mipmap levels containing texture data
* @param mipLevelCount number of levels in 'texels'
*/
- bool writePixels(GrSurface* surface, GrSurfaceOrigin origin,
+ bool writePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount);
@@ -287,7 +287,7 @@ public:
* @param rowBytes number of bytes between consecutive rows. Zero
* means rows are tightly packed.
*/
- bool writePixels(GrSurface* surface, GrSurfaceOrigin origin,
+ bool writePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes);
@@ -333,8 +333,8 @@ public:
// take place at the GrOpList level and this function implement faster copy paths. The rect
// and point are pre-clipped. The src rect and implied dst rect are guaranteed to be within the
// src/dst bounds and non-empty.
- bool copySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+ bool copySurface(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
@@ -548,13 +548,18 @@ private:
const GrMipLevel texels[],
int mipLevelCount) = 0;
- virtual sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) = 0;
+ virtual sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrWrapOwnership) = 0;
virtual sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt,
GrWrapOwnership) = 0;
- virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) = 0;
+ virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
+ GrSurfaceOrigin) = 0;
virtual sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) = 0;
+ GrSurfaceOrigin,
+ int sampleCnt)=0;
virtual GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPattern,
const void* data) = 0;
@@ -569,17 +574,15 @@ private:
return false;
}
- virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight,
+ virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight,
size_t rowBytes, GrPixelConfig readConfig, DrawPreference*,
ReadPixelTempDrawInfo*) = 0;
- virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+ virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*,
WritePixelTempDrawInfo*) = 0;
// overridden by backend-specific derived class to perform the surface read
- virtual bool onReadPixels(GrSurface*, GrSurfaceOrigin,
+ virtual bool onReadPixels(GrSurface*,
int left, int top,
int width, int height,
GrPixelConfig,
@@ -587,7 +590,7 @@ private:
size_t rowBytes) = 0;
// overridden by backend-specific derived class to perform the surface write
- virtual bool onWritePixels(GrSurface*, GrSurfaceOrigin,
+ virtual bool onWritePixels(GrSurface*,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount) = 0;
@@ -599,16 +602,16 @@ private:
size_t offset, size_t rowBytes) = 0;
// overridden by backend-specific derived class to perform the resolve
- virtual void onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin) = 0;
+ virtual void onResolveRenderTarget(GrRenderTarget* target) = 0;
// overridden by backend specific derived class to perform the copy surface
- virtual bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) = 0;
+ virtual bool onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) = 0;
// overridden by backend specific derived class to perform the multisample queries
- virtual void onQueryMultisampleSpecs(GrRenderTarget*, GrSurfaceOrigin rtOrigin,
- const GrStencilSettings&,
+ virtual void onQueryMultisampleSpecs(GrRenderTarget*, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) = 0;
void resetContext() {
diff --git a/src/gpu/GrOpFlushState.cpp b/src/gpu/GrOpFlushState.cpp
index 08077048fe..30636a4413 100644
--- a/src/gpu/GrOpFlushState.cpp
+++ b/src/gpu/GrOpFlushState.cpp
@@ -58,10 +58,10 @@ void GrOpFlushState::doUpload(GrDrawOp::DeferredUploadFn& upload) {
GrSurface* surface = proxy->priv().peekSurface();
GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference;
GrGpu::WritePixelTempDrawInfo tempInfo;
- fGpu->getWritePixelsInfo(surface, proxy->origin(), width, height, proxy->config(),
+ fGpu->getWritePixelsInfo(surface, width, height, proxy->config(),
&drawPreference, &tempInfo);
if (GrGpu::kNoDraw_DrawPreference == drawPreference) {
- return this->fGpu->writePixels(surface, proxy->origin(), left, top, width, height,
+ return this->fGpu->writePixels(surface, left, top, width, height,
config, buffer, rowBytes);
}
GrSurfaceDesc desc;
@@ -74,11 +74,11 @@ void GrOpFlushState::doUpload(GrDrawOp::DeferredUploadFn& upload) {
if (!temp) {
return false;
}
- if (!fGpu->writePixels(temp.get(), proxy->origin(), 0, 0, width, height, desc.fConfig,
+ if (!fGpu->writePixels(temp.get(), 0, 0, width, height, desc.fConfig,
buffer, rowBytes)) {
return false;
}
- return fGpu->copySurface(surface, proxy->origin(), temp.get(), proxy->origin(),
+ return fGpu->copySurface(surface, temp.get(),
SkIRect::MakeWH(width, height), {left, top});
};
upload(wp);
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 61ed67668d..8e91d8133b 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -19,7 +19,6 @@
GrPipeline::GrPipeline(const InitArgs& args) {
SkASSERT(args.fProxy);
- SkASSERT(kDefault_GrSurfaceOrigin != args.fProxy->origin());
SkASSERT(args.fProcessors);
SkASSERT(args.fProcessors->isFinalized());
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 6d889efc3f..6061b33e1b 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -98,8 +98,6 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk
sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
SkBudgeted budgeted, uint32_t flags) {
- SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
-
flags |= kExact_Flag | kNoCreate_Flag;
sk_sp<GrTexture> tex(this->refScratchTexture(desc, flags));
if (tex && SkBudgeted::kNo == budgeted) {
@@ -161,7 +159,6 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
uint32_t flags) {
ASSERT_SINGLE_OWNER
- SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
if (this->isAbandoned()) {
return nullptr;
@@ -183,7 +180,6 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
- SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
if (this->isAbandoned()) {
return nullptr;
@@ -201,7 +197,6 @@ sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDe
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(validate_desc(inDesc, *fCaps));
- SkASSERT(inDesc.fOrigin != kDefault_GrSurfaceOrigin);
SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
@@ -243,29 +238,31 @@ sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDe
}
sk_sp<GrTexture> GrResourceProvider::wrapBackendTexture(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
GrWrapOwnership ownership) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
return nullptr;
}
- return fGpu->wrapBackendTexture(tex, ownership);
+ return fGpu->wrapBackendTexture(tex, origin, ownership);
}
sk_sp<GrTexture> GrResourceProvider::wrapRenderableBackendTexture(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
int sampleCnt,
GrWrapOwnership ownership) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
return nullptr;
}
- return fGpu->wrapRenderableBackendTexture(tex, sampleCnt, ownership);
+ return fGpu->wrapRenderableBackendTexture(tex, origin, sampleCnt, ownership);
}
sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendRenderTarget(
- const GrBackendRenderTarget& backendRT)
+ const GrBackendRenderTarget& backendRT, GrSurfaceOrigin origin)
{
ASSERT_SINGLE_OWNER
- return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(backendRT);
+ return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(backendRT, origin);
}
void GrResourceProvider::assignUniqueKeyToResource(const GrUniqueKey& key,
@@ -484,12 +481,12 @@ GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
}
sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendTextureAsRenderTarget(
- const GrBackendTexture& tex, int sampleCnt)
+ const GrBackendTexture& tex, GrSurfaceOrigin origin, int sampleCnt)
{
if (this->isAbandoned()) {
return nullptr;
}
- return this->gpu()->wrapBackendTextureAsRenderTarget(tex, sampleCnt);
+ return this->gpu()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt);
}
sk_sp<GrSemaphore> SK_WARN_UNUSED_RESULT GrResourceProvider::makeSemaphore(bool isOwned) {
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 6c2f49d8aa..28207b7a87 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -87,6 +87,7 @@ public:
* @return GrTexture object or NULL on failure.
*/
sk_sp<GrTexture> wrapBackendTexture(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
GrWrapOwnership = kBorrow_GrWrapOwnership);
/**
@@ -95,6 +96,7 @@ public:
* to the texture.
*/
sk_sp<GrTexture> wrapRenderableBackendTexture(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
int sampleCnt,
GrWrapOwnership = kBorrow_GrWrapOwnership);
@@ -107,7 +109,7 @@ public:
*
* @return GrRenderTarget object or NULL on failure.
*/
- sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&);
+ sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin);
static const uint32_t kMinScratchTextureSize;
@@ -210,6 +212,7 @@ public:
* @return GrRenderTarget object or NULL on failure.
*/
sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin origin,
int sampleCnt);
/**
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 20bb15462f..f8639406d6 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -34,6 +34,7 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
, fGpuMemorySize(kInvalidGpuMemorySize)
, fLastOpList(nullptr) {
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
+ SkASSERT(fTarget->origin() == fOrigin);
}
GrSurfaceProxy::~GrSurfaceProxy() {
@@ -46,8 +47,6 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
GrResourceProvider* resourceProvider, int sampleCnt,
GrSurfaceFlags flags, bool isMipMapped,
SkDestinationSurfaceColorMode mipColorMode) const {
- SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
-
GrSurfaceDesc desc;
desc.fFlags = flags;
if (fNeedsClear) {
@@ -123,7 +122,8 @@ void GrSurfaceProxy::computeScratchKey(GrScratchKey* key) const {
height = SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(height));
}
- GrTexturePriv::ComputeScratchKey(this->config(), width, height, SkToBool(rtp), sampleCount,
+ GrTexturePriv::ComputeScratchKey(this->config(), width, height,
+ this->origin(), SkToBool(rtp), sampleCount,
hasMipMaps, key);
}
@@ -183,7 +183,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
SkBudgeted budgeted,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
- SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
const GrCaps* caps = resourceProvider->caps();
@@ -278,8 +277,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
GrBackendTexture& backendTex,
GrSurfaceOrigin origin) {
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex));
+ sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex, origin));
return GrSurfaceProxy::MakeWrapped(std::move(tex), origin);
}
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 8e79a699fc..4f4e5aa266 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -40,6 +40,24 @@ size_t GrTexture::onGpuMemorySize() const {
}
/////////////////////////////////////////////////////////////////////////////
+
+namespace {
+
+// FIXME: This should be refactored with the code in gl/GrGLGpu.cpp.
+GrSurfaceOrigin resolve_origin(const GrSurfaceDesc& desc) {
+ // 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.
+ bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrSurfaceFlag);
+ if (kDefault_GrSurfaceOrigin == desc.fOrigin) {
+ return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
+ } else {
+ return desc.fOrigin;
+ }
+}
+}
+
+//////////////////////////////////////////////////////////////////////////////
GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrSLType samplerType,
GrSamplerParams::FilterMode highestFilterMode, bool wasMipMapDataProvided)
: INHERITED(gpu, desc)
@@ -63,12 +81,12 @@ void GrTexture::computeScratchKey(GrScratchKey* key) const {
sampleCount = rt->numStencilSamples();
}
GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(),
- SkToBool(rt), sampleCount,
+ this->origin(), SkToBool(rt), sampleCount,
this->texturePriv().hasMipMaps(), key);
}
void GrTexturePriv::ComputeScratchKey(GrPixelConfig config, int width, int height,
- bool isRenderTarget, int sampleCnt,
+ GrSurfaceOrigin origin, bool isRenderTarget, int sampleCnt,
bool isMipMapped, GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
uint32_t flags = isRenderTarget;
@@ -80,18 +98,17 @@ void GrTexturePriv::ComputeScratchKey(GrPixelConfig config, int width, int heigh
SkASSERT(static_cast<int>(config) < (1 << 5));
SkASSERT(sampleCnt < (1 << 8));
SkASSERT(flags < (1 << 10));
+ SkASSERT(static_cast<int>(origin) < (1 << 8));
GrScratchKey::Builder builder(key, kType, 3);
builder[0] = width;
builder[1] = height;
- builder[2] = config | (isMipMapped << 5) | (sampleCnt << 6) | (flags << 14);
+ builder[2] = config | (isMipMapped << 5) | (sampleCnt << 6) | (flags << 14) | (origin << 24);
}
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
- SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
-
- // Note: the fOrigin field is not used in the scratch key
- return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight,
+ GrSurfaceOrigin origin = resolve_origin(desc);
+ return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight, origin,
SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag), desc.fSampleCnt,
desc.fIsMipMapped, key);
}
diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h
index 86f945b8ad..8a256a4b40 100644
--- a/src/gpu/GrTexturePriv.h
+++ b/src/gpu/GrTexturePriv.h
@@ -57,7 +57,7 @@ public:
static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*);
static void ComputeScratchKey(GrPixelConfig config, int width, int height,
- bool isRenderTarget, int sampleCnt,
+ GrSurfaceOrigin origin, bool isRenderTarget, int sampleCnt,
bool isMipMapped, GrScratchKey* key);
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 2c32401c19..6247850409 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -551,6 +551,7 @@ static bool check_backend_texture(const GrBackendTexture& backendTex, const GrGL
}
sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTex,
+ GrSurfaceOrigin origin,
GrWrapOwnership ownership) {
GrGLTexture::IDDesc idDesc;
if (!check_backend_texture(backendTex, this->glCaps(), &idDesc)) {
@@ -564,16 +565,24 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kNone_GrSurfaceFlags;
- surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // This isn't used in the following
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
surfDesc.fSampleCnt = 0;
-
+ // FIXME: this should be calling resolve_origin(), but Chrome code is currently
+ // assuming the old behaviour, which is that backend textures are always
+ // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to:
+ // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget);
+ if (kDefault_GrSurfaceOrigin == origin) {
+ surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ } else {
+ surfDesc.fOrigin = origin;
+ }
return GrGLTexture::MakeWrapped(this, surfDesc, idDesc);
}
sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
+ GrSurfaceOrigin origin,
int sampleCnt,
GrWrapOwnership ownership) {
GrGLTexture::IDDesc idDesc;
@@ -594,11 +603,19 @@ sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture&
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; // This isn't actually used in the following
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
surfDesc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, backendTex.config());
+ // FIXME: this should be calling resolve_origin(), but Chrome code is currently
+ // assuming the old behaviour, which is that backend textures are always
+ // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to:
+ // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget);
+ if (kDefault_GrSurfaceOrigin == origin) {
+ surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ } else {
+ surfDesc.fOrigin = origin;
+ }
GrGLRenderTarget::IDDesc rtIDDesc;
if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) {
@@ -610,7 +627,8 @@ sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture&
return std::move(texRT);
}
-sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT) {
+sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
+ GrSurfaceOrigin origin) {
const GrGLFramebufferInfo* info = backendRT.getGLFramebufferInfo();
if (!info) {
return nullptr;
@@ -624,17 +642,19 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
idDesc.fIsMixedSampled = false;
GrSurfaceDesc desc;
+ desc.fConfig = backendRT.config();
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin; // This isn't actually used in the following
desc.fWidth = backendRT.width();
desc.fHeight = backendRT.height();
- desc.fConfig = backendRT.config();
desc.fSampleCnt = this->caps()->getSampleCount(backendRT.sampleCnt(), backendRT.config());
+ SkASSERT(kDefault_GrSurfaceOrigin != origin);
+ desc.fOrigin = origin;
return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, backendRT.stencilBits());
}
sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
int sampleCnt) {
const GrGLTextureInfo* info = tex.getGLTextureInfo();
if (!info || !info->fID) {
@@ -654,11 +674,19 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; // This isn't actually used in the following
surfDesc.fWidth = tex.width();
surfDesc.fHeight = tex.height();
surfDesc.fConfig = tex.config();
surfDesc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, tex.config());
+ // FIXME: this should be calling resolve_origin(), but Chrome code is currently
+ // assuming the old behaviour, which is that backend textures are always
+ // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to:
+ // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget);
+ if (kDefault_GrSurfaceOrigin == origin) {
+ surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ } else {
+ surfDesc.fOrigin = origin;
+ }
GrGLRenderTarget::IDDesc rtIDDesc;
if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) {
@@ -669,8 +697,7 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
////////////////////////////////////////////////////////////////////////////////
-bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig,
DrawPreference* drawPreference,
WritePixelTempDrawInfo* tempDrawInfo) {
@@ -745,7 +772,8 @@ bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOri
}
}
- if (!this->glCaps().unpackFlipYSupport() && kBottomLeft_GrSurfaceOrigin == dstOrigin) {
+ if (!this->glCaps().unpackFlipYSupport() &&
+ kBottomLeft_GrSurfaceOrigin == dstSurface->origin()) {
ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference);
}
@@ -771,7 +799,7 @@ static bool check_write_and_transfer_input(GrGLTexture* glTex, GrSurface* surfac
return true;
}
-bool GrGLGpu::onWritePixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrGLGpu::onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[],
@@ -786,7 +814,7 @@ bool GrGLGpu::onWritePixels(GrSurface* surface, GrSurfaceOrigin origin,
GL_CALL(BindTexture(glTex->target(), glTex->textureID()));
return this->uploadTexData(glTex->config(), glTex->width(), glTex->height(),
- origin, glTex->target(), kWrite_UploadType,
+ glTex->origin(), glTex->target(), kWrite_UploadType,
left, top, width, height, config, texels, mipLevelCount);
}
@@ -1735,14 +1763,14 @@ void GrGLGpu::flushScissor(const GrScissorState& scissorState,
}
void GrGLGpu::flushWindowRectangles(const GrWindowRectsState& windowState,
- const GrGLRenderTarget* rt, GrSurfaceOrigin origin) {
+ const GrGLRenderTarget* rt) {
#ifndef USE_NSIGHT
typedef GrWindowRectsState::Mode Mode;
SkASSERT(!windowState.enabled() || rt->renderFBOID()); // Window rects can't be used on-screen.
SkASSERT(windowState.numWindows() <= this->caps()->maxWindowRectangles());
if (!this->caps()->maxWindowRectangles() ||
- fHWWindowRectsState.knownEqualTo(origin, rt->getViewport(), windowState)) {
+ fHWWindowRectsState.knownEqualTo(rt->origin(), rt->getViewport(), windowState)) {
return;
}
@@ -1754,13 +1782,13 @@ void GrGLGpu::flushWindowRectangles(const GrWindowRectsState& windowState,
GrGLIRect glwindows[GrWindowRectangles::kMaxWindows];
const SkIRect* skwindows = windowState.windows().data();
for (int i = 0; i < numWindows; ++i) {
- glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], origin);
+ glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin());
}
GrGLenum glmode = (Mode::kExclusive == windowState.mode()) ? GR_GL_EXCLUSIVE : GR_GL_INCLUSIVE;
GL_CALL(WindowRectangles(glmode, numWindows, glwindows->asInts()));
- fHWWindowRectsState.set(origin, rt->getViewport(), windowState);
+ fHWWindowRectsState.set(rt->origin(), rt->getViewport(), windowState);
#endif
}
@@ -1828,7 +1856,7 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
}
this->flushStencil(stencil);
this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), pipeline.proxy()->origin());
- this->flushWindowRectangles(pipeline.getWindowRectsState(), glRT, pipeline.proxy()->origin());
+ this->flushWindowRectangles(pipeline.getWindowRectsState(), glRT);
this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !stencil.isDisabled());
// This must come after textures are flushed because a texture may need
@@ -1944,8 +1972,7 @@ void GrGLGpu::disableScissor() {
}
}
-void GrGLGpu::clear(const GrFixedClip& clip, GrColor color,
- GrRenderTarget* target, GrSurfaceOrigin origin) {
+void GrGLGpu::clear(const GrFixedClip& clip, GrColor color, GrRenderTarget* target) {
this->handleDirtyContext();
// parent class should never let us get here with no RT
@@ -1953,8 +1980,8 @@ void GrGLGpu::clear(const GrFixedClip& clip, GrColor color,
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
this->flushRenderTarget(glRT, clip.scissorEnabled() ? &clip.scissorRect() : nullptr);
- this->flushScissor(clip.scissorState(), glRT->getViewport(), origin);
- this->flushWindowRectangles(clip.windowRectsState(), glRT, origin);
+ this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin());
+ this->flushWindowRectangles(clip.windowRectsState(), glRT);
GrGLfloat r, g, b, a;
static const GrGLfloat scale255 = 1.f / 255.f;
@@ -1995,12 +2022,12 @@ void GrGLGpu::clearStencil(GrRenderTarget* target) {
void GrGLGpu::clearStencilClip(const GrFixedClip& clip,
bool insideStencilMask,
- GrRenderTarget* target, GrSurfaceOrigin origin) {
+ GrRenderTarget* target) {
SkASSERT(target);
this->handleDirtyContext();
if (this->glCaps().useDrawToClearStencilClip()) {
- this->clearStencilClipAsDraw(clip, insideStencilMask, target, origin);
+ this->clearStencilClipAsDraw(clip, insideStencilMask, target);
return;
}
@@ -2029,8 +2056,8 @@ void GrGLGpu::clearStencilClip(const GrFixedClip& clip,
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
this->flushRenderTarget(glRT, &SkIRect::EmptyIRect());
- this->flushScissor(clip.scissorState(), glRT->getViewport(), origin);
- this->flushWindowRectangles(clip.windowRectsState(), glRT, origin);
+ this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin());
+ this->flushWindowRectangles(clip.windowRectsState(), glRT);
GL_CALL(StencilMask((uint32_t) clipStencilMask));
GL_CALL(ClearStencil(value));
@@ -2145,8 +2172,7 @@ static bool requires_srgb_conversion(GrPixelConfig a, GrPixelConfig b) {
return false;
}
-bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int width, int height, size_t rowBytes,
+bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference* drawPreference,
ReadPixelTempDrawInfo* tempDrawInfo) {
GrPixelConfig srcConfig = srcSurface->config();
@@ -2251,7 +2277,7 @@ bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrig
}
if ((srcSurface->asRenderTarget() || this->glCaps().canConfigBeFBOColorAttachment(srcConfig)) &&
- read_pixels_pays_for_y_flip(srcOrigin, this->glCaps(), width, height, readConfig,
+ read_pixels_pays_for_y_flip(srcSurface->origin(), this->glCaps(), width, height, readConfig,
rowBytes)) {
ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference);
}
@@ -2259,7 +2285,7 @@ bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrig
return true;
}
-bool GrGLGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrGLGpu::onReadPixels(GrSurface* surface,
int left, int top,
int width, int height,
GrPixelConfig config,
@@ -2288,8 +2314,8 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
if (kAlpha_8_GrPixelConfig == config &&
this->readPixelsSupported(surface, tempConfig)) {
std::unique_ptr<uint32_t[]> temp(new uint32_t[width * height * 4]);
- if (this->onReadPixels(surface, origin, left, top, width, height,
- tempConfig, temp.get(), width*4)) {
+ if (this->onReadPixels(surface, left, top, width, height, tempConfig, temp.get(),
+ width*4)) {
uint8_t* dst = reinterpret_cast<uint8_t*>(buffer);
for (int j = 0; j < height; ++j) {
for (int i = 0; i < width; ++i) {
@@ -2308,7 +2334,7 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
&externalType)) {
return false;
}
- bool flipY = kBottomLeft_GrSurfaceOrigin == origin;
+ bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin();
GrGLIRect glvp;
if (renderTarget) {
@@ -2320,7 +2346,7 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
this->flushRenderTarget(renderTarget, &SkIRect::EmptyIRect());
break;
case GrGLRenderTarget::kCanResolve_ResolveType:
- this->onResolveRenderTarget(renderTarget, origin);
+ this->onResolveRenderTarget(renderTarget);
// we don't track the state of the READ FBO ID.
fStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, renderTarget->textureFBOID()));
@@ -2337,7 +2363,7 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
// the read rect is viewport-relative
GrGLIRect readRect;
- readRect.setRelativeTo(glvp, left, top, width, height, origin);
+ readRect.setRelativeTo(glvp, left, top, width, height, surface->origin());
size_t bytesPerPixel = GrBytesPerPixel(config);
size_t tightRowBytes = bytesPerPixel * width;
@@ -2632,7 +2658,7 @@ void GrGLGpu::sendIndexedInstancedMeshToGpu(const GrPrimitiveProcessor& primProc
fStats.incNumDraws();
}
-void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin origin) {
+void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) {
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target);
if (rt->needsResolve()) {
// Some extensions automatically resolves the texture when it is read.
@@ -2652,7 +2678,7 @@ void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin orig
// Apple's extension uses the scissor as the blit bounds.
GrScissorState scissorState;
scissorState.set(dirtyRect);
- this->flushScissor(scissorState, vp, origin);
+ this->flushScissor(scissorState, vp, rt->origin());
this->disableWindowRectangles();
GL_CALL(ResolveMultisampleFramebuffer());
} else {
@@ -2665,7 +2691,7 @@ void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin orig
t = target->height();
} else {
GrGLIRect rect;
- rect.setRelativeTo(vp, dirtyRect, origin);
+ rect.setRelativeTo(vp, dirtyRect, target->origin());
l = rect.fLeft;
b = rect.fBottom;
r = rect.fLeft + rect.fWidth;
@@ -2918,7 +2944,7 @@ static void get_tex_param_swizzle(GrPixelConfig config,
}
void GrGLGpu::bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs,
- GrGLTexture* texture, GrSurfaceOrigin textureOrigin) {
+ GrGLTexture* texture) {
SkASSERT(texture);
#ifdef SK_DEBUG
@@ -2938,7 +2964,7 @@ void GrGLGpu::bindTexture(int unitIdx, const GrSamplerParams& params, bool allow
// out of the "last != next" check.
GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTarget());
if (texRT) {
- this->onResolveRenderTarget(texRT, textureOrigin);
+ this->onResolveRenderTarget(texRT);
}
GrGpuResource::UniqueID textureID = texture->uniqueID();
@@ -3106,7 +3132,7 @@ void GrGLGpu::bindImageStorage(int unitIdx, GrIOType ioType, GrGLTexture *textur
}
void GrGLGpu::generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs,
- GrGLTexture* texture, GrSurfaceOrigin textureOrigin) {
+ GrGLTexture* texture) {
SkASSERT(texture);
// First, figure out if we need mips for this texture at all:
@@ -3142,7 +3168,7 @@ void GrGLGpu::generateMipmaps(const GrSamplerParams& params, bool allowSRGBInput
// from the rt it will still be the last bound texture, but it needs resolving.
GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTarget());
if (texRT) {
- this->onResolveRenderTarget(texRT, textureOrigin);
+ this->onResolveRenderTarget(texRT);
}
GrGLenum target = texture->target();
@@ -3165,7 +3191,7 @@ void GrGLGpu::generateMipmaps(const GrSamplerParams& params, bool allowSRGBInput
}
// Either do manual mipmap generation or (if that fails), just rely on the driver:
- if (!this->generateMipmap(texture, textureOrigin, allowSRGBInputs)) {
+ if (!this->generateMipmap(texture, allowSRGBInputs)) {
GL_CALL(GenerateMipmap(target));
}
@@ -3229,12 +3255,11 @@ void GrGLGpu::setScratchTextureUnit() {
}
// Determines whether glBlitFramebuffer could be used between src and dst by onCopySurface.
-static inline bool can_blit_framebuffer_for_copy_surface(
- const GrSurface* dst, GrSurfaceOrigin dstOrigin,
- const GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint,
- const GrGLGpu* gpu) {
+static inline bool can_blit_framebuffer_for_copy_surface(const GrSurface* dst,
+ const GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint,
+ const GrGLGpu* gpu) {
auto blitFramebufferFlags = gpu->glCaps().blitFramebufferSupportFlags();
if (!gpu->glCaps().canConfigBeFBOColorAttachment(dst->config()) ||
!gpu->glCaps().canConfigBeFBOColorAttachment(src->config())) {
@@ -3259,7 +3284,7 @@ static inline bool can_blit_framebuffer_for_copy_surface(
if (GrGLCaps::kNoScalingOrMirroring_BlitFramebufferFlag & blitFramebufferFlags) {
// We would mirror to compensate for origin changes. Note that copySurface is
// specified such that the src and dst rects are the same.
- if (dstOrigin != srcOrigin) {
+ if (dst->origin() != src->origin()) {
return false;
}
}
@@ -3293,7 +3318,7 @@ static inline bool can_blit_framebuffer_for_copy_surface(
if (dstPoint.fX != srcRect.fLeft || dstPoint.fY != srcRect.fTop) {
return false;
}
- if (dstOrigin != srcOrigin) {
+ if (dst->origin() != src->origin()) {
return false;
}
}
@@ -3301,8 +3326,8 @@ static inline bool can_blit_framebuffer_for_copy_surface(
return true;
}
-static inline bool can_copy_texsubimage(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
- const GrSurface* src, GrSurfaceOrigin srcOrigin,
+static inline bool can_copy_texsubimage(const GrSurface* dst,
+ const GrSurface* src,
const GrGLGpu* gpu) {
// Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSubImage
// and BGRA isn't in the spec. There doesn't appear to be any extension that adds it. Perhaps
@@ -3337,7 +3362,7 @@ static inline bool can_copy_texsubimage(const GrSurface* dst, GrSurfaceOrigin ds
// is required.
if (gpu->glCaps().canConfigBeFBOColorAttachment(src->config()) &&
(!srcTex || srcTex->target() == GR_GL_TEXTURE_2D) && dstTex->target() == GR_GL_TEXTURE_2D &&
- dstOrigin == srcOrigin) {
+ dst->origin() == src->origin()) {
return true;
} else {
return false;
@@ -3393,9 +3418,10 @@ void GrGLGpu::unbindTextureFBOForPixelOps(GrGLenum fboTarget, GrSurface* surface
}
}
-bool GrGLGpu::onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) {
+bool GrGLGpu::onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
// None of our copy methods can handle a swizzle. TODO: Make copySurfaceAsDraw handle the
// swizzle.
if (this->caps()->shaderCaps()->configOutputSwizzle(src->config()) !=
@@ -3405,24 +3431,22 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
// Don't prefer copying as a draw if the dst doesn't already have a FBO object.
bool preferCopy = SkToBool(dst->asRenderTarget());
if (preferCopy && src->asTexture()) {
- if (this->copySurfaceAsDraw(dst, dstOrigin, src, srcOrigin, srcRect, dstPoint)) {
+ if (this->copySurfaceAsDraw(dst, src, srcRect, dstPoint)) {
return true;
}
}
- if (can_copy_texsubimage(dst, dstOrigin, src, srcOrigin, this)) {
- this->copySurfaceAsCopyTexSubImage(dst, dstOrigin, src, srcOrigin, srcRect, dstPoint);
+ if (can_copy_texsubimage(dst, src, this)) {
+ this->copySurfaceAsCopyTexSubImage(dst, src, srcRect, dstPoint);
return true;
}
- if (can_blit_framebuffer_for_copy_surface(dst, dstOrigin, src, srcOrigin,
- srcRect, dstPoint, this)) {
- return this->copySurfaceAsBlitFramebuffer(dst, dstOrigin, src, srcOrigin,
- srcRect, dstPoint);
+ if (can_blit_framebuffer_for_copy_surface(dst, src, srcRect, dstPoint, this)) {
+ return this->copySurfaceAsBlitFramebuffer(dst, src, srcRect, dstPoint);
}
if (!preferCopy && src->asTexture()) {
- if (this->copySurfaceAsDraw(dst, dstOrigin, src, srcOrigin, srcRect, dstPoint)) {
+ if (this->copySurfaceAsDraw(dst, src, srcRect, dstPoint)) {
return true;
}
}
@@ -3780,7 +3804,7 @@ bool GrGLGpu::createStencilClipClearProgram() {
}
void GrGLGpu::clearStencilClipAsDraw(const GrFixedClip& clip, bool insideStencilMask,
- GrRenderTarget* rt, GrSurfaceOrigin origin) {
+ GrRenderTarget* rt) {
// TODO: This should swizzle the output to match dst's config, though it is a debugging
// visualization.
@@ -3810,8 +3834,8 @@ void GrGLGpu::clearStencilClipAsDraw(const GrFixedClip& clip, bool insideStencil
this->flushBlend(blendInfo, GrSwizzle::RGBA());
this->flushColorWrite(false);
this->flushHWAAState(glRT, false, false);
- this->flushScissor(clip.scissorState(), glRT->getViewport(), origin);
- this->flushWindowRectangles(clip.windowRectsState(), glRT, origin);
+ this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin());
+ this->flushWindowRectangles(clip.windowRectsState(), glRT);
GrStencilAttachment* sb = rt->renderTargetPriv().getStencilAttachment();
// This should only be called internally when we know we have a stencil buffer.
SkASSERT(sb);
@@ -3822,8 +3846,8 @@ void GrGLGpu::clearStencilClipAsDraw(const GrFixedClip& clip, bool insideStencil
}
-bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
GrGLTexture* srcTex = static_cast<GrGLTexture*>(src->asTexture());
@@ -3840,7 +3864,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
int h = srcRect.height();
GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
- this->bindTexture(0, params, true, srcTex, srcOrigin);
+ this->bindTexture(0, params, true, srcTex);
GrGLIRect dstVP;
this->bindSurfaceFBOForPixelOps(dst, GR_GL_FRAMEBUFFER, &dstVP, kDst_TempFBOTarget);
@@ -3866,7 +3890,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
GrGLfloat dx1 = 2.f * (dstPoint.fX + w) / dw - 1.f;
GrGLfloat dy0 = 2.f * dstPoint.fY / dh - 1.f;
GrGLfloat dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f;
- if (kBottomLeft_GrSurfaceOrigin == dstOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == dst->origin()) {
dy0 = -dy0;
dy1 = -dy1;
}
@@ -3877,7 +3901,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
GrGLfloat sy1 = (GrGLfloat)(srcRect.fTop + h);
int sw = src->width();
int sh = src->height();
- if (kBottomLeft_GrSurfaceOrigin == srcOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == src->origin()) {
sy0 = sh - sy0;
sy1 = sh - sy1;
}
@@ -3911,11 +3935,11 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
return true;
}
-void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(can_copy_texsubimage(dst, dstOrigin, src, srcOrigin, this));
+ SkASSERT(can_copy_texsubimage(dst, src, this));
GrGLIRect srcVP;
this->bindSurfaceFBOForPixelOps(src, GR_GL_FRAMEBUFFER, &srcVP, kSrc_TempFBOTarget);
GrGLTexture* dstTex = static_cast<GrGLTexture *>(dst->asTexture());
@@ -3923,12 +3947,12 @@ void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst, GrSurfaceOrigin dstOr
// We modified the bound FBO
fHWBoundRenderTargetUniqueID.makeInvalid();
GrGLIRect srcGLRect;
- srcGLRect.setRelativeTo(srcVP, srcRect, srcOrigin);
+ srcGLRect.setRelativeTo(srcVP, srcRect, src->origin());
this->setScratchTextureUnit();
GL_CALL(BindTexture(dstTex->target(), dstTex->textureID()));
GrGLint dstY;
- if (kBottomLeft_GrSurfaceOrigin == dstOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == dst->origin()) {
dstY = dst->height() - (dstPoint.fY + srcGLRect.fHeight);
} else {
dstY = dstPoint.fY;
@@ -3943,12 +3967,11 @@ void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst, GrSurfaceOrigin dstOr
this->didWriteToSurface(dst, &dstRect);
}
-bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(can_blit_framebuffer_for_copy_surface(dst, dstOrigin, src, srcOrigin,
- srcRect, dstPoint, this));
+ SkASSERT(can_blit_framebuffer_for_copy_surface(dst, src, srcRect, dstPoint, this));
SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY,
srcRect.width(), srcRect.height());
if (dst == src) {
@@ -3965,8 +3988,8 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst, GrSurfaceOrigin dstOr
fHWBoundRenderTargetUniqueID.makeInvalid();
GrGLIRect srcGLRect;
GrGLIRect dstGLRect;
- srcGLRect.setRelativeTo(srcVP, srcRect, srcOrigin);
- dstGLRect.setRelativeTo(dstVP, dstRect, dstOrigin);
+ srcGLRect.setRelativeTo(srcVP, srcRect, src->origin());
+ dstGLRect.setRelativeTo(dstVP, dstRect, dst->origin());
// BlitFrameBuffer respects the scissor, so disable it.
this->disableScissor();
@@ -3975,7 +3998,7 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst, GrSurfaceOrigin dstOr
GrGLint srcY0;
GrGLint srcY1;
// Does the blit need to y-mirror or not?
- if (srcOrigin == dstOrigin) {
+ if (src->origin() == dst->origin()) {
srcY0 = srcGLRect.fBottom;
srcY1 = srcGLRect.fBottom + srcGLRect.fHeight;
} else {
@@ -4000,8 +4023,7 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst, GrSurfaceOrigin dstOr
// Manual implementation of mipmap generation, to work around driver bugs w/sRGB.
// Uses draw calls to do a series of downsample operations to successive mips.
// If this returns false, then the calling code falls back to using glGenerateMipmap.
-bool GrGLGpu::generateMipmap(GrGLTexture* texture, GrSurfaceOrigin textureOrigin,
- bool gammaCorrect) {
+bool GrGLGpu::generateMipmap(GrGLTexture* texture, bool gammaCorrect) {
SkASSERT(!GrPixelConfigIsSint(texture->config()));
// Our iterative downsample requires the ability to limit which level we're sampling:
if (!this->glCaps().doManualMipmapping()) {
@@ -4064,7 +4086,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, GrSurfaceOrigin textureOrigin
// We'll be changing our base level further below:
this->setTextureUnit(0);
GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
- this->bindTexture(0, params, gammaCorrect, texture, textureOrigin);
+ this->bindTexture(0, params, gammaCorrect, texture);
// Vertex data:
if (!fMipmapProgramArrayBuffer) {
@@ -4146,8 +4168,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, GrSurfaceOrigin textureOrigin
return true;
}
-void GrGLGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin rtOrigin,
- const GrStencilSettings& stencil,
+void GrGLGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings& stencil,
int* effectiveSampleCnt, SamplePattern* samplePattern) {
SkASSERT(GrFSAAType::kMixedSamples != rt->fsaaType() ||
rt->renderTargetPriv().getStencilAttachment() || stencil.isDisabled());
@@ -4169,7 +4190,7 @@ void GrGLGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin rtOrig
for (int i = 0; i < *effectiveSampleCnt; ++i) {
GrGLfloat pos[2];
GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos));
- if (kTopLeft_GrSurfaceOrigin == rtOrigin) {
+ if (kTopLeft_GrSurfaceOrigin == rt->origin()) {
(*samplePattern)[i].set(pos[0], pos[1]);
} else {
(*samplePattern)[i].set(pos[0], 1 - pos[1]);
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index fa2179e05b..5acf806c7d 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -60,22 +60,19 @@ public:
// Used by GrGLProgram to configure OpenGL state.
void bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs,
- GrGLTexture* texture, GrSurfaceOrigin textureOrigin);
+ GrGLTexture* texture);
void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*);
void bindImageStorage(int unitIdx, GrIOType, GrGLTexture *);
- void generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs,
- GrGLTexture* texture, GrSurfaceOrigin textureOrigin);
+ void generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture);
- bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
+ bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*,
ReadPixelTempDrawInfo*) override;
- bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+ bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*,
WritePixelTempDrawInfo*) override;
@@ -134,13 +131,12 @@ public:
// The GrGLGpuCommandBuffer does not buffer up draws before submitting them to the gpu.
// Thus this is the implementation of the clear call for the corresponding passthrough function
// on GrGLGpuCommandBuffer.
- void clear(const GrFixedClip&, GrColor, GrRenderTarget*, GrSurfaceOrigin);
+ void clear(const GrFixedClip&, GrColor, GrRenderTarget*);
// The GrGLGpuCommandBuffer does not buffer up draws before submitting them to the gpu.
// Thus this is the implementation of the clearStencil call for the corresponding passthrough
// function on GrGLGpuCommandBuffer.
- void clearStencilClip(const GrFixedClip&, bool insideStencilMask,
- GrRenderTarget*, GrSurfaceOrigin);
+ void clearStencilClip(const GrFixedClip&, bool insideStencilMask, GrRenderTarget*);
const GrGLContext* glContextForTesting() const override {
return &this->glContext();
@@ -197,12 +193,17 @@ private:
GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPattern,
const void* data) override;
- sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override;
+ sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrWrapOwnership) override;
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt,
GrWrapOwnership) override;
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
+ GrSurfaceOrigin origin) override;
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt) override;
std::unique_ptr<gr_instanced::OpAllocator> onCreateInstancedRenderingAllocator() override;
@@ -239,14 +240,14 @@ private:
// variations above, depending on whether the surface is a render target or not.
bool readPixelsSupported(GrSurface* surfaceForConfig, GrPixelConfig readConfig);
- bool onReadPixels(GrSurface*, GrSurfaceOrigin,
+ bool onReadPixels(GrSurface*,
int left, int top,
int width, int height,
GrPixelConfig,
void* buffer,
size_t rowBytes) override;
- bool onWritePixels(GrSurface*, GrSurfaceOrigin,
+ bool onWritePixels(GrSurface*,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount) override;
@@ -256,13 +257,14 @@ private:
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) override;
- void onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin) override;
+ void onResolveRenderTarget(GrRenderTarget* target) override;
- bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) override;
+ bool onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) override;
- void onQueryMultisampleSpecs(GrRenderTarget*, GrSurfaceOrigin, const GrStencilSettings&,
+ void onQueryMultisampleSpecs(GrRenderTarget*, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) override;
// binds texture unit in GL
@@ -286,18 +288,20 @@ private:
bool hasExtension(const char* ext) const { return fGLContext->hasExtension(ext); }
- bool copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
- void copySurfaceAsCopyTexSubImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
- bool copySurfaceAsBlitFramebuffer(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
- bool generateMipmap(GrGLTexture* texture, GrSurfaceOrigin textureOrigin, bool gammaCorrect);
- void clearStencilClipAsDraw(const GrFixedClip&, bool insideStencilMask,
- GrRenderTarget*, GrSurfaceOrigin);
+ bool copySurfaceAsDraw(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
+ void copySurfaceAsCopyTexSubImage(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
+ bool copySurfaceAsBlitFramebuffer(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
+ bool generateMipmap(GrGLTexture* texture, bool gammaCorrect);
+ void clearStencilClipAsDraw(const GrFixedClip&, bool insideStencilMask, GrRenderTarget*);
static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff);
@@ -348,7 +352,7 @@ private:
// disables the scissor
void disableScissor();
- void flushWindowRectangles(const GrWindowRectsState&, const GrGLRenderTarget*, GrSurfaceOrigin);
+ void flushWindowRectangles(const GrWindowRectsState&, const GrGLRenderTarget*);
void disableWindowRectangles();
// sets a texture unit to use for texture operations other than binding a texture to a program.
diff --git a/src/gpu/gl/GrGLGpuCommandBuffer.h b/src/gpu/gl/GrGLGpuCommandBuffer.h
index 80fababb2c..a430494e91 100644
--- a/src/gpu/gl/GrGLGpuCommandBuffer.h
+++ b/src/gpu/gl/GrGLGpuCommandBuffer.h
@@ -1,9 +1,9 @@
/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
#ifndef GrGLGpuCommandBuffer_DEFINED
#define GrGLGpuCommandBuffer_DEFINED
@@ -69,7 +69,7 @@ private:
fRenderTarget = target;
}
SkASSERT(target == fRenderTarget);
- fGpu->clear(clip, color, fRenderTarget, proxy->origin());
+ fGpu->clear(clip, color, fRenderTarget);
}
void onClearStencilClip(GrRenderTargetProxy* proxy, const GrFixedClip& clip,
@@ -79,7 +79,7 @@ private:
fRenderTarget = target;
}
SkASSERT(target == fRenderTarget);
- fGpu->clearStencilClip(clip, insideStencilMask, fRenderTarget, proxy->origin());
+ fGpu->clearStencilClip(clip, insideStencilMask, fRenderTarget);
}
GrGLGpu* fGpu;
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index aa692c37db..aa67bed65c 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -70,7 +70,7 @@ void GrGLProgram::abandon() {
///////////////////////////////////////////////////////////////////////////////
void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) {
- this->setRenderTargetState(primProc, pipeline.proxy());
+ this->setRenderTargetState(primProc, pipeline.renderTarget());
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
// of GLProgram determine how to set coord transforms
@@ -97,8 +97,7 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline
fXferProcessor->setData(fProgramDataManager, xp, dstTexture, offset);
if (dstTexture) {
fGpu->bindTexture(nextTexSamplerIdx++, GrSamplerParams::ClampNoFilter(), true,
- static_cast<GrGLTexture*>(dstTexture),
- pipeline.dstTextureProxy()->origin());
+ static_cast<GrGLTexture*>(dstTexture));
}
SkASSERT(nextTexSamplerIdx == fNumTextureSamplers);
SkASSERT(nextTexelBufferIdx == fNumTextureSamplers + fNumTexelBuffers);
@@ -136,8 +135,7 @@ void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
- const GrRenderTargetProxy* proxy) {
- GrRenderTarget* rt = proxy->priv().peekRenderTarget();
+ const GrRenderTarget* rt) {
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) {
@@ -148,10 +146,10 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
SkISize size;
size.set(rt->width(), rt->height());
if (!primProc.isPathRendering()) {
- if (fRenderTargetState.fRenderTargetOrigin != proxy->origin() ||
+ if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
fRenderTargetState.fRenderTargetSize != size) {
fRenderTargetState.fRenderTargetSize = size;
- fRenderTargetState.fRenderTargetOrigin = proxy->origin();
+ fRenderTargetState.fRenderTargetOrigin = rt->origin();
float rtAdjustmentVec[4];
fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
@@ -161,7 +159,7 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(),
- size, proxy->origin());
+ size, rt->origin());
}
}
@@ -173,8 +171,7 @@ void GrGLProgram::bindTextures(const GrResourceIOProcessor& processor,
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.params(),
- allowSRGBInputs, static_cast<GrGLTexture*>(sampler.peekTexture()),
- sampler.proxy()->origin());
+ allowSRGBInputs, static_cast<GrGLTexture*>(sampler.peekTexture()));
}
for (int i = 0; i < processor.numBuffers(); ++i) {
const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(i);
@@ -192,7 +189,6 @@ void GrGLProgram::generateMipmaps(const GrResourceIOProcessor& processor, bool a
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->generateMipmaps(sampler.params(), allowSRGBInputs,
- static_cast<GrGLTexture*>(sampler.peekTexture()),
- sampler.proxy()->origin());
+ static_cast<GrGLTexture*>(sampler.peekTexture()));
}
}
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 81943f4c13..ec32c3557d 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -124,7 +124,7 @@ protected:
int* nextTexelBufferIdx, int* nextImageStorageIdx);
// Helper for setData() that sets the view matrix and loads the render target height uniform
- void setRenderTargetState(const GrPrimitiveProcessor&, const GrRenderTargetProxy*);
+ void setRenderTargetState(const GrPrimitiveProcessor&, const GrRenderTarget*);
// Helper for setData() that binds textures and texel buffers to the appropriate texture units
void bindTextures(const GrResourceIOProcessor&, bool allowSRGBInputs, int* nextSamplerIdx,
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index adcbdf8351..a56c2018d2 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -25,21 +25,20 @@ public:
~GrMockGpu() override {}
- bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
+ bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*,
ReadPixelTempDrawInfo*) override { return true; }
- bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+ bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*,
WritePixelTempDrawInfo*) override { return true; }
- bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) override { return true; }
+ bool onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) override { return true; }
- void onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin, const GrStencilSettings&,
+ void onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) override {
*effectiveSampleCnt = rt->numStencilSamples();
}
@@ -72,21 +71,26 @@ private:
sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted,
const GrMipLevel texels[], int mipLevelCount) override;
- sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override {
+ sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrWrapOwnership) override {
return nullptr;
}
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt,
GrWrapOwnership) override {
return nullptr;
}
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override {
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
+ GrSurfaceOrigin) override {
return nullptr;
}
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt) override {
return nullptr;
}
@@ -96,7 +100,7 @@ private:
gr_instanced::InstancedRendering* onCreateInstancedRendering() override { return nullptr; }
- bool onReadPixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onReadPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig,
void* buffer,
@@ -104,7 +108,7 @@ private:
return true;
}
- bool onWritePixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount) override {
@@ -118,7 +122,7 @@ private:
return true;
}
- void onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin) override { return; }
+ void onResolveRenderTarget(GrRenderTarget* target) override { return; }
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
int width,
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index a3bad0293d..3bccd41d3d 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -90,7 +90,7 @@ private:
void computeScratchKey(GrScratchKey* key) const override {
GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(),
- true, this->numStencilSamples(),
+ this->origin(), true, this->numStencilSamples(),
this->texturePriv().hasMipMaps(), key);
}
};
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index c590f30dec..53c214943f 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -29,22 +29,20 @@ public:
const GrMtlCaps& mtlCaps() const { return *fMtlCaps.get(); }
- bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
+ bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*,
ReadPixelTempDrawInfo*) override { return false; }
- bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+ bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*,
WritePixelTempDrawInfo*) override { return false; }
- bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+ bool onCopySurface(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) override { return false; }
- void onQueryMultisampleSpecs(GrRenderTarget*, GrSurfaceOrigin, const GrStencilSettings&,
+ void onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) override {}
GrGpuCommandBuffer* createCommandBuffer(const GrGpuCommandBuffer::LoadAndStoreInfo&,
@@ -78,21 +76,26 @@ private:
return nullptr;
}
- sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override {
+ sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrWrapOwnership) override {
return nullptr;
}
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt,
GrWrapOwnership) override {
return nullptr;
}
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override {
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
+ GrSurfaceOrigin) override {
return nullptr;
}
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt) override {
return nullptr;
}
@@ -103,7 +106,7 @@ private:
gr_instanced::InstancedRendering* onCreateInstancedRendering() override { return nullptr; }
- bool onReadPixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onReadPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig,
void* buffer,
@@ -111,7 +114,7 @@ private:
return false;
}
- bool onWritePixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount) override {
@@ -125,7 +128,7 @@ private:
return false;
}
- void onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin) override { return; }
+ void onResolveRenderTarget(GrRenderTarget* target) override { return; }
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
int width,
diff --git a/src/gpu/ops/GrClearOp.cpp b/src/gpu/ops/GrClearOp.cpp
index b2d7534ebe..4cc2bf2ac3 100644
--- a/src/gpu/ops/GrClearOp.cpp
+++ b/src/gpu/ops/GrClearOp.cpp
@@ -3,14 +3,14 @@
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
- */
-
-#include "GrClearOp.h"
-
-#include "GrGpuCommandBuffer.h"
-#include "GrOpFlushState.h"
+ */
+
+#include "GrClearOp.h"
+
+#include "GrGpuCommandBuffer.h"
+#include "GrOpFlushState.h"
#include "GrResourceProvider.h"
-
+
GrClearOp::GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* proxy)
: INHERITED(ClassID())
, fClip(clip)
diff --git a/src/gpu/ops/GrCopySurfaceOp.cpp b/src/gpu/ops/GrCopySurfaceOp.cpp
index 6720bbc642..4e8fab7d70 100644
--- a/src/gpu/ops/GrCopySurfaceOp.cpp
+++ b/src/gpu/ops/GrCopySurfaceOp.cpp
@@ -87,7 +87,6 @@ void GrCopySurfaceOp::onExecute(GrOpFlushState* state) {
return;
}
- state->gpu()->copySurface(fDst.get()->priv().peekSurface(), fDst.get()->origin(),
- fSrc.get()->priv().peekSurface(), fSrc.get()->origin(),
- fSrcRect, fDstPoint);
+ state->gpu()->copySurface(fDst.get()->priv().peekSurface(),
+ fSrc.get()->priv().peekSurface(), fSrcRect, fDstPoint);
}
diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp
index d64d04fb8c..938596ff0c 100644
--- a/src/gpu/vk/GrVkCopyManager.cpp
+++ b/src/gpu/vk/GrVkCopyManager.cpp
@@ -143,9 +143,10 @@ bool GrVkCopyManager::createCopyProgram(GrVkGpu* gpu) {
}
bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
- GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) {
+ GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
// None of our copy methods can handle a swizzle. TODO: Make copySurfaceAsDraw handle the
// swizzle.
if (gpu->caps()->shaderCaps()->configOutputSwizzle(src->config()) !=
@@ -203,7 +204,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
float dx1 = 2.f * (dstPoint.fX + w) / dw - 1.f;
float dy0 = 2.f * dstPoint.fY / dh - 1.f;
float dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f;
- if (kBottomLeft_GrSurfaceOrigin == dstOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == dst->origin()) {
dy0 = -dy0;
dy1 = -dy1;
}
@@ -214,7 +215,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
float sy0 = (float)srcRect.fTop;
float sy1 = (float)(srcRect.fTop + h);
int sh = src->height();
- if (kBottomLeft_GrSurfaceOrigin == srcOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == src->origin()) {
sy0 = sh - sy0;
sy1 = sh - sy1;
}
@@ -292,7 +293,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(srcTex->asRenderTarget());
if (texRT) {
- gpu->onResolveRenderTarget(texRT, srcOrigin);
+ gpu->onResolveRenderTarget(texRT);
}
GrVkPrimaryCommandBuffer* cmdBuffer = gpu->currentCommandBuffer();
diff --git a/src/gpu/vk/GrVkCopyManager.h b/src/gpu/vk/GrVkCopyManager.h
index 726faf30d3..36a08be819 100644
--- a/src/gpu/vk/GrVkCopyManager.h
+++ b/src/gpu/vk/GrVkCopyManager.h
@@ -8,7 +8,6 @@
#ifndef GrVkCopyManager_DEFINED
#define GrVkCopyManager_DEFINED
-#include "GrTypes.h"
#include "GrVkDescriptorSetManager.h"
#include "vk/GrVkDefines.h"
@@ -28,9 +27,10 @@ public:
~GrVkCopyManager();
bool copySurfaceAsDraw(GrVkGpu* gpu,
- GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
+ GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
void destroyResources(GrVkGpu* gpu);
void abandonResources();
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 2f7cbe5551..31e55de46a 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -332,8 +332,7 @@ GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
}
////////////////////////////////////////////////////////////////////////////////
-bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference* drawPreference,
WritePixelTempDrawInfo* tempDrawInfo) {
GrRenderTarget* renderTarget = dstSurface->asRenderTarget();
@@ -376,7 +375,7 @@ bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOri
return true;
}
-bool GrVkGpu::onWritePixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrVkGpu::onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
const GrMipLevel texels[], int mipLevelCount) {
@@ -411,7 +410,7 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, GrSurfaceOrigin origin,
false);
this->submitCommandBuffer(kForce_SyncQueue);
}
- success = this->uploadTexDataLinear(vkTex, origin, left, top, width, height, config,
+ success = this->uploadTexDataLinear(vkTex, left, top, width, height, config,
texels[0].fPixels, texels[0].fRowBytes);
} else {
int currentMipLevels = vkTex->texturePriv().maxMipMapLevel() + 1;
@@ -420,7 +419,7 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, GrSurfaceOrigin origin,
return false;
}
}
- success = this->uploadTexDataOptimal(vkTex, origin, left, top, width, height, config,
+ success = this->uploadTexDataOptimal(vkTex, left, top, width, height, config,
texels, mipLevelCount);
}
@@ -488,9 +487,8 @@ bool GrVkGpu::onTransferPixels(GrTexture* texture,
return true;
}
-void GrVkGpu::resolveImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrVkRenderTarget* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) {
+void GrVkGpu::resolveImage(GrSurface* dst, GrVkRenderTarget* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
SkASSERT(dst);
SkASSERT(src && src->numColorSamples() > 1 && src->msaaImage());
@@ -502,8 +500,8 @@ void GrVkGpu::resolveImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
SkIRect srcVkRect = srcRect;
int32_t dstY = dstPoint.fY;
- if (kBottomLeft_GrSurfaceOrigin == srcOrigin) {
- SkASSERT(kBottomLeft_GrSurfaceOrigin == dstOrigin);
+ if (kBottomLeft_GrSurfaceOrigin == src->origin()) {
+ SkASSERT(kBottomLeft_GrSurfaceOrigin == dst->origin());
srcVkRect.fTop = src->height() - srcRect.fBottom;
srcVkRect.fBottom = src->height() - srcRect.fTop;
dstY = dst->height() - dstPoint.fY - srcVkRect.height();
@@ -540,8 +538,7 @@ void GrVkGpu::resolveImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
fCurrentCmdBuffer->resolveImage(this, *src->msaaImage(), *dstImage, 1, &resolveInfo);
}
-void GrVkGpu::internalResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin origin,
- bool requiresSubmit) {
+void GrVkGpu::internalResolveRenderTarget(GrRenderTarget* target, bool requiresSubmit) {
if (target->needsResolve()) {
SkASSERT(target->numColorSamples() > 1);
GrVkRenderTarget* rt = static_cast<GrVkRenderTarget*>(target);
@@ -549,8 +546,7 @@ void GrVkGpu::internalResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigi
const SkIRect& srcRect = rt->getResolveRect();
- this->resolveImage(target, origin, rt, origin, srcRect,
- SkIPoint::Make(srcRect.fLeft, srcRect.fTop));
+ this->resolveImage(target, rt, srcRect, SkIPoint::Make(srcRect.fLeft, srcRect.fTop));
rt->flagAsResolved();
@@ -560,7 +556,7 @@ void GrVkGpu::internalResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigi
}
}
-bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
+bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex,
int left, int top, int width, int height,
GrPixelConfig dataConfig,
const void* data,
@@ -596,7 +592,7 @@ bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
&subres,
&layout));
- int texTop = kBottomLeft_GrSurfaceOrigin == texOrigin ? tex->height() - top - height : top;
+ int texTop = kBottomLeft_GrSurfaceOrigin == tex->origin() ? tex->height() - top - height : top;
const GrVkAlloc& alloc = tex->alloc();
VkDeviceSize offset = alloc.fOffset + texTop*layout.rowPitch + left*bpp;
VkDeviceSize size = height*layout.rowPitch;
@@ -606,7 +602,7 @@ bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
return false;
}
- if (kBottomLeft_GrSurfaceOrigin == texOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == tex->origin()) {
// copy into buffer by rows
const char* srcRow = reinterpret_cast<const char*>(data);
char* dstRow = reinterpret_cast<char*>(mapPtr)+(height - 1)*layout.rowPitch;
@@ -626,7 +622,7 @@ bool GrVkGpu::uploadTexDataLinear(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
return true;
}
-bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
+bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex,
int left, int top, int width, int height,
GrPixelConfig dataConfig,
const GrMipLevel texels[], int mipLevelCount) {
@@ -661,7 +657,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
}
// Determine whether we need to flip when we copy into the buffer
- bool flipY = (kBottomLeft_GrSurfaceOrigin == texOrigin && mipLevelCount);
+ bool flipY = (kBottomLeft_GrSurfaceOrigin == tex->origin() && mipLevelCount);
SkTArray<size_t> individualMipOffsets(mipLevelCount);
individualMipOffsets.push_back(0);
@@ -817,8 +813,8 @@ sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted
if (mipLevelCount) {
SkASSERT(texels[0].fPixels);
- if (!this->uploadTexDataOptimal(tex.get(), desc.fOrigin, 0, 0, desc.fWidth, desc.fHeight,
- desc.fConfig, texels, mipLevelCount)) {
+ if (!this->uploadTexDataOptimal(tex.get(), 0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
+ texels, mipLevelCount)) {
tex->unref();
return nullptr;
}
@@ -853,6 +849,15 @@ bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src,
////////////////////////////////////////////////////////////////////////////////
+static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin) {
+ // By default, all textures in Vk use TopLeft
+ if (kDefault_GrSurfaceOrigin == origin) {
+ return kTopLeft_GrSurfaceOrigin;
+ } else {
+ return origin;
+ }
+}
+
static bool check_backend_texture(const GrBackendTexture& backendTex) {
const GrVkImageInfo* info = backendTex.getVkImageInfo();
if (!info) {
@@ -868,6 +873,7 @@ static bool check_backend_texture(const GrBackendTexture& backendTex) {
}
sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTex,
+ GrSurfaceOrigin origin,
GrWrapOwnership ownership) {
if (!check_backend_texture(backendTex)) {
return nullptr;
@@ -875,16 +881,19 @@ sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kNone_GrSurfaceFlags;
- surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // Not actually used in the following
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
surfDesc.fSampleCnt = 0;
+ // In GL, Chrome assumes all textures are BottomLeft
+ // In VK, we don't have this restriction
+ surfDesc.fOrigin = resolve_origin(origin);
return GrVkTexture::MakeWrappedTexture(this, surfDesc, ownership, backendTex.getVkImageInfo());
}
sk_sp<GrTexture> GrVkGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
+ GrSurfaceOrigin origin,
int sampleCnt,
GrWrapOwnership ownership) {
if (!check_backend_texture(backendTex)) {
@@ -893,17 +902,20 @@ sk_sp<GrTexture> GrVkGpu::onWrapRenderableBackendTexture(const GrBackendTexture&
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; // Not actually used in the following
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
surfDesc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, backendTex.config());
+ // In GL, Chrome assumes all textures are BottomLeft
+ // In VK, we don't have this restriction
+ surfDesc.fOrigin = resolve_origin(origin);
return GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(this, surfDesc, ownership,
backendTex.getVkImageInfo());
}
-sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT){
+sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT,
+ GrSurfaceOrigin origin){
// 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
@@ -922,7 +934,8 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin; // Not actually used in the following
+ SkASSERT(kDefault_GrSurfaceOrigin != origin);
+ desc.fOrigin = origin;
desc.fWidth = backendRT.width();
desc.fHeight = backendRT.height();
desc.fConfig = backendRT.config();
@@ -938,6 +951,7 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
}
sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
+ GrSurfaceOrigin origin,
int sampleCnt) {
const GrVkImageInfo* info = tex.getVkImageInfo();
@@ -950,7 +964,7 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin; // Not actually used in the following
+ desc.fOrigin = resolve_origin(origin);
desc.fWidth = tex.width();
desc.fHeight = tex.height();
desc.fConfig = tex.config();
@@ -960,7 +974,7 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
return tgt;
}
-void GrVkGpu::generateMipmap(GrVkTexture* tex, GrSurfaceOrigin texOrigin) {
+void GrVkGpu::generateMipmap(GrVkTexture* tex) {
// don't do anything for linearly tiled textures (can't have mipmaps)
if (tex->isLinearTiled()) {
SkDebugf("Trying to create mipmap for linear tiled texture");
@@ -982,7 +996,7 @@ void GrVkGpu::generateMipmap(GrVkTexture* tex, GrSurfaceOrigin texOrigin) {
// We may need to resolve the texture first if it is also a render target
GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(tex->asRenderTarget());
if (texRT) {
- this->internalResolveRenderTarget(texRT, texOrigin, false);
+ this->internalResolveRenderTarget(texRT, false);
}
int width = tex->width();
@@ -1490,8 +1504,8 @@ void GrVkGpu::clearStencil(GrRenderTarget* target) {
fCurrentCmdBuffer->clearDepthStencilImage(this, vkStencil, &vkStencilColor, 1, &subRange);
}
-inline bool can_copy_image(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
- const GrSurface* src, GrSurfaceOrigin srcOrigin,
+inline bool can_copy_image(const GrSurface* dst,
+ const GrSurface* src,
const GrVkGpu* gpu) {
const GrRenderTarget* dstRT = dst->asRenderTarget();
const GrRenderTarget* srcRT = src->asRenderTarget();
@@ -1511,7 +1525,7 @@ inline bool can_copy_image(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
// We require that all vulkan GrSurfaces have been created with transfer_dst and transfer_src
// as image usage flags.
- if (srcOrigin == dstOrigin &&
+ if (src->origin() == dst->origin() &&
GrBytesPerPixel(src->config()) == GrBytesPerPixel(dst->config())) {
return true;
}
@@ -1519,13 +1533,13 @@ inline bool can_copy_image(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
return false;
}
-void GrVkGpu::copySurfaceAsCopyImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+void GrVkGpu::copySurfaceAsCopyImage(GrSurface* dst,
+ GrSurface* src,
GrVkImage* dstImage,
GrVkImage* srcImage,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- SkASSERT(can_copy_image(dst, dstOrigin, src, srcOrigin, this));
+ SkASSERT(can_copy_image(dst, src, this));
// These flags are for flushing/invalidating caches and for the dst image it doesn't matter if
// the cache is flushed since it is only being written to.
@@ -1545,8 +1559,8 @@ void GrVkGpu::copySurfaceAsCopyImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
SkIRect srcVkRect = srcRect;
int32_t dstY = dstPoint.fY;
- if (kBottomLeft_GrSurfaceOrigin == srcOrigin) {
- SkASSERT(kBottomLeft_GrSurfaceOrigin == dstOrigin);
+ if (kBottomLeft_GrSurfaceOrigin == src->origin()) {
+ SkASSERT(kBottomLeft_GrSurfaceOrigin == dst->origin());
srcVkRect.fTop = src->height() - srcRect.fBottom;
srcVkRect.fBottom = src->height() - srcRect.fTop;
dstY = dst->height() - dstPoint.fY - srcVkRect.height();
@@ -1596,8 +1610,8 @@ inline bool can_copy_as_blit(const GrSurface* dst,
return true;
}
-void GrVkGpu::copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+void GrVkGpu::copySurfaceAsBlit(GrSurface* dst,
+ GrSurface* src,
GrVkImage* dstImage,
GrVkImage* srcImage,
const SkIRect& srcRect,
@@ -1624,7 +1638,7 @@ void GrVkGpu::copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
dstRect.fLeft = dstPoint.fX;
dstRect.fRight = dstPoint.fX + srcRect.width();
- if (kBottomLeft_GrSurfaceOrigin == srcOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == src->origin()) {
srcVkRect.fTop = src->height() - srcRect.fBottom;
srcVkRect.fBottom = src->height() - srcRect.fTop;
} else {
@@ -1632,7 +1646,7 @@ void GrVkGpu::copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
srcVkRect.fBottom = srcRect.fBottom;
}
- if (kBottomLeft_GrSurfaceOrigin == dstOrigin) {
+ if (kBottomLeft_GrSurfaceOrigin == dst->origin()) {
dstRect.fTop = dst->height() - dstPoint.fY - srcVkRect.height();
} else {
dstRect.fTop = dstPoint.fY;
@@ -1641,7 +1655,7 @@ void GrVkGpu::copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
// If we have different origins, we need to flip the top and bottom of the dst rect so that we
// get the correct origintation of the copied data.
- if (srcOrigin != dstOrigin) {
+ if (src->origin() != dst->origin()) {
SkTSwap(dstRect.fTop, dstRect.fBottom);
}
@@ -1664,8 +1678,8 @@ void GrVkGpu::copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
this->didWriteToSurface(dst, &dstRect);
}
-inline bool can_copy_as_resolve(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
- const GrSurface* src, GrSurfaceOrigin srcOrigin,
+inline bool can_copy_as_resolve(const GrSurface* dst,
+ const GrSurface* src,
const GrVkGpu* gpu) {
// Our src must be a multisampled render target
if (!src->asRenderTarget() || src->asRenderTarget()->numColorSamples() <= 1) {
@@ -1680,27 +1694,27 @@ inline bool can_copy_as_resolve(const GrSurface* dst, GrSurfaceOrigin dstOrigin,
}
// Surfaces must have the same origin.
- if (srcOrigin != dstOrigin) {
+ if (src->origin() != dst->origin()) {
return false;
}
return true;
}
-void GrVkGpu::copySurfaceAsResolve(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+void GrVkGpu::copySurfaceAsResolve(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
GrVkRenderTarget* srcRT = static_cast<GrVkRenderTarget*>(src->asRenderTarget());
- this->resolveImage(dst, dstOrigin, srcRT, srcOrigin, srcRect, dstPoint);
+ this->resolveImage(dst, srcRT, srcRect, dstPoint);
}
-bool GrVkGpu::onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+bool GrVkGpu::onCopySurface(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- if (can_copy_as_resolve(dst, dstOrigin, src, srcOrigin, this)) {
- this->copySurfaceAsResolve(dst, dstOrigin, src, srcOrigin, srcRect, dstPoint);
+ if (can_copy_as_resolve(dst, src, this)) {
+ this->copySurfaceAsResolve(dst, src, srcRect, dstPoint);
return true;
}
@@ -1708,7 +1722,7 @@ bool GrVkGpu::onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue);
}
- if (fCopyManager.copySurfaceAsDraw(this, dst, dstOrigin, src, srcOrigin, srcRect, dstPoint)) {
+ if (fCopyManager.copySurfaceAsDraw(this, dst, src, srcRect, dstPoint)) {
return true;
}
@@ -1736,30 +1750,27 @@ bool GrVkGpu::onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
return false;
}
- if (can_copy_image(dst, dstOrigin, src, srcOrigin, this)) {
- this->copySurfaceAsCopyImage(dst, dstOrigin, src, srcOrigin, dstImage, srcImage,
- srcRect, dstPoint);
+ if (can_copy_image(dst, src, this)) {
+ this->copySurfaceAsCopyImage(dst, src, dstImage, srcImage, srcRect, dstPoint);
return true;
}
if (can_copy_as_blit(dst, src, dstImage, srcImage, this)) {
- this->copySurfaceAsBlit(dst, dstOrigin, src, srcOrigin, dstImage, srcImage,
- srcRect, dstPoint);
+ this->copySurfaceAsBlit(dst, src, dstImage, srcImage, srcRect, dstPoint);
return true;
}
return false;
}
-void GrVkGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin, const GrStencilSettings&,
+void GrVkGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) {
// TODO: stub.
SkASSERT(!this->caps()->sampleLocationsSupport());
*effectiveSampleCnt = rt->numStencilSamples();
}
-bool GrVkGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int width, int height, size_t rowBytes,
+bool GrVkGpu::onGetReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference* drawPreference,
ReadPixelTempDrawInfo* tempDrawInfo) {
// These settings we will always want if a temp draw is performed.
@@ -1792,7 +1803,7 @@ bool GrVkGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrig
return true;
}
-bool GrVkGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
+bool GrVkGpu::onReadPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config,
void* buffer,
@@ -1812,7 +1823,7 @@ bool GrVkGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
case GrVkRenderTarget::kAutoResolves_ResolveType:
break;
case GrVkRenderTarget::kCanResolve_ResolveType:
- this->internalResolveRenderTarget(rt, origin, false);
+ this->internalResolveRenderTarget(rt, false);
break;
default:
SkFAIL("Unknown resolve type");
@@ -1835,7 +1846,7 @@ bool GrVkGpu::onReadPixels(GrSurface* surface, GrSurfaceOrigin origin,
size_t bpp = GrBytesPerPixel(config);
size_t tightRowBytes = bpp * width;
- bool flipY = kBottomLeft_GrSurfaceOrigin == origin;
+ bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin();
VkBufferImageCopy region;
memset(&region, 0, sizeof(VkBufferImageCopy));
@@ -1959,11 +1970,11 @@ void adjust_bounds_to_granularity(SkIRect* dstBounds, const SkIRect& srcBounds,
void GrVkGpu::submitSecondaryCommandBuffer(const SkTArray<GrVkSecondaryCommandBuffer*>& buffers,
const GrVkRenderPass* renderPass,
const VkClearValue* colorClear,
- GrVkRenderTarget* target, GrSurfaceOrigin origin,
+ GrVkRenderTarget* target,
const SkIRect& bounds) {
const SkIRect* pBounds = &bounds;
SkIRect flippedBounds;
- if (kBottomLeft_GrSurfaceOrigin == origin) {
+ if (kBottomLeft_GrSurfaceOrigin == target->origin()) {
flippedBounds = bounds;
flippedBounds.fTop = target->height() - bounds.fBottom;
flippedBounds.fBottom = target->height() - bounds.fTop;
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index cde9a18a3b..7e95ca4d89 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -66,21 +66,20 @@ public:
kSkip_SyncQueue
};
- bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
+ bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*,
ReadPixelTempDrawInfo*) override;
- bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
+ bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
GrPixelConfig srcConfig, DrawPreference*,
WritePixelTempDrawInfo*) override;
- bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) override;
+ bool onCopySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) override;
- void onQueryMultisampleSpecs(GrRenderTarget*, GrSurfaceOrigin, const GrStencilSettings&,
+ void onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&,
int* effectiveSampleCnt, SamplePattern*) override;
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
@@ -118,14 +117,14 @@ public:
return fCompiler;
}
- void onResolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin origin) override {
- this->internalResolveRenderTarget(target, origin, true);
+ void onResolveRenderTarget(GrRenderTarget* target) override {
+ this->internalResolveRenderTarget(target, true);
}
void submitSecondaryCommandBuffer(const SkTArray<GrVkSecondaryCommandBuffer*>&,
const GrVkRenderPass*,
const VkClearValue*,
- GrVkRenderTarget*, GrSurfaceOrigin,
+ GrVkRenderTarget*,
const SkIRect& bounds);
void finishFlush() override;
@@ -142,7 +141,7 @@ public:
sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
- void generateMipmap(GrVkTexture* tex, GrSurfaceOrigin texOrigin);
+ void generateMipmap(GrVkTexture* tex);
bool updateBuffer(GrVkBuffer* buffer, const void* src, VkDeviceSize offset, VkDeviceSize size);
@@ -179,13 +178,18 @@ private:
sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
const GrMipLevel texels[], int mipLevelCount) override;
- sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override;
+ sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrWrapOwnership) override;
sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt,
GrWrapOwnership) override;
- sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
+ sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
+ GrSurfaceOrigin) override;
sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
int sampleCnt) override;
GrBuffer* onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern,
@@ -193,13 +197,13 @@ private:
gr_instanced::InstancedRendering* onCreateInstancedRendering() override { return nullptr; }
- bool onReadPixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onReadPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig,
void* buffer,
size_t rowBytes) override;
- bool onWritePixels(GrSurface* surface, GrSurfaceOrigin,
+ bool onWritePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const GrMipLevel texels[], int mipLevelCount) override;
@@ -216,39 +220,42 @@ private:
// wait semaphores to the submission of this command buffer.
void submitCommandBuffer(SyncQueue sync);
- void internalResolveRenderTarget(GrRenderTarget*, GrSurfaceOrigin origin, bool requiresSubmit);
+ void internalResolveRenderTarget(GrRenderTarget* target, bool requiresSubmit);
- void copySurfaceAsCopyImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- GrVkImage* dstImage, GrVkImage* srcImage,
+ void copySurfaceAsCopyImage(GrSurface* dst,
+ GrSurface* src,
+ GrVkImage* dstImage,
+ GrVkImage* srcImage,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
- void copySurfaceAsBlit(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- GrVkImage* dstImage, GrVkImage* srcImage,
+ void copySurfaceAsBlit(GrSurface* dst,
+ GrSurface* src,
+ GrVkImage* dstImage,
+ GrVkImage* srcImage,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
- void copySurfaceAsResolve(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
+ void copySurfaceAsResolve(GrSurface* dst,
+ GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
// helpers for onCreateTexture and writeTexturePixels
- bool uploadTexDataLinear(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
+ bool uploadTexDataLinear(GrVkTexture* tex,
int left, int top, int width, int height,
GrPixelConfig dataConfig,
const void* data,
size_t rowBytes);
- bool uploadTexDataOptimal(GrVkTexture* tex, GrSurfaceOrigin texOrigin,
+ bool uploadTexDataOptimal(GrVkTexture* tex,
int left, int top, int width, int height,
GrPixelConfig dataConfig,
const GrMipLevel texels[], int mipLevelCount);
- void resolveImage(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrVkRenderTarget* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint);
+ void resolveImage(GrSurface* dst,
+ GrVkRenderTarget* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
sk_sp<const GrVkBackendContext> fBackendContext;
sk_sp<GrVkCaps> fVkCaps;
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 50780b0adf..4c1ad8e787 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -178,8 +178,7 @@ void GrVkGpuCommandBuffer::onSubmit() {
cbInfo.fBounds.roundOut(&iBounds);
fGpu->submitSecondaryCommandBuffer(cbInfo.fCommandBuffers, cbInfo.fRenderPass,
- &cbInfo.fColorClearValue, fRenderTarget, fOrigin,
- iBounds);
+ &cbInfo.fColorClearValue, fRenderTarget, iBounds);
}
}
}
@@ -500,12 +499,10 @@ sk_sp<GrVkPipelineState> GrVkGpuCommandBuffer::prepareDrawState(
GrRenderTarget* rt = pipeline.renderTarget();
if (!pipeline.getScissorState().enabled()) {
- GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(),
- rt, pipeline.proxy()->origin(),
+ GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), rt,
SkIRect::MakeWH(rt->width(), rt->height()));
} else if (!hasDynamicState) {
- GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(),
- rt, pipeline.proxy()->origin(),
+ GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), rt,
pipeline.getScissorState().rect());
}
GrVkPipeline::SetDynamicViewportState(fGpu, cbInfo.currentCmdBuf(), rt);
@@ -534,14 +531,14 @@ static void prepare_sampled_images(const GrResourceIOProcessor& processor, GrVkG
// We may need to resolve the texture first if it is also a render target
GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(vkTexture->asRenderTarget());
if (texRT) {
- gpu->onResolveRenderTarget(texRT, sampler.proxy()->origin());
+ gpu->onResolveRenderTarget(texRT);
}
const GrSamplerParams& params = sampler.params();
// Check if we need to regenerate any mip maps
if (GrSamplerParams::kMipMap_FilterMode == params.filterMode()) {
if (vkTexture->texturePriv().mipMapsAreDirty()) {
- gpu->generateMipmap(vkTexture, sampler.proxy()->origin());
+ gpu->generateMipmap(vkTexture);
vkTexture->texturePriv().dirtyMipMaps(false);
}
}
@@ -605,8 +602,7 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
if (dynamicStates) {
if (pipeline.getScissorState().enabled()) {
GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(),
- target, pipeline.proxy()->origin(),
- dynamicStates[i].fScissorRect);
+ target, dynamicStates[i].fScissorRect);
}
}
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 67005bec20..e3561331c2 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -495,7 +495,6 @@ void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
void GrVkPipeline::SetDynamicScissorRectState(GrVkGpu* gpu,
GrVkCommandBuffer* cmdBuffer,
const GrRenderTarget* renderTarget,
- GrSurfaceOrigin rtOrigin,
SkIRect scissorRect) {
if (!scissorRect.intersect(SkIRect::MakeWH(renderTarget->width(), renderTarget->height()))) {
scissorRect.setEmpty();
@@ -504,10 +503,10 @@ void GrVkPipeline::SetDynamicScissorRectState(GrVkGpu* gpu,
VkRect2D scissor;
scissor.offset.x = scissorRect.fLeft;
scissor.extent.width = scissorRect.width();
- if (kTopLeft_GrSurfaceOrigin == rtOrigin) {
+ if (kTopLeft_GrSurfaceOrigin == renderTarget->origin()) {
scissor.offset.y = scissorRect.fTop;
} else {
- SkASSERT(kBottomLeft_GrSurfaceOrigin == rtOrigin);
+ SkASSERT(kBottomLeft_GrSurfaceOrigin == renderTarget->origin());
scissor.offset.y = renderTarget->height() - scissorRect.fBottom;
}
scissor.extent.height = scissorRect.height();
diff --git a/src/gpu/vk/GrVkPipeline.h b/src/gpu/vk/GrVkPipeline.h
index 88c3d5f915..d05974b102 100644
--- a/src/gpu/vk/GrVkPipeline.h
+++ b/src/gpu/vk/GrVkPipeline.h
@@ -40,7 +40,7 @@ public:
VkPipeline pipeline() const { return fPipeline; }
static void SetDynamicScissorRectState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*,
- GrSurfaceOrigin, SkIRect);
+ SkIRect);
static void SetDynamicViewportState(GrVkGpu*, GrVkCommandBuffer*, const GrRenderTarget*);
static void SetDynamicBlendConstantState(GrVkGpu*, GrVkCommandBuffer*, GrPixelConfig,
const GrXferProcessor&);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 8c2dfa0cec..a19556b653 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -266,8 +266,9 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
return nullptr;
}
- SkASSERT(kDefault_GrSurfaceOrigin != origin);
- sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex, ownership);
+ sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex,
+ origin,
+ ownership);
if (!tex) {
return nullptr;
}
@@ -490,7 +491,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
sk_sp<GrSemaphore> sema = context->getGpu()->prepareTextureForCrossContextUsage(texture.get());
- auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), proxy->origin(),
+ auto gen = GrBackendTextureImageGenerator::Make(std::move(texture),
std::move(sema), codecImage->alphaType(),
std::move(texColorSpace));
return SkImage::MakeFromGenerator(std::move(gen));
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index abf2973db7..5c665d13af 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -58,7 +58,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
backendTexHandle);
sk_sp<GrSurface> texRT2 = context->resourceProvider()->wrapRenderableBackendTexture(
- backendTex, 0, kBorrow_GrWrapOwnership);
+ backendTex, kTopLeft_GrSurfaceOrigin, 0, kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 9f5801cd47..78465f989f 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -27,7 +27,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider,
desc.fConfig, fboInfo);
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
- sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT));
+ sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin));
SkASSERT(!defaultFBO->asTexture());
return GrSurfaceProxy::MakeWrapped(std::move(defaultFBO), desc.fOrigin);
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 87072dd25b..547d3b2ce3 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -63,6 +63,7 @@ static void check_rendertarget(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() != rt->uniqueID().asUInt());
}
+ REPORTER_ASSERT(reporter, rt->origin() == rtProxy->origin());
if (SkBackingFit::kExact == fit) {
REPORTER_ASSERT(reporter, rt->width() == rtProxy->width());
REPORTER_ASSERT(reporter, rt->height() == rtProxy->height());
@@ -97,6 +98,7 @@ static void check_texture(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() != tex->uniqueID().asUInt());
}
+ REPORTER_ASSERT(reporter, tex->origin() == texProxy->origin());
if (SkBackingFit::kExact == fit) {
REPORTER_ASSERT(reporter, tex->width() == texProxy->width());
REPORTER_ASSERT(reporter, tex->height() == texProxy->height());
@@ -232,7 +234,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
config, fboInfo);
sk_sp<GrRenderTarget> defaultFBO(
- provider->wrapBackendRenderTarget(backendRT));
+ provider->wrapBackendRenderTarget(backendRT, origin));
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO,
origin));
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index ffe7e35861..4c40619c4e 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -54,7 +54,7 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
*backendTexHandle);
SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin);
- sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
+ sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, p.fOrigin,
kBorrow_GrWrapOwnership);
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);
}
@@ -169,8 +169,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
// Two non-overlapping intervals w/ different RT classifications should never share
{ { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kNotRT, kRGBA, kA, 0, kTL }, kDontShare },
{ { 64, kNotRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kTL }, kDontShare },
- // Two non-overlapping intervals w/ different origins should share
- { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kShare },
+ // Two non-overlapping intervals w/ different origins should not share
+ // TODO: rm this test case
+ { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kDontShare },
};
for (auto test : gNonOverlappingTests) {
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index c10d581288..48f50a0c48 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -96,10 +96,9 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
GrContext* context = ctxInfo.grContext();
GrSurfaceDesc smallDesc;
smallDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- smallDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ smallDesc.fConfig = kRGBA_8888_GrPixelConfig;
smallDesc.fWidth = 4;
smallDesc.fHeight = 4;
- smallDesc.fConfig = kRGBA_8888_GrPixelConfig;
smallDesc.fSampleCnt = 0;
if (context->caps()->avoidStencilBuffers()) {
@@ -137,10 +136,9 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
// An RT with a much larger size should not share.
GrSurfaceDesc bigDesc;
bigDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- bigDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ bigDesc.fConfig = kRGBA_8888_GrPixelConfig;
bigDesc.fWidth = 400;
bigDesc.fHeight = 200;
- bigDesc.fConfig = kRGBA_8888_GrPixelConfig;
bigDesc.fSampleCnt = 0;
sk_sp<GrTexture> bigRT(resourceProvider->createTexture(bigDesc, SkBudgeted::kNo));
if (bigRT && bigRT->asRenderTarget()) {
@@ -230,7 +228,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
kRGBA_8888_GrPixelConfig,
texHandles[0]);
sk_sp<GrTexture> borrowed(context->resourceProvider()->wrapBackendTexture(
- backendTex1, kBorrow_GrWrapOwnership));
+ backendTex1, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership));
GrBackendTexture backendTex2 = GrTest::CreateBackendTexture(context->contextPriv().getBackend(),
kW,
@@ -238,7 +236,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
kRGBA_8888_GrPixelConfig,
texHandles[1]);
sk_sp<GrTexture> adopted(context->resourceProvider()->wrapBackendTexture(
- backendTex2, kAdopt_GrWrapOwnership));
+ backendTex2, kTopLeft_GrSurfaceOrigin, kAdopt_GrWrapOwnership));
REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
if (!borrowed || !adopted) {
@@ -1638,7 +1636,6 @@ static sk_sp<GrTexture> make_normal_texture(GrResourceProvider* provider,
int sampleCnt) {
GrSurfaceDesc desc;
desc.fFlags = flags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 722707ae9b..daeaadad08 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -109,7 +109,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix
REPORTER_ASSERT(reporter, result);
memset(dstBuffer.get(), 0xCDCD, size);
- result = context->getGpu()->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
+ result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
config, dstBuffer.get(), rowBytes);
if (result) {
REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
@@ -141,7 +141,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix
REPORTER_ASSERT(reporter, result);
memset(dstBuffer.get(), 0xCDCD, size);
- result = context->getGpu()->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
+ result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
config, dstBuffer.get(), rowBytes);
if (result) {
REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index 4f4c83362f..f64043df62 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -37,30 +37,42 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) {
const GrVkImageInfo* imageInfo = reinterpret_cast<const GrVkImageInfo*>(backendObj);
GrBackendTexture backendTex = GrBackendTexture(kW, kH, *imageInfo);
- sk_sp<GrTexture> tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership);
+ sk_sp<GrTexture> tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, tex);
// image is null
GrVkImageInfo backendCopy = *imageInfo;
backendCopy.fImage = VK_NULL_HANDLE;
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership);
+ tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
- tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
// alloc is null
backendCopy.fImage = imageInfo->fImage;
backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership);
+ tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
- tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
// check adopt creation
backendCopy.fAlloc = imageInfo->fAlloc;
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, tex);
@@ -76,14 +88,14 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) {
GrBackendRenderTarget backendRT(kW, kH, 0, 0, *backendTex);
- sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT);
+ sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT, kTopLeft_GrSurfaceOrigin);
REPORTER_ASSERT(reporter, rt);
// image is null
GrVkImageInfo backendCopy = *backendTex;
backendCopy.fImage = VK_NULL_HANDLE;
GrBackendRenderTarget backendRT2(kW, kH, 0, 0, backendCopy);
- rt = gpu->wrapBackendRenderTarget(backendRT2);
+ rt = gpu->wrapBackendRenderTarget(backendRT2, kTopLeft_GrSurfaceOrigin);
REPORTER_ASSERT(reporter, !rt);
// alloc is null
@@ -91,7 +103,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) {
backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
// can wrap null alloc
GrBackendRenderTarget backendRT3(kW, kH, 0, 0, backendCopy);
- rt = gpu->wrapBackendRenderTarget(backendRT3);
+ rt = gpu->wrapBackendRenderTarget(backendRT3, kTopLeft_GrSurfaceOrigin);
REPORTER_ASSERT(reporter, rt);
// When we wrapBackendRenderTarget it is always borrowed, so we must make sure to free the
@@ -107,7 +119,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) {
const GrVkImageInfo* imageInfo = reinterpret_cast<const GrVkImageInfo*>(backendObj);
GrBackendTexture backendTex = GrBackendTexture(kW, kH, *imageInfo);
- sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(backendTex, 0,
+ sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, tex);
@@ -115,24 +129,39 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) {
GrVkImageInfo backendCopy = *imageInfo;
backendCopy.fImage = VK_NULL_HANDLE;
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership);
+ tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
+ kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
// alloc is null
backendCopy.fImage = imageInfo->fImage;
backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership);
+ tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
+ kBorrow_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, !tex);
// check adopt creation
backendCopy.fAlloc = imageInfo->fAlloc;
backendTex = GrBackendTexture(kW, kH, backendCopy);
- tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership);
+ tex = gpu->wrapRenderableBackendTexture(backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ 0,
+ kAdopt_GrWrapOwnership);
REPORTER_ASSERT(reporter, tex);
gpu->deleteTestingOnlyBackendTexture(backendObj, true);