diff options
author | Robert Phillips <robertphillips@google.com> | 2017-08-29 08:26:54 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-29 17:36:31 +0000 |
commit | b0e93a22bbfad05bb834e33387880ece56e0f6d2 (patch) | |
tree | 41862bc027841d9d03a06661f2f3ef820610a9ac /src/gpu/vk/GrVkGpuCommandBuffer.cpp | |
parent | aa0ce825b877871f73532beb6fde6bf2f80e99dd (diff) |
Remove origin field from GrSurface (take 2)
This mainly consists of rm origin from GrSurface and the wrapBackEnd*
methods and then re-adding an explicit origin parameter to all the
GrGpu methods that need it.
TBR=bsalomon@google.com
Change-Id: I4248b2a4749ef844da4233ce53b0dc504bc9eb74
Reviewed-on: https://skia-review.googlesource.com/30280
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/vk/GrVkGpuCommandBuffer.cpp')
-rw-r--r-- | src/gpu/vk/GrVkGpuCommandBuffer.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp index 1b2befff07..f202c9b709 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp +++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp @@ -22,9 +22,9 @@ #include "GrVkTexture.h" #include "SkRect.h" -void GrVkGpuTextureCommandBuffer::copy(GrSurface* src, const SkIRect& srcRect, - const SkIPoint& dstPoint) { - fCopies.emplace_back(src, srcRect, dstPoint); +void GrVkGpuTextureCommandBuffer::copy(GrSurface* src, GrSurfaceOrigin srcOrigin, + const SkIRect& srcRect, const SkIPoint& dstPoint) { + fCopies.emplace_back(src, srcOrigin, srcRect, dstPoint); } void GrVkGpuTextureCommandBuffer::insertEventMarker(const char* msg) { @@ -34,7 +34,8 @@ void GrVkGpuTextureCommandBuffer::insertEventMarker(const char* msg) { void GrVkGpuTextureCommandBuffer::submit() { for (int i = 0; i < fCopies.count(); ++i) { CopyInfo& copyInfo = fCopies[i]; - fGpu->copySurface(fTexture, copyInfo.fSrc, copyInfo.fSrcRect, copyInfo.fDstPoint); + fGpu->copySurface(fTexture, fOrigin, copyInfo.fSrc, copyInfo.fSrcOrigin, copyInfo.fSrcRect, + copyInfo.fDstPoint); } } @@ -181,7 +182,8 @@ void GrVkGpuRTCommandBuffer::submit() { for (int j = 0; j < cbInfo.fPreCopies.count(); ++j) { CopyInfo& copyInfo = cbInfo.fPreCopies[j]; - fGpu->copySurface(fRenderTarget, copyInfo.fSrc, copyInfo.fSrcRect, copyInfo.fDstPoint); + fGpu->copySurface(fRenderTarget, fOrigin, copyInfo.fSrc, copyInfo.fSrcOrigin, + copyInfo.fSrcRect, copyInfo.fDstPoint); } // TODO: We can't add this optimization yet since many things create a scratch texture which @@ -203,7 +205,7 @@ void GrVkGpuRTCommandBuffer::submit() { cbInfo.fBounds.roundOut(&iBounds); fGpu->submitSecondaryCommandBuffer(cbInfo.fCommandBuffers, cbInfo.fRenderPass, - &cbInfo.fColorClearValue, vkRT, iBounds); + &cbInfo.fColorClearValue, vkRT, fOrigin, iBounds); } } } @@ -440,13 +442,13 @@ void GrVkGpuRTCommandBuffer::inlineUpload(GrOpFlushState* state, GrDrawOp::Defer fCommandBufferInfos[fCurrentCmdInfo].fPreDrawUploads.emplace_back(state, upload); } -void GrVkGpuRTCommandBuffer::copy(GrSurface* src, const SkIRect& srcRect, +void GrVkGpuRTCommandBuffer::copy(GrSurface* src, GrSurfaceOrigin srcOrigin, const SkIRect& srcRect, const SkIPoint& dstPoint) { if (!fCommandBufferInfos[fCurrentCmdInfo].fIsEmpty || fCommandBufferInfos[fCurrentCmdInfo].fStartsWithClear) { this->addAdditionalRenderPass(); } - fCommandBufferInfos[fCurrentCmdInfo].fPreCopies.emplace_back(src, srcRect, dstPoint); + fCommandBufferInfos[fCurrentCmdInfo].fPreCopies.emplace_back(src, srcOrigin, srcRect, dstPoint); } //////////////////////////////////////////////////////////////////////////////// @@ -523,10 +525,12 @@ sk_sp<GrVkPipelineState> GrVkGpuRTCommandBuffer::prepareDrawState( GrRenderTarget* rt = pipeline.renderTarget(); if (!pipeline.getScissorState().enabled()) { - GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), rt, + GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), + rt, pipeline.proxy()->origin(), SkIRect::MakeWH(rt->width(), rt->height())); } else if (!hasDynamicState) { - GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), rt, + GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), + rt, pipeline.proxy()->origin(), pipeline.getScissorState().rect()); } GrVkPipeline::SetDynamicViewportState(fGpu, cbInfo.currentCmdBuf(), rt); @@ -555,14 +559,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); + gpu->onResolveRenderTarget(texRT, sampler.proxy()->origin()); } 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); + gpu->generateMipmap(vkTexture, sampler.proxy()->origin()); vkTexture->texturePriv().dirtyMipMaps(false); } } @@ -622,7 +626,7 @@ void GrVkGpuRTCommandBuffer::onDraw(const GrPipeline& pipeline, if (dynamicStates) { if (pipeline.getScissorState().enabled()) { GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), - fRenderTarget, + fRenderTarget, pipeline.proxy()->origin(), dynamicStates[i].fScissorRect); } } |