Commit 1179b299 by Jamie Madill Committed by Commit Bot

D3D11: Enable renderable mipmap generation.

This path might have been broken some time back with the "setData" path enabled. This speeds up sRGB mipmap generation considerably. Bug: chromium:1130678 Change-Id: Id1c22bc1cfb815339bad5955ce990fe9f48d8b5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2432112Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 7930477f
...@@ -475,11 +475,21 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context, ...@@ -475,11 +475,21 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context,
// We know that all layers have the same dimension, for the texture to be complete // We know that all layers have the same dimension, for the texture to be complete
GLint layerCount = static_cast<GLint>(getLayerCount(mBaseLevel)); GLint layerCount = static_cast<GLint>(getLayerCount(mBaseLevel));
// When making mipmaps with the setData workaround enabled, the texture storage has if (mTexStorage && !mTexStorage->isRenderTarget() &&
// the image data already. For non-render-target storage, we have to pull it out into canCreateRenderTargetForImage(getImageIndex(mBaseLevel, 0)) &&
// an image layer. mRenderer->getRendererClass() == RENDERER_D3D11)
if (mRenderer->getFeatures().setDataFasterThanImageUpload.enabled && mTexStorage)
{ {
if (!mRenderer->getFeatures().setDataFasterThanImageUpload.enabled)
{
ANGLE_TRY(updateStorage(context));
}
ANGLE_TRY(ensureRenderTarget(context));
}
else if (mRenderer->getFeatures().setDataFasterThanImageUpload.enabled && mTexStorage)
{
// When making mipmaps with the setData workaround enabled, the texture storage has
// the image data already. For non-render-target storage, we have to pull it out into
// an image layer.
if (!mTexStorage->isRenderTarget()) if (!mTexStorage->isRenderTarget())
{ {
// Copy from the storage mip 0 to Image mip 0 // Copy from the storage mip 0 to Image mip 0
...@@ -530,9 +540,9 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context, ...@@ -530,9 +540,9 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context,
} }
} }
mDirtyImages = true; mDirtyImages = !renderableStorage;
if (mTexStorage) if (mTexStorage && mDirtyImages)
{ {
ANGLE_TRY(updateStorage(context)); ANGLE_TRY(updateStorage(context));
} }
......
...@@ -659,9 +659,10 @@ angle::Result TextureStorage11::generateMipmap(const gl::Context *context, ...@@ -659,9 +659,10 @@ angle::Result TextureStorage11::generateMipmap(const gl::Context *context,
RenderTargetD3D *dest = nullptr; RenderTargetD3D *dest = nullptr;
ANGLE_TRY(getRenderTarget(context, destIndex, 0, &dest)); ANGLE_TRY(getRenderTarget(context, destIndex, 0, &dest));
RenderTarget11 *rt11 = GetAs<RenderTarget11>(source); RenderTarget11 *srcRT11 = GetAs<RenderTarget11>(source);
const d3d11::SharedSRV &sourceSRV = rt11->getBlitShaderResourceView(context); RenderTarget11 *dstRT11 = GetAs<RenderTarget11>(dest);
const d3d11::RenderTargetView &destRTV = rt11->getRenderTargetView(); const d3d11::SharedSRV &sourceSRV = srcRT11->getBlitShaderResourceView(context);
const d3d11::RenderTargetView &destRTV = dstRT11->getRenderTargetView();
gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth()); gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth()); gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment