Commit 682f9141 by Jamie Madill Committed by Commit Bot

Remove feedback loop support from back-end.

Front-end detection still in place and will be removed in a follow-up. Removes the Vulkan feature and the special clear handling. Bug: angleproject:4959 Change-Id: I5d44c3f7dbdb49d8aa0375f54b7148df09732ba2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2363208Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 9d8fd36d
...@@ -323,12 +323,6 @@ struct FeaturesVk : FeatureSetBase ...@@ -323,12 +323,6 @@ struct FeaturesVk : FeatureSetBase
"enable_precision_qualifiers", FeatureCategory::VulkanFeatures, "enable_precision_qualifiers", FeatureCategory::VulkanFeatures,
"Enable precision qualifiers in shaders", &members, "http://anglebug.com/3078"}; "Enable precision qualifiers in shaders", &members, "http://anglebug.com/3078"};
// Support Depth/Stencil rendering feedback loops by masking out the depth/stencil buffer.
// Manhattan uses this feature in a few draw calls.
Feature supportDepthStencilRenderingFeedbackLoops = {
"support_depth_stencil_rendering_feedback_loops", FeatureCategory::VulkanFeatures,
"Suport depth/stencil rendering feedback loops", &members, "http://anglebug.com/4490"};
// Desktop (at least NVIDIA) drivers prefer combining barriers into one vkCmdPipelineBarrier // Desktop (at least NVIDIA) drivers prefer combining barriers into one vkCmdPipelineBarrier
// call over issuing multiple barrier calls with fine grained dependency information to have // call over issuing multiple barrier calls with fine grained dependency information to have
// better performance. http://anglebug.com/4633 // better performance. http://anglebug.com/4633
......
...@@ -43,7 +43,7 @@ class RenderTargetCache final : angle::NonCopyable ...@@ -43,7 +43,7 @@ class RenderTargetCache final : angle::NonCopyable
using RenderTargetArray = gl::AttachmentArray<RenderTargetT *>; using RenderTargetArray = gl::AttachmentArray<RenderTargetT *>;
const RenderTargetArray &getColors() const; const RenderTargetArray &getColors() const;
RenderTargetT *getDepthStencil(bool allowFeedbackLoop) const; RenderTargetT *getDepthStencil() const;
RenderTargetT *getColorDraw(const gl::FramebufferState &state, size_t colorIndex) const; RenderTargetT *getColorDraw(const gl::FramebufferState &state, size_t colorIndex) const;
RenderTargetT *getColorRead(const gl::FramebufferState &state) const; RenderTargetT *getColorRead(const gl::FramebufferState &state) const;
...@@ -56,7 +56,6 @@ class RenderTargetCache final : angle::NonCopyable ...@@ -56,7 +56,6 @@ class RenderTargetCache final : angle::NonCopyable
RenderTargetT *mReadRenderTarget = nullptr; RenderTargetT *mReadRenderTarget = nullptr;
gl::AttachmentArray<RenderTargetT *> mColorRenderTargets = {}; gl::AttachmentArray<RenderTargetT *> mColorRenderTargets = {};
// We only support a single Depth/Stencil RenderTarget currently. // We only support a single Depth/Stencil RenderTarget currently.
bool mDepthStencilFeedbackLoop = false;
RenderTargetT *mDepthStencilRenderTarget = nullptr; RenderTargetT *mDepthStencilRenderTarget = nullptr;
}; };
...@@ -112,9 +111,9 @@ const gl::AttachmentArray<RenderTargetT *> &RenderTargetCache<RenderTargetT>::ge ...@@ -112,9 +111,9 @@ const gl::AttachmentArray<RenderTargetT *> &RenderTargetCache<RenderTargetT>::ge
} }
template <typename RenderTargetT> template <typename RenderTargetT>
RenderTargetT *RenderTargetCache<RenderTargetT>::getDepthStencil(bool allowFeedbackLoop) const RenderTargetT *RenderTargetCache<RenderTargetT>::getDepthStencil() const
{ {
return (allowFeedbackLoop || !mDepthStencilFeedbackLoop) ? mDepthStencilRenderTarget : nullptr; return mDepthStencilRenderTarget;
} }
template <typename RenderTargetT> template <typename RenderTargetT>
...@@ -147,7 +146,6 @@ angle::Result RenderTargetCache<RenderTargetT>::updateDepthStencilRenderTarget( ...@@ -147,7 +146,6 @@ angle::Result RenderTargetCache<RenderTargetT>::updateDepthStencilRenderTarget(
const gl::Context *context, const gl::Context *context,
const gl::FramebufferState &state) const gl::FramebufferState &state)
{ {
mDepthStencilFeedbackLoop = state.hasDepthStencilFeedbackLoop();
return updateCachedRenderTarget(context, state.getDepthOrStencilAttachment(), return updateCachedRenderTarget(context, state.getDepthOrStencilAttachment(),
&mDepthStencilRenderTarget); &mDepthStencilRenderTarget);
} }
......
...@@ -432,7 +432,7 @@ RenderTarget11 *Framebuffer11::getFirstRenderTarget() const ...@@ -432,7 +432,7 @@ RenderTarget11 *Framebuffer11::getFirstRenderTarget() const
} }
} }
return mRenderTargetCache.getDepthStencil(true); return mRenderTargetCache.getDepthStencil();
} }
} // namespace rx } // namespace rx
...@@ -49,7 +49,7 @@ class Framebuffer11 : public FramebufferD3D ...@@ -49,7 +49,7 @@ class Framebuffer11 : public FramebufferD3D
} }
const RenderTarget11 *getCachedDepthStencilRenderTarget() const const RenderTarget11 *getCachedDepthStencilRenderTarget() const
{ {
return mRenderTargetCache.getDepthStencil(true); return mRenderTargetCache.getDepthStencil();
} }
RenderTarget11 *getFirstRenderTarget() const; RenderTarget11 *getFirstRenderTarget() const;
......
...@@ -61,7 +61,7 @@ angle::Result Framebuffer9::clearImpl(const gl::Context *context, ...@@ -61,7 +61,7 @@ angle::Result Framebuffer9::clearImpl(const gl::Context *context,
const ClearParameters &clearParams) const ClearParameters &clearParams)
{ {
ANGLE_TRY(mRenderer->applyRenderTarget(context, mRenderTargetCache.getColors()[0], ANGLE_TRY(mRenderer->applyRenderTarget(context, mRenderTargetCache.getColors()[0],
mRenderTargetCache.getDepthStencil(true))); mRenderTargetCache.getDepthStencil()));
const gl::State &glState = context->getState(); const gl::State &glState = context->getState();
float nearZ = glState.getNearPlane(); float nearZ = glState.getNearPlane();
...@@ -72,7 +72,7 @@ angle::Result Framebuffer9::clearImpl(const gl::Context *context, ...@@ -72,7 +72,7 @@ angle::Result Framebuffer9::clearImpl(const gl::Context *context,
mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled()); mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
mRenderer->clear(clearParams, mRenderTargetCache.getColors()[0], mRenderer->clear(clearParams, mRenderTargetCache.getColors()[0],
mRenderTargetCache.getDepthStencil(true)); mRenderTargetCache.getDepthStencil());
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -50,7 +50,7 @@ class Framebuffer9 : public FramebufferD3D ...@@ -50,7 +50,7 @@ class Framebuffer9 : public FramebufferD3D
const RenderTarget9 *getCachedDepthStencilRenderTarget() const const RenderTarget9 *getCachedDepthStencilRenderTarget() const
{ {
return mRenderTargetCache.getDepthStencil(true); return mRenderTargetCache.getDepthStencil();
} }
const gl::InternalFormat &getImplementationColorReadFormat( const gl::InternalFormat &getImplementationColorReadFormat(
......
...@@ -282,9 +282,7 @@ FramebufferVk::FramebufferVk(RendererVk *renderer, ...@@ -282,9 +282,7 @@ FramebufferVk::FramebufferVk(RendererVk *renderer,
: FramebufferImpl(state), : FramebufferImpl(state),
mBackbuffer(backbuffer), mBackbuffer(backbuffer),
mFramebuffer(nullptr), mFramebuffer(nullptr),
mActiveColorComponents(0), mActiveColorComponents(0)
mSupportDepthStencilFeedbackLoops(
renderer->getFeatures().supportDepthStencilRenderingFeedbackLoops.enabled)
{ {
mReadPixelBuffer.init(renderer, VK_BUFFER_USAGE_TRANSFER_DST_BIT, kReadPixelsBufferAlignment, mReadPixelBuffer.init(renderer, VK_BUFFER_USAGE_TRANSFER_DST_BIT, kReadPixelsBufferAlignment,
kMinReadPixelsBufferSize, true); kMinReadPixelsBufferSize, true);
...@@ -422,33 +420,6 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -422,33 +420,6 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
bool scissoredClear = scissoredRenderArea != getRotatedCompleteRenderArea(contextVk); bool scissoredClear = scissoredRenderArea != getRotatedCompleteRenderArea(contextVk);
// Special case for rendering feedback loops: clears are always valid in GL since they don't
// sample from any textures.
if ((clearDepth || clearStencil) && mState.hasDepthStencilFeedbackLoop())
{
// We currently don't handle scissored clears with rendering feedback loops.
ANGLE_VK_CHECK(contextVk, !scissoredClear, VK_ERROR_INCOMPATIBLE_DRIVER);
RenderTargetVk *depthStencilRT = mRenderTargetCache.getDepthStencil(true);
vk::ImageHelper *image = &depthStencilRT->getImageForWrite();
ANGLE_TRY(contextVk->onImageTransferWrite(image->getAspectFlags(), image));
vk::CommandBuffer &commandBuffer = contextVk->getOutsideRenderPassCommandBuffer();
VkImageSubresourceRange range;
range.aspectMask = image->getAspectFlags();
range.baseMipLevel = depthStencilRT->getLevelIndex();
range.levelCount = 1;
range.baseArrayLayer = depthStencilRT->getLayerIndex();
range.layerCount = 1;
commandBuffer.clearDepthStencilImage(image->getImage(),
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
clearDepthStencilValue, 1, &range);
clearDepth = false;
clearStencil = false;
}
// If there is nothing to clear, return right away (for example, if asked to clear depth, but // If there is nothing to clear, return right away (for example, if asked to clear depth, but
// there is no depth attachment). // there is no depth attachment).
if (!clearColor && !clearDepth && !clearStencil) if (!clearColor && !clearDepth && !clearStencil)
...@@ -720,9 +691,7 @@ angle::Result FramebufferVk::readPixels(const gl::Context *context, ...@@ -720,9 +691,7 @@ angle::Result FramebufferVk::readPixels(const gl::Context *context,
RenderTargetVk *FramebufferVk::getDepthStencilRenderTarget() const RenderTargetVk *FramebufferVk::getDepthStencilRenderTarget() const
{ {
// If we mask out depth/stencil feedback loops, do not allow the user to access the looped DS return mRenderTargetCache.getDepthStencil();
// render target. Passing "false" to getDepthStencil forces a return of "nullptr" for loops.
return mRenderTargetCache.getDepthStencil(!mSupportDepthStencilFeedbackLoops);
} }
RenderTargetVk *FramebufferVk::getColorDrawRenderTarget(size_t colorIndex) const RenderTargetVk *FramebufferVk::getColorDrawRenderTarget(size_t colorIndex) const
...@@ -1144,7 +1113,7 @@ angle::Result FramebufferVk::blit(const gl::Context *context, ...@@ -1144,7 +1113,7 @@ angle::Result FramebufferVk::blit(const gl::Context *context,
if (blitDepthBuffer || blitStencilBuffer) if (blitDepthBuffer || blitStencilBuffer)
{ {
RenderTargetVk *readRenderTarget = srcFramebufferVk->getDepthStencilRenderTarget(); RenderTargetVk *readRenderTarget = srcFramebufferVk->getDepthStencilRenderTarget();
RenderTargetVk *drawRenderTarget = mRenderTargetCache.getDepthStencil(true); RenderTargetVk *drawRenderTarget = mRenderTargetCache.getDepthStencil();
UtilsVk::BlitResolveParameters params = commonParams; UtilsVk::BlitResolveParameters params = commonParams;
params.srcLayer = readRenderTarget->getLayerIndex(); params.srcLayer = readRenderTarget->getLayerIndex();
...@@ -1446,7 +1415,7 @@ angle::Result FramebufferVk::invalidateImpl(ContextVk *contextVk, ...@@ -1446,7 +1415,7 @@ angle::Result FramebufferVk::invalidateImpl(ContextVk *contextVk,
ANGLE_TRY(flushDeferredClears(contextVk, getRotatedCompleteRenderArea(contextVk))); ANGLE_TRY(flushDeferredClears(contextVk, getRotatedCompleteRenderArea(contextVk)));
const auto &colorRenderTargets = mRenderTargetCache.getColors(); const auto &colorRenderTargets = mRenderTargetCache.getColors();
RenderTargetVk *depthStencilRenderTarget = mRenderTargetCache.getDepthStencil(true); RenderTargetVk *depthStencilRenderTarget = mRenderTargetCache.getDepthStencil();
// To ensure we invalidate the right renderpass we require that the current framebuffer be the // To ensure we invalidate the right renderpass we require that the current framebuffer be the
// same as the current renderpass' framebuffer. E.g. prevent sequence like: // same as the current renderpass' framebuffer. E.g. prevent sequence like:
......
...@@ -255,7 +255,6 @@ class FramebufferVk : public FramebufferImpl ...@@ -255,7 +255,6 @@ class FramebufferVk : public FramebufferImpl
vk::FramebufferDesc mCurrentFramebufferDesc; vk::FramebufferDesc mCurrentFramebufferDesc;
std::unordered_map<vk::FramebufferDesc, vk::FramebufferHelper> mFramebufferCache; std::unordered_map<vk::FramebufferDesc, vk::FramebufferHelper> mFramebufferCache;
bool mSupportDepthStencilFeedbackLoops;
vk::ClearValuesArray mDeferredClears; vk::ClearValuesArray mDeferredClears;
}; };
......
...@@ -1822,8 +1822,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev ...@@ -1822,8 +1822,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev
// Currently disabled by default: http://anglebug.com/3078 // Currently disabled by default: http://anglebug.com/3078
ANGLE_FEATURE_CONDITION(&mFeatures, enablePrecisionQualifiers, false); ANGLE_FEATURE_CONDITION(&mFeatures, enablePrecisionQualifiers, false);
ANGLE_FEATURE_CONDITION(&mFeatures, supportDepthStencilRenderingFeedbackLoops, false);
ANGLE_FEATURE_CONDITION(&mFeatures, preferAggregateBarrierCalls, isNvidia || isAMD || isIntel); ANGLE_FEATURE_CONDITION(&mFeatures, preferAggregateBarrierCalls, isNvidia || isAMD || isIntel);
// Currently disabled by default: http://anglebug.com/4324 // Currently disabled by default: http://anglebug.com/4324
......
...@@ -1658,11 +1658,9 @@ TEST_P(FramebufferTest_ES3, AttachmentStateChange) ...@@ -1658,11 +1658,9 @@ TEST_P(FramebufferTest_ES3, AttachmentStateChange)
// The test emulates the read-only feedback loop in Manhattan. // The test emulates the read-only feedback loop in Manhattan.
TEST_P(FramebufferTest_ES3, ReadOnlyDepthFeedbackLoopSupported) TEST_P(FramebufferTest_ES3, ReadOnlyDepthFeedbackLoopSupported)
{ {
// Feedback loops not supported on D3D11 and may not ever be. // Feedback loops are only supported on Vulkan.
ANGLE_SKIP_TEST_IF(IsD3D11()); // TODO(jmadill): Make GL extension. http://anglebug.com/4969
ANGLE_SKIP_TEST_IF(!IsVulkan());
// Also this particular test doesn't work on Android despite similar support in Manhattan.
ANGLE_SKIP_TEST_IF(IsAndroid() && IsOpenGLES());
constexpr GLuint kSize = 2; constexpr GLuint kSize = 2;
glViewport(0, 0, kSize, kSize); glViewport(0, 0, kSize, kSize);
...@@ -1725,11 +1723,9 @@ void main() ...@@ -1725,11 +1723,9 @@ void main()
// Tests corner cases with read-only depth-stencil feedback loops. // Tests corner cases with read-only depth-stencil feedback loops.
TEST_P(FramebufferTest_ES3, ReadOnlyDepthFeedbackLoopStateChanges) TEST_P(FramebufferTest_ES3, ReadOnlyDepthFeedbackLoopStateChanges)
{ {
// Feedback loops not supported on D3D11 and may not ever be. // Feedback loops are only supported on Vulkan.
ANGLE_SKIP_TEST_IF(IsD3D11()); // TODO(jmadill): Make GL extension. http://anglebug.com/4969
ANGLE_SKIP_TEST_IF(!IsVulkan());
// Also this particular test doesn't work on Android despite similar support in Manhattan.
ANGLE_SKIP_TEST_IF(IsAndroid() && IsOpenGLES());
constexpr GLuint kSize = 2; constexpr GLuint kSize = 2;
glViewport(0, 0, kSize, kSize); glViewport(0, 0, kSize, kSize);
......
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