Commit 20d6d48c by Jamie Madill Committed by Commit Bot

D3D11: Make createStagingTexture return Error.

This removes the use of the ErrorOrResult pattern in Renderer11. Bug: angleproject:2738 Change-Id: Icc046ddd86394df56ca1acd10b1804fd6afa8ad0 Reviewed-on: https://chromium-review.googlesource.com/1142953Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent df0e48fe
......@@ -1473,9 +1473,8 @@ gl::Error Blit11::copyAndConvertImpl(const TextureHelper11 &source,
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
TextureHelper11 sourceStaging;
ANGLE_TRY_RESULT(mRenderer->createStagingTexture(ResourceType::Texture2D, source.getFormatSet(),
sourceSize, StagingAccess::READ),
sourceStaging);
ANGLE_TRY(mRenderer->createStagingTexture(ResourceType::Texture2D, source.getFormatSet(),
sourceSize, StagingAccess::READ, &sourceStaging));
deviceContext->CopySubresourceRegion(sourceStaging.get(), 0, 0, 0, 0, source.get(),
sourceSubresource, nullptr);
......@@ -1539,9 +1538,8 @@ gl::Error Blit11::copyAndConvert(const TextureHelper11 &source,
// ID3D11DevicContext::UpdateSubresource can be called
// using it's mapped data as a source
TextureHelper11 destStaging;
ANGLE_TRY_RESULT(mRenderer->createStagingTexture(ResourceType::Texture2D, dest.getFormatSet(),
destSize, StagingAccess::READ_WRITE),
destStaging);
ANGLE_TRY(mRenderer->createStagingTexture(ResourceType::Texture2D, dest.getFormatSet(),
destSize, StagingAccess::READ_WRITE, &destStaging));
deviceContext->CopySubresourceRegion(destStaging.get(), 0, 0, 0, 0, dest.get(), destSubresource,
nullptr);
......@@ -2215,10 +2213,8 @@ gl::ErrorOrResult<TextureHelper11> Blit11::resolveStencil(const gl::Context *con
gl::Box copyBox(0, 0, 0, extents.width, extents.height, 1);
TextureHelper11 dest;
ANGLE_TRY_RESULT(
mRenderer->createStagingTexture(ResourceType::Texture2D, depthStencil->getFormatSet(),
extents, StagingAccess::READ_WRITE),
dest);
ANGLE_TRY(mRenderer->createStagingTexture(ResourceType::Texture2D, depthStencil->getFormatSet(),
extents, StagingAccess::READ_WRITE, &dest));
const auto &copyFunction = GetCopyDepthStencilFunction(depthStencil->getInternalFormat());
const auto &dsFormatSet = depthStencil->getFormatSet();
......
......@@ -1471,10 +1471,9 @@ gl::Error Buffer11::PackStorage::packPixels(const gl::Context *context,
if (!mStagingTexture.get() || mStagingTexture.getFormat() != srcTexture.getFormat() ||
mStagingTexture.getExtents() != srcTextureSize)
{
ANGLE_TRY_RESULT(
mRenderer->createStagingTexture(srcTexture.getTextureType(), srcTexture.getFormatSet(),
srcTextureSize, StagingAccess::READ),
mStagingTexture);
ANGLE_TRY(mRenderer->createStagingTexture(srcTexture.getTextureType(),
srcTexture.getFormatSet(), srcTextureSize,
StagingAccess::READ, &mStagingTexture));
}
// ReadPixels from multisampled FBOs isn't supported in current GL
......
......@@ -3064,10 +3064,8 @@ gl::Error Renderer11::readFromAttachment(const gl::Context *context,
gl::Extents safeSize(safeArea.width, safeArea.height, 1);
TextureHelper11 stagingHelper;
ANGLE_TRY_RESULT(
createStagingTexture(textureHelper.getTextureType(), textureHelper.getFormatSet(), safeSize,
StagingAccess::READ),
stagingHelper);
ANGLE_TRY(createStagingTexture(textureHelper.getTextureType(), textureHelper.getFormatSet(),
safeSize, StagingAccess::READ, &stagingHelper));
stagingHelper.setDebugName("readFromAttachment::stagingHelper");
TextureHelper11 resolvedTextureHelper;
......@@ -3694,11 +3692,11 @@ gl::Error Renderer11::dispatchCompute(const gl::Context *context,
return gl::NoError();
}
gl::ErrorOrResult<TextureHelper11> Renderer11::createStagingTexture(
ResourceType textureType,
const d3d11::Format &formatSet,
const gl::Extents &size,
StagingAccess readAndWriteAccess)
gl::Error Renderer11::createStagingTexture(ResourceType textureType,
const d3d11::Format &formatSet,
const gl::Extents &size,
StagingAccess readAndWriteAccess,
TextureHelper11 *textureOut)
{
if (textureType == ResourceType::Texture2D)
{
......@@ -3720,9 +3718,8 @@ gl::ErrorOrResult<TextureHelper11> Renderer11::createStagingTexture(
stagingDesc.CPUAccessFlags |= D3D11_CPU_ACCESS_WRITE;
}
TextureHelper11 stagingTex;
ANGLE_TRY(allocateTexture(stagingDesc, formatSet, &stagingTex));
return stagingTex;
ANGLE_TRY(allocateTexture(stagingDesc, formatSet, textureOut));
return gl::NoError();
}
ASSERT(textureType == ResourceType::Texture3D);
......@@ -3737,9 +3734,8 @@ gl::ErrorOrResult<TextureHelper11> Renderer11::createStagingTexture(
stagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
stagingDesc.MiscFlags = 0;
TextureHelper11 stagingTex;
ANGLE_TRY(allocateTexture(stagingDesc, formatSet, &stagingTex));
return stagingTex;
ANGLE_TRY(allocateTexture(stagingDesc, formatSet, textureOut));
return gl::NoError();
}
gl::Error Renderer11::allocateTexture(const D3D11_TEXTURE2D_DESC &desc,
......
......@@ -395,10 +395,11 @@ class Renderer11 : public RendererD3D
GLuint numGroupsZ);
gl::Error applyComputeShader(const gl::Context *context);
gl::ErrorOrResult<TextureHelper11> createStagingTexture(ResourceType textureType,
const d3d11::Format &formatSet,
const gl::Extents &size,
StagingAccess readAndWriteAccess);
gl::Error createStagingTexture(ResourceType textureType,
const d3d11::Format &formatSet,
const gl::Extents &size,
StagingAccess readAndWriteAccess,
TextureHelper11 *textureOut);
template <typename DescT, typename ResourceT>
gl::Error allocateResource(const DescT &desc, ResourceT *resourceOut)
......
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