Commit 5bdf8bd1 by Luc Ferron Committed by Commit Bot

Vulkan: enable the rest of dEQP tests in fbo.render.*

Vulkan does not support separate depth and stencil attachments. Adding this check to checkStatus skips the relevant tests to that. There was also a bug in FramebufferVk::clear where we were not checking the number of bits for depth/stencil attachments before setting the aspects for clearing. Bug: angleproject:2597 Change-Id: Iabe9f77a51fc7aca08b8faf3cecc3df9f99a7f1e Reviewed-on: https://chromium-review.googlesource.com/1107847 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 05a449a7
...@@ -516,6 +516,14 @@ bool FramebufferState::attachmentsHaveSameDimensions() const ...@@ -516,6 +516,14 @@ bool FramebufferState::attachmentsHaveSameDimensions() const
return !hasMismatchedSize(mStencilAttachment); return !hasMismatchedSize(mStencilAttachment);
} }
bool FramebufferState::hasSeparateDepthAndStencilAttachments() const
{
// if we have both a depth and stencil buffer, they must refer to the same object
// since we only support packed_depth_stencil and not separate depth and stencil
return (getDepthAttachment() != nullptr && getStencilAttachment() != nullptr &&
getDepthStencilAttachment() == nullptr);
}
const FramebufferAttachment *FramebufferState::getDrawBuffer(size_t drawBufferIdx) const const FramebufferAttachment *FramebufferState::getDrawBuffer(size_t drawBufferIdx) const
{ {
ASSERT(drawBufferIdx < mDrawBufferStates.size()); ASSERT(drawBufferIdx < mDrawBufferStates.size());
......
...@@ -79,6 +79,7 @@ class FramebufferState final : angle::NonCopyable ...@@ -79,6 +79,7 @@ class FramebufferState final : angle::NonCopyable
} }
bool attachmentsHaveSameDimensions() const; bool attachmentsHaveSameDimensions() const;
bool hasSeparateDepthAndStencilAttachments() const;
bool colorAttachmentsAreUniqueImages() const; bool colorAttachmentsAreUniqueImages() const;
Box getDimensions() const; Box getDimensions() const;
......
...@@ -293,8 +293,7 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const ...@@ -293,8 +293,7 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const
{ {
// if we have both a depth and stencil buffer, they must refer to the same object // if we have both a depth and stencil buffer, they must refer to the same object
// since we only support packed_depth_stencil and not separate depth and stencil // since we only support packed_depth_stencil and not separate depth and stencil
if (mState.getDepthAttachment() != nullptr && mState.getStencilAttachment() != nullptr && if (mState.hasSeparateDepthAndStencilAttachments())
mState.getDepthStencilAttachment() == nullptr)
{ {
return false; return false;
} }
......
...@@ -176,11 +176,10 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -176,11 +176,10 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
const VkClearDepthStencilValue &clearDepthStencilValue = const VkClearDepthStencilValue &clearDepthStencilValue =
contextVk->getClearDepthStencilValue().depthStencil; contextVk->getClearDepthStencilValue().depthStencil;
const VkImageAspectFlags aspectFlags =
(depthAttachment ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) |
(stencilAttachment ? VK_IMAGE_ASPECT_STENCIL_BIT : 0);
RenderTargetVk *renderTarget = mRenderTargetCache.getDepthStencil(); RenderTargetVk *renderTarget = mRenderTargetCache.getDepthStencil();
const angle::Format &format = renderTarget->getImageFormat().textureFormat();
const VkImageAspectFlags aspectFlags = vk::GetDepthStencilAspectFlags(format);
vk::ImageHelper *image = renderTarget->getImageForWrite(currentSerial, this); vk::ImageHelper *image = renderTarget->getImageForWrite(currentSerial, this);
image->clearDepthStencil(aspectFlags, clearDepthStencilValue, commandBuffer); image->clearDepthStencil(aspectFlags, clearDepthStencilValue, commandBuffer);
} }
...@@ -342,6 +341,13 @@ gl::Error FramebufferVk::blit(const gl::Context *context, ...@@ -342,6 +341,13 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
bool FramebufferVk::checkStatus(const gl::Context *context) const bool FramebufferVk::checkStatus(const gl::Context *context) const
{ {
// if we have both a depth and stencil buffer, they must refer to the same object
// since we only support packed_depth_stencil and not separate depth and stencil
if (mState.hasSeparateDepthAndStencilAttachments())
{
return false;
}
return true; return true;
} }
......
...@@ -58,8 +58,7 @@ void RenderTargetVk::onDepthStencilDraw(vk::CommandGraphResource *framebufferVk, ...@@ -58,8 +58,7 @@ void RenderTargetVk::onDepthStencilDraw(vk::CommandGraphResource *framebufferVk,
// TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361 // TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361
const angle::Format &format = mImage->getFormat().textureFormat(); const angle::Format &format = mImage->getFormat().textureFormat();
VkImageAspectFlags aspectFlags = (format.depthBits > 0 ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) | VkImageAspectFlags aspectFlags = vk::GetDepthStencilAspectFlags(format);
(format.stencilBits > 0 ? VK_IMAGE_ASPECT_STENCIL_BIT : 0);
mImage->changeLayoutWithStages(aspectFlags, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, mImage->changeLayoutWithStages(aspectFlags, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
......
...@@ -425,10 +425,7 @@ vk::Error WindowSurfaceVk::initializeImpl(RendererVk *renderer) ...@@ -425,10 +425,7 @@ vk::Error WindowSurfaceVk::initializeImpl(RendererVk *renderer)
ANGLE_TRY(mDepthStencilImage.initMemory(device, renderer->getMemoryProperties(), ANGLE_TRY(mDepthStencilImage.initMemory(device, renderer->getMemoryProperties(),
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)); VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
const VkImageAspectFlags aspect = const VkImageAspectFlags aspect = vk::GetDepthStencilAspectFlags(dsFormat.textureFormat());
(dsFormat.textureFormat().depthBits > 0 ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) |
(dsFormat.textureFormat().stencilBits > 0 ? VK_IMAGE_ASPECT_STENCIL_BIT : 0);
VkClearDepthStencilValue depthStencilClearValue = {1.0f, 0}; VkClearDepthStencilValue depthStencilClearValue = {1.0f, 0};
// Set transfer dest layout, and clear the image. // Set transfer dest layout, and clear the image.
......
...@@ -262,6 +262,11 @@ bool GetAvailableValidationLayers(const std::vector<VkLayerProperties> &layerPro ...@@ -262,6 +262,11 @@ bool GetAvailableValidationLayers(const std::vector<VkLayerProperties> &layerPro
namespace vk namespace vk
{ {
VkImageAspectFlags GetDepthStencilAspectFlags(const angle::Format &format)
{
return (format.depthBits > 0 ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) |
(format.stencilBits > 0 ? VK_IMAGE_ASPECT_STENCIL_BIT : 0);
}
Error::Error(VkResult result) : mResult(result), mFile(nullptr), mLine(0) Error::Error(VkResult result) : mResult(result), mFile(nullptr), mLine(0)
{ {
......
...@@ -86,6 +86,8 @@ namespace vk ...@@ -86,6 +86,8 @@ namespace vk
{ {
struct Format; struct Format;
VkImageAspectFlags GetDepthStencilAspectFlags(const angle::Format &format);
template <typename T> template <typename T>
struct ImplTypeHelper; struct ImplTypeHelper;
......
...@@ -230,7 +230,6 @@ ...@@ -230,7 +230,6 @@
2494 VULKAN : dEQP-GLES2.functional.shaders.struct.uniform.sampler_* = SKIP 2494 VULKAN : dEQP-GLES2.functional.shaders.struct.uniform.sampler_* = SKIP
2592 VULKAN : dEQP-GLES2.functional.shaders.builtin_variable.depth_range* = SKIP 2592 VULKAN : dEQP-GLES2.functional.shaders.builtin_variable.depth_range* = SKIP
2595 VULKAN : dEQP-GLES2.functional.shaders.random.all_features.fragment* = SKIP 2595 VULKAN : dEQP-GLES2.functional.shaders.random.all_features.fragment* = SKIP
2597 VULKAN : dEQP-GLES2.functional.fbo.render.recreate_stencilbuffer.no_rebind_rbo_rgb* = SKIP
2161 VULKAN : dEQP-GLES2.functional.vertex_arrays.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.vertex_arrays.* = SKIP
2598 VULKAN : dEQP-GLES2.functional.rasterization.primitives.line* = SKIP 2598 VULKAN : dEQP-GLES2.functional.rasterization.primitives.line* = SKIP
2599 VULKAN : dEQP-GLES2.functional.rasterization.limits.points = SKIP 2599 VULKAN : dEQP-GLES2.functional.rasterization.limits.points = SKIP
......
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