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