Commit 463e02e6 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Constants for unpacked D/S attachment indices

kClearValueDepth/StencilIndex is renamed and repurposed in other places where depth and stencil are placed at indices MAX_DRAW_BUFFERS and MAX_DRAW_BUFFERS+1. Bug: angleproject:4836 Change-Id: Idaeff5017d944d786a5f388c4f1ce3a4e3fe9b7d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437505 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent fa082bb5
......@@ -1420,11 +1420,11 @@ angle::Result FramebufferVk::invalidateImpl(ContextVk *contextVk,
// Remove deferred clears for the invalidated attachments.
if (invalidateDepthBuffer)
{
mDeferredClears.reset(vk::kClearValueDepthIndex);
mDeferredClears.reset(vk::kUnpackedDepthIndex);
}
if (invalidateStencilBuffer)
{
mDeferredClears.reset(vk::kClearValueStencilIndex);
mDeferredClears.reset(vk::kUnpackedStencilIndex);
}
for (size_t colorIndexGL : mState.getEnabledDrawBuffers())
{
......@@ -1594,7 +1594,7 @@ angle::Result FramebufferVk::updateDepthStencilAttachment(const gl::Context *con
if (deferClears)
{
ANGLE_TRY(depthStencilRT->flushStagedUpdates(contextVk, &mDeferredClears,
vk::kClearValueDepthIndex));
vk::kUnpackedDepthIndex));
}
else
{
......@@ -1982,14 +1982,14 @@ angle::Result FramebufferVk::clearImmediatelyWithRenderPassOp(
{
VkClearValue clearValue;
clearValue.depthStencil = clearDepthStencilValue;
mDeferredClears.store(vk::kClearValueDepthIndex, VK_IMAGE_ASPECT_DEPTH_BIT, clearValue);
mDeferredClears.store(vk::kUnpackedDepthIndex, VK_IMAGE_ASPECT_DEPTH_BIT, clearValue);
}
if (clearStencil)
{
VkClearValue clearValue;
clearValue.depthStencil = clearDepthStencilValue;
mDeferredClears.store(vk::kClearValueStencilIndex, VK_IMAGE_ASPECT_STENCIL_BIT, clearValue);
mDeferredClears.store(vk::kUnpackedStencilIndex, VK_IMAGE_ASPECT_STENCIL_BIT, clearValue);
}
// Ensure the clear happens immediately.
......@@ -2010,7 +2010,7 @@ angle::Result FramebufferVk::clearWithDraw(ContextVk *contextVk,
{
VkClearValue clearValue;
clearValue.depthStencil = clearDepthStencilValue;
mDeferredClears.store(vk::kClearValueDepthIndex, VK_IMAGE_ASPECT_DEPTH_BIT, clearValue);
mDeferredClears.store(vk::kUnpackedDepthIndex, VK_IMAGE_ASPECT_DEPTH_BIT, clearValue);
// Scissored-only clears are handled in clearImmediatelyWithRenderPassOp.
ASSERT(clearColorBuffers.any() || clearStencil);
......@@ -2365,14 +2365,14 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
{
depthLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
clearValue.depthStencil.depth = mDeferredClears.getDepthValue();
mDeferredClears.reset(vk::kClearValueDepthIndex);
mDeferredClears.reset(vk::kUnpackedDepthIndex);
}
if (mDeferredClears.testStencil())
{
stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
clearValue.depthStencil.stencil = mDeferredClears.getStencilValue();
mDeferredClears.reset(vk::kClearValueStencilIndex);
mDeferredClears.reset(vk::kUnpackedStencilIndex);
}
// Note the aspect is only depth here. That's intentional.
......@@ -2474,11 +2474,11 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
vk::FramebufferNonResolveAttachmentMask unresolveMask(unresolveColorMask.bits());
if (unresolveDepth)
{
unresolveMask.set(gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
unresolveMask.set(vk::kUnpackedDepthIndex);
}
if (unresolveStencil)
{
unresolveMask.set(gl::IMPLEMENTATION_MAX_DRAW_BUFFERS + 1);
unresolveMask.set(vk::kUnpackedStencilIndex);
}
mCurrentFramebufferDesc.updateUnresolveMask(unresolveMask);
......
......@@ -1425,8 +1425,7 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
VkPipelineRasterizationStateCreateInfo rasterState = {};
VkPipelineMultisampleStateCreateInfo multisampleState = {};
VkPipelineDepthStencilStateCreateInfo depthStencilState = {};
std::array<VkPipelineColorBlendAttachmentState, gl::IMPLEMENTATION_MAX_DRAW_BUFFERS>
blendAttachmentState;
gl::DrawBuffersArray<VkPipelineColorBlendAttachmentState> blendAttachmentState;
VkPipelineColorBlendStateCreateInfo blendState = {};
VkSpecializationInfo specializationInfo = {};
VkGraphicsPipelineCreateInfo createInfo = {};
......
......@@ -739,10 +739,10 @@ void ClearValuesArray::store(uint32_t index,
if ((aspectFlags & VK_IMAGE_ASPECT_STENCIL_BIT) != 0)
{
// Ensure for packed DS we're writing to the depth index.
ASSERT(index == kClearValueDepthIndex ||
(index == kClearValueStencilIndex && aspectFlags == VK_IMAGE_ASPECT_STENCIL_BIT));
ASSERT(index == kUnpackedDepthIndex ||
(index == kUnpackedStencilIndex && aspectFlags == VK_IMAGE_ASPECT_STENCIL_BIT));
storeNoDepthStencil(kClearValueStencilIndex, clearValue);
storeNoDepthStencil(kUnpackedStencilIndex, clearValue);
}
if (aspectFlags != VK_IMAGE_ASPECT_STENCIL_BIT)
......
......@@ -679,8 +679,8 @@ using SpecializationConstantMap = angle::PackedEnumMap<sh::vk::SpecializationCon
void MakeDebugUtilsLabel(GLenum source, const char *marker, VkDebugUtilsLabelEXT *label);
constexpr size_t kClearValueDepthIndex = gl::IMPLEMENTATION_MAX_DRAW_BUFFERS;
constexpr size_t kClearValueStencilIndex = gl::IMPLEMENTATION_MAX_DRAW_BUFFERS + 1;
constexpr size_t kUnpackedDepthIndex = gl::IMPLEMENTATION_MAX_DRAW_BUFFERS;
constexpr size_t kUnpackedStencilIndex = gl::IMPLEMENTATION_MAX_DRAW_BUFFERS + 1;
class ClearValuesArray final
{
......@@ -701,16 +701,13 @@ class ClearValuesArray final
}
bool test(size_t index) const { return mEnabled.test(index); }
bool testDepth() const { return mEnabled.test(kClearValueDepthIndex); }
bool testStencil() const { return mEnabled.test(kClearValueStencilIndex); }
bool testDepth() const { return mEnabled.test(kUnpackedDepthIndex); }
bool testStencil() const { return mEnabled.test(kUnpackedStencilIndex); }
const VkClearValue &operator[](size_t index) const { return mValues[index]; }
float getDepthValue() const { return mValues[kClearValueDepthIndex].depthStencil.depth; }
uint32_t getStencilValue() const
{
return mValues[kClearValueStencilIndex].depthStencil.stencil;
}
float getDepthValue() const { return mValues[kUnpackedDepthIndex].depthStencil.depth; }
uint32_t getStencilValue() const { return mValues[kUnpackedStencilIndex].depthStencil.stencil; }
const VkClearValue *data() const { return mValues.data(); }
bool empty() const { return mEnabled.none(); }
......
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