Commit 096c5296 by Jamie Madill Committed by Commit Bot

Blit11: Refactor for error returning.

Don't use ErrorOrResult. Also pass gl::Context around to more places. Bug: angleproject:2378 Change-Id: Id498471fc9ab4f4d6b2285e110381b10a1247689 Reviewed-on: https://chromium-review.googlesource.com/1148465Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent daf2e913
......@@ -70,7 +70,8 @@ class Blit11 : angle::NonCopyable
const gl::Extents &destSize,
const gl::Rectangle *scissor);
gl::Error copyDepthStencil(const TextureHelper11 &source,
gl::Error copyDepthStencil(const gl::Context *context,
const TextureHelper11 &source,
unsigned int sourceSubresource,
const gl::Box &sourceArea,
const gl::Extents &sourceSize,
......@@ -80,12 +81,14 @@ class Blit11 : angle::NonCopyable
const gl::Extents &destSize,
const gl::Rectangle *scissor);
gl::ErrorOrResult<TextureHelper11> resolveDepth(const gl::Context *context,
RenderTarget11 *depth);
gl::Error resolveDepth(const gl::Context *context,
RenderTarget11 *depth,
TextureHelper11 *textureOut);
gl::ErrorOrResult<TextureHelper11> resolveStencil(const gl::Context *context,
RenderTarget11 *depthStencil,
bool alsoDepth);
gl::Error resolveStencil(const gl::Context *context,
RenderTarget11 *depthStencil,
bool alsoDepth,
TextureHelper11 *textureOut);
using BlitConvertFunction = void(const gl::Box &sourceArea,
const gl::Box &destArea,
......@@ -226,9 +229,11 @@ class Blit11 : angle::NonCopyable
WriteVertexFunction vertexWriteFunction;
};
gl::Error initResources();
gl::Error initResources(const gl::Context *context);
gl::Error getShaderSupport(const Shader &shader, ShaderSupport *supportOut);
gl::Error getShaderSupport(const gl::Context *context,
const Shader &shader,
ShaderSupport *supportOut);
static BlitShaderType GetBlitShaderType(GLenum destinationFormat,
GLenum sourceFormat,
......@@ -239,7 +244,8 @@ class Blit11 : angle::NonCopyable
ShaderDimension dimension);
static SwizzleShaderType GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality);
gl::Error copyDepthStencilImpl(const TextureHelper11 &source,
gl::Error copyDepthStencilImpl(const gl::Context *context,
const TextureHelper11 &source,
unsigned int sourceSubresource,
const gl::Box &sourceArea,
const gl::Extents &sourceSize,
......@@ -250,7 +256,8 @@ class Blit11 : angle::NonCopyable
const gl::Rectangle *scissor,
bool stencilOnly);
gl::Error copyAndConvertImpl(const TextureHelper11 &source,
gl::Error copyAndConvertImpl(const gl::Context *context,
const TextureHelper11 &source,
unsigned int sourceSubresource,
const gl::Box &sourceArea,
const gl::Extents &sourceSize,
......@@ -265,7 +272,8 @@ class Blit11 : angle::NonCopyable
size_t destPixelStride,
BlitConvertFunction *convertFunction);
gl::Error copyAndConvert(const TextureHelper11 &source,
gl::Error copyAndConvert(const gl::Context *context,
const TextureHelper11 &source,
unsigned int sourceSubresource,
const gl::Box &sourceArea,
const gl::Extents &sourceSize,
......@@ -281,12 +289,14 @@ class Blit11 : angle::NonCopyable
size_t destPixelStride,
BlitConvertFunction *convertFunction);
gl::Error addBlitShaderToMap(BlitShaderType blitShaderType,
gl::Error addBlitShaderToMap(const gl::Context *context,
BlitShaderType blitShaderType,
ShaderDimension dimension,
const ShaderData &shaderData,
const char *name);
gl::Error getBlitShader(GLenum destFormat,
gl::Error getBlitShader(const gl::Context *context,
GLenum destFormat,
GLenum sourceFormat,
bool isSigned,
bool unpackPremultiplyAlpha,
......@@ -294,19 +304,23 @@ class Blit11 : angle::NonCopyable
GLenum destTypeForDownsampling,
ShaderDimension dimension,
const Shader **shaderOut);
gl::Error getSwizzleShader(GLenum type,
gl::Error getSwizzleShader(const gl::Context *context,
GLenum type,
D3D11_SRV_DIMENSION viewDimension,
const Shader **shaderOut);
gl::Error addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType,
gl::Error addSwizzleShaderToMap(const gl::Context *context,
SwizzleShaderType swizzleShaderType,
ShaderDimension dimension,
const ShaderData &shaderData,
const char *name);
void clearShaderMap();
void releaseResolveDepthStencilResources();
gl::Error initResolveDepthOnly(const d3d11::Format &format, const gl::Extents &extents);
gl::Error initResolveDepthStencil(const gl::Extents &extents);
gl::Error initResolveDepthOnly(const gl::Context *context,
const d3d11::Format &format,
const gl::Extents &extents);
gl::Error initResolveDepthStencil(const gl::Context *context, const gl::Extents &extents);
Renderer11 *mRenderer;
......
......@@ -2217,10 +2217,9 @@ gl::Error Renderer11::copyImageInternal(const gl::Context *context,
if (sourceRenderTarget->getTexture().is2D() && sourceRenderTarget->isMultisampled())
{
TextureHelper11 tex;
ANGLE_TRY_RESULT(
resolveMultisampledTexture(context, sourceRenderTarget, colorAttachment->getDepthSize(),
colorAttachment->getStencilSize()),
tex);
ANGLE_TRY(resolveMultisampledTexture(context, sourceRenderTarget,
colorAttachment->getDepthSize(),
colorAttachment->getStencilSize(), &tex));
D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc;
viewDesc.Format = sourceRenderTarget->getFormatSet().srvFormat;
......@@ -3201,9 +3200,8 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Context *context,
if (readRenderTarget->isMultisampled())
{
ANGLE_TRY_RESULT(
resolveMultisampledTexture(context, readRenderTarget11, depthBlit, stencilBlit),
readTexture);
ANGLE_TRY(resolveMultisampledTexture(context, readRenderTarget11, depthBlit, stencilBlit,
&readTexture));
if (!stencilBlit)
{
......@@ -3406,9 +3404,9 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Context *context,
if (depthBlit && stencilBlit)
{
ANGLE_TRY(mBlit->copyDepthStencil(readTexture, readSubresource, readArea, readSize,
drawTexture, drawSubresource, drawArea, drawSize,
scissor));
ANGLE_TRY(mBlit->copyDepthStencil(context, readTexture, readSubresource, readArea,
readSize, drawTexture, drawSubresource, drawArea,
drawSize, scissor));
}
else if (depthBlit)
{
......@@ -3491,20 +3489,20 @@ void Renderer11::onBufferDelete(const Buffer11 *deleted)
mAliveBuffers.erase(deleted);
}
gl::ErrorOrResult<TextureHelper11> Renderer11::resolveMultisampledTexture(
const gl::Context *context,
RenderTarget11 *renderTarget,
bool depth,
bool stencil)
gl::Error Renderer11::resolveMultisampledTexture(const gl::Context *context,
RenderTarget11 *renderTarget,
bool depth,
bool stencil,
TextureHelper11 *textureOut)
{
if (depth && !stencil)
{
return mBlit->resolveDepth(context, renderTarget);
return mBlit->resolveDepth(context, renderTarget, textureOut);
}
if (stencil)
{
return mBlit->resolveStencil(context, renderTarget, depth);
return mBlit->resolveStencil(context, renderTarget, depth, textureOut);
}
const auto &formatSet = renderTarget->getFormatSet();
......@@ -3539,7 +3537,8 @@ gl::ErrorOrResult<TextureHelper11> Renderer11::resolveMultisampledTexture(
mDeviceContext->ResolveSubresource(mCachedResolveTexture.get(), 0,
renderTarget->getTexture().get(),
renderTarget->getSubresourceIndex(), formatSet.texFormat);
return mCachedResolveTexture;
*textureOut = mCachedResolveTexture;
return gl::NoError();
}
bool Renderer11::getLUID(LUID *adapterLuid) const
......
......@@ -477,10 +477,11 @@ class Renderer11 : public RendererD3D
int baseVertex,
int instances);
gl::ErrorOrResult<TextureHelper11> resolveMultisampledTexture(const gl::Context *context,
RenderTarget11 *renderTarget,
bool depth,
bool stencil);
gl::Error resolveMultisampledTexture(const gl::Context *context,
RenderTarget11 *renderTarget,
bool depth,
bool stencil,
TextureHelper11 *textureOut);
void populateRenderer11DeviceCaps();
......
......@@ -544,7 +544,7 @@ gl::Error TextureStorage11::updateSubresourceLevel(const gl::Context *context,
{
// CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
Blit11 *blitter = mRenderer->getBlitter();
return blitter->copyDepthStencil(srcTexture, sourceSubresource, copyArea, texSize,
return blitter->copyDepthStencil(context, srcTexture, sourceSubresource, copyArea, texSize,
*dstTexture, dstSubresource, copyArea, texSize, nullptr);
}
......@@ -2424,8 +2424,8 @@ gl::Error TextureStorage11::initDropStencilTexture(const gl::Context *context,
gl::Extents wholeSize(wholeArea.width, wholeArea.height, 1);
UINT subresource = getSubresourceIndex(index);
ANGLE_TRY(mRenderer->getBlitter()->copyDepthStencil(
*sourceTexture, subresource, wholeArea, wholeSize, mDropStencilTexture, subresource,
wholeArea, wholeSize, nullptr));
context, *sourceTexture, subresource, wholeArea, wholeSize, mDropStencilTexture,
subresource, wholeArea, wholeSize, nullptr));
}
return gl::NoError();
......
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