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

Unified Diff: src/gpu/GrGpu.cpp

Issue 1925303002: Add mipmap loading to Vulkan. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes to handle mipmap allocations and autogen Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | src/gpu/vk/GrVkGpu.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.cpp
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index eef7118a1b290aea3eccc3131fa3f4c67f14254d..691c0ab83abbaf672b6c031dcf12bad0bfbdeda6 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -20,6 +20,7 @@
#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSurfacePriv.h"
+#include "GrTexturePriv.h"
#include "SkTypes.h"
GrMesh& GrMesh::operator =(const GrMesh& di) {
@@ -375,6 +376,8 @@ bool GrGpu::writePixels(GrSurface* surface,
this->handleDirtyContext();
if (this->onWritePixels(surface, left, top, width, height, config, texels)) {
+ SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
+ this->didWriteToSurface(surface, &rect, texels.count());
fStats.incTextureUploads();
return true;
}
@@ -403,6 +406,8 @@ bool GrGpu::transferPixels(GrSurface* surface,
this->handleDirtyContext();
if (this->onTransferPixels(surface, left, top, width, height, config,
transferBuffer, offset, rowBytes)) {
+ SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
+ this->didWriteToSurface(surface, &rect);
fStats.incTransfersToTexture();
return true;
}
@@ -415,6 +420,20 @@ void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
this->onResolveRenderTarget(target);
}
+void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_t mipLevels) const {
+ SkASSERT(surface);
+ // Mark any MIP chain and resolve buffer as dirty if and only if there is a non-empty bounds.
+ if (nullptr == bounds || !bounds->isEmpty()) {
+ if (GrRenderTarget* target = surface->asRenderTarget()) {
+ target->flagAsNeedingResolve(bounds);
+ }
+ GrTexture* texture = surface->asTexture();
+ if (texture && 1 == mipLevels) {
egdaniel 2016/04/29 18:10:28 just to clarify for myself here. The reason we mak
jvanverth1 2016/04/29 18:16:10 Yes, that's right.
+ texture->texturePriv().dirtyMipMaps(true);
+ }
+ }
+}
+
inline static uint8_t multisample_specs_id(uint8_t numSamples, GrSurfaceOrigin origin,
const GrCaps& caps) {
if (!caps.sampleLocationsSupport()) {
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | src/gpu/vk/GrVkGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698