Dawn: remove persistent TextureView from GrDawnTexture.
For mipmaps, the texture view we need depends on the mipmap mode. In
particular, for mipmap "none" mode, we need a view which ignores
everything but mip 0. So remove the persistent one.
Change-Id: I37a5e8a299edf423b67fd85135d6fbd9d26e62a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320636
Commit-Queue: Stephen White <senorblanco@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index 4ce2b1a..98a678f 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -462,7 +462,7 @@
wgpu::Sampler sampler = gpu->getOrCreateSampler(state);
bindings->push_back(make_bind_group_entry((*binding)++, sampler));
GrDawnTexture* tex = static_cast<GrDawnTexture*>(texture);
- wgpu::TextureView textureView = tex->textureView();
+ wgpu::TextureView textureView = tex->texture().CreateView();
bindings->push_back(make_bind_group_entry((*binding)++, textureView));
}
diff --git a/src/gpu/dawn/GrDawnTexture.cpp b/src/gpu/dawn/GrDawnTexture.cpp
index d5ad240..2f304a2 100644
--- a/src/gpu/dawn/GrDawnTexture.cpp
+++ b/src/gpu/dawn/GrDawnTexture.cpp
@@ -14,13 +14,11 @@
GrDawnTexture::GrDawnTexture(GrDawnGpu* gpu,
SkISize dimensions,
- wgpu::TextureView textureView,
const GrDawnTextureInfo& info,
GrMipmapStatus mipmapStatus)
: GrSurface(gpu, dimensions, GrProtected::kNo)
, GrTexture(gpu, dimensions, GrProtected::kNo, GrTextureType::k2D, mipmapStatus)
- , fInfo(info)
- , fTextureView(textureView) {}
+ , fInfo(info) {}
sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, SkISize dimensions,
wgpu::TextureFormat format,
@@ -52,12 +50,6 @@
return nullptr;
}
- wgpu::TextureView textureView = tex.CreateView();
-
- if (!textureView) {
- return nullptr;
- }
-
GrDawnTextureInfo info;
info.fTexture = tex;
info.fFormat = textureDesc.format;
@@ -66,13 +58,12 @@
if (renderTarget) {
result = sk_sp<GrDawnTextureRenderTarget>(new GrDawnTextureRenderTarget(gpu,
dimensions,
- textureView,
sampleCnt,
info,
status));
} else {
result = sk_sp<GrDawnTexture>(
- new GrDawnTexture(gpu, dimensions, textureView, info, status));
+ new GrDawnTexture(gpu, dimensions, info, status));
}
result->registerWithCache(budgeted);
return result;
@@ -88,18 +79,13 @@
GrWrapCacheable cacheable,
GrIOType ioType,
const GrDawnTextureInfo& info) {
- wgpu::TextureView textureView = info.fTexture.CreateView();
- if (!textureView) {
- return nullptr;
- }
-
sk_sp<GrDawnTexture> tex;
if (GrRenderable::kYes == renderable) {
tex = sk_sp<GrDawnTexture>(new GrDawnTextureRenderTarget(
- gpu, dimensions, textureView, sampleCnt, info, status));
+ gpu, dimensions, sampleCnt, info, status));
} else {
tex = sk_sp<GrDawnTexture>(
- new GrDawnTexture(gpu, dimensions, textureView, info, status));
+ new GrDawnTexture(gpu, dimensions, info, status));
}
tex->registerWithCacheWrapped(cacheable);
if (ioType == kRead_GrIOType) {
diff --git a/src/gpu/dawn/GrDawnTexture.h b/src/gpu/dawn/GrDawnTexture.h
index effe7a3..b27ba50 100644
--- a/src/gpu/dawn/GrDawnTexture.h
+++ b/src/gpu/dawn/GrDawnTexture.h
@@ -37,10 +37,8 @@
const SkIRect& dstRect, wgpu::CommandEncoder copyEncoder);
wgpu::Texture texture() const { return fInfo.fTexture; }
- wgpu::TextureView textureView() const { return fTextureView; }
protected:
- GrDawnTexture(GrDawnGpu*, SkISize dimensions, wgpu::TextureView,
- const GrDawnTextureInfo&, GrMipmapStatus);
+ GrDawnTexture(GrDawnGpu*, SkISize dimensions, const GrDawnTextureInfo&, GrMipmapStatus);
GrDawnGpu* getDawnGpu() const;
@@ -53,7 +51,6 @@
private:
GrDawnTextureInfo fInfo;
- wgpu::TextureView fTextureView;
using INHERITED = GrTexture;
};
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
index 8ad4314..fce4084 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
@@ -13,12 +13,11 @@
GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
SkISize dimensions,
- wgpu::TextureView textureView,
int sampleCnt,
const GrDawnTextureInfo& textureInfo,
GrMipmapStatus mipmapStatus)
: GrSurface(gpu, dimensions, GrProtected::kNo)
- , GrDawnTexture(gpu, dimensions, textureView, textureInfo, mipmapStatus)
+ , GrDawnTexture(gpu, dimensions, textureInfo, mipmapStatus)
, GrDawnRenderTarget(gpu, dimensions, sampleCnt,
GrDawnRenderTargetInfo(textureInfo)) {}
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.h b/src/gpu/dawn/GrDawnTextureRenderTarget.h
index 9cf6fd7..e94fb7b 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.h
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.h
@@ -23,7 +23,6 @@
public:
GrDawnTextureRenderTarget(GrDawnGpu* gpu,
SkISize dimensions,
- const wgpu::TextureView textureView,
int sampleCnt,
const GrDawnTextureInfo& textureInfo,
GrMipmapStatus mipmapStatus);