Commit b70ad524 by Luc Ferron Committed by Commit Bot

Vulkan: Fix all depth/stencil related failures due to Y flip

- Fixes all deqp functional_fragment_ops_depth_stencil_* with Y flipping enabled. Bug: angleproject:2673 Change-Id: I94a4225dec8adf9113309e8b8b2c8aa61f6a2bb9 Reviewed-on: https://chromium-review.googlesource.com/1129857 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 30b84854
......@@ -525,13 +525,11 @@ gl::Error ContextVk::syncState(const gl::Context *context, const gl::State::Dirt
break;
case gl::State::DIRTY_BIT_CULL_FACE_ENABLED:
case gl::State::DIRTY_BIT_CULL_FACE:
{
mPipelineDesc->updateCullMode(glState.getRasterizerState(),
isViewportFlipEnabledForDrawFBO());
mPipelineDesc->updateCullMode(glState.getRasterizerState());
break;
}
case gl::State::DIRTY_BIT_FRONT_FACE:
mPipelineDesc->updateFrontFace(glState.getRasterizerState());
mPipelineDesc->updateFrontFace(glState.getRasterizerState(),
isViewportFlipEnabledForDrawFBO());
break;
case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED:
WARN() << "DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED unimplemented";
......@@ -595,8 +593,7 @@ gl::Error ContextVk::syncState(const gl::Context *context, const gl::State::Dirt
glState.getNearPlane(), glState.getFarPlane(),
isViewportFlipEnabledForDrawFBO());
updateColorMask(glState.getBlendState());
mPipelineDesc->updateCullMode(glState.getRasterizerState(),
isViewportFlipEnabledForDrawFBO());
mPipelineDesc->updateCullMode(glState.getRasterizerState());
updateScissor(glState);
break;
}
......
......@@ -922,6 +922,7 @@ gl::Error FramebufferVk::clearWithDraw(const gl::Context *context,
ANGLE_TRY(getCommandBufferForDraw(contextVk, &drawCommands, &recordingMode));
const gl::Rectangle &renderArea = getRenderPassRenderArea();
bool invertViewport = contextVk->isViewportFlipEnabledForDrawFBO();
// This pipeline desc could be cached.
vk::PipelineDesc pipelineDesc;
......@@ -929,8 +930,6 @@ gl::Error FramebufferVk::clearWithDraw(const gl::Context *context,
pipelineDesc.updateColorWriteMask(colorMaskFlags, getEmulatedAlphaAttachmentMask());
pipelineDesc.updateRenderPassDesc(getRenderPassDesc());
pipelineDesc.updateShaders(fullScreenQuad->queueSerial(), pushConstantColor->queueSerial());
bool invertViewport = contextVk->isViewportFlipEnabledForDrawFBO();
pipelineDesc.updateViewport(this, renderArea, 0.0f, 1.0f, invertViewport);
const gl::State &glState = contextVk->getGLState();
......
......@@ -679,16 +679,15 @@ void PipelineDesc::updateTopology(gl::PrimitiveMode drawMode)
mInputAssemblyInfo.topology = static_cast<uint32_t>(gl_vk::GetPrimitiveTopology(drawMode));
}
void PipelineDesc::updateCullMode(const gl::RasterizerState &rasterState, bool invertCullMode)
void PipelineDesc::updateCullMode(const gl::RasterizerState &rasterState)
{
mRasterizationStateInfo.cullMode =
static_cast<uint16_t>(gl_vk::GetCullMode(rasterState, invertCullMode));
mRasterizationStateInfo.cullMode = static_cast<uint16_t>(gl_vk::GetCullMode(rasterState));
}
void PipelineDesc::updateFrontFace(const gl::RasterizerState &rasterState)
void PipelineDesc::updateFrontFace(const gl::RasterizerState &rasterState, bool invertFrontFace)
{
mRasterizationStateInfo.frontFace =
static_cast<uint16_t>(gl_vk::GetFrontFace(rasterState.frontFace));
static_cast<uint16_t>(gl_vk::GetFrontFace(rasterState.frontFace, invertFrontFace));
}
void PipelineDesc::updateLineWidth(float lineWidth)
......
......@@ -369,8 +369,8 @@ class PipelineDesc final
void updateTopology(gl::PrimitiveMode drawMode);
// Raster states
void updateCullMode(const gl::RasterizerState &rasterState, bool invertCullMode);
void updateFrontFace(const gl::RasterizerState &rasterState);
void updateCullMode(const gl::RasterizerState &rasterState);
void updateFrontFace(const gl::RasterizerState &rasterState, bool invertFrontFace);
void updateLineWidth(float lineWidth);
// RenderPass description.
......
......@@ -1309,7 +1309,7 @@ VkPrimitiveTopology GetPrimitiveTopology(gl::PrimitiveMode mode)
}
}
VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState, bool invertCullMode)
VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState)
{
if (!rasterState.cullFace)
{
......@@ -1319,9 +1319,9 @@ VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState, bool invertC
switch (rasterState.cullMode)
{
case gl::CullFaceMode::Front:
return invertCullMode ? VK_CULL_MODE_BACK_BIT : VK_CULL_MODE_FRONT_BIT;
return VK_CULL_MODE_FRONT_BIT;
case gl::CullFaceMode::Back:
return invertCullMode ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT;
return VK_CULL_MODE_BACK_BIT;
case gl::CullFaceMode::FrontAndBack:
return VK_CULL_MODE_FRONT_AND_BACK;
default:
......@@ -1330,15 +1330,15 @@ VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState, bool invertC
}
}
VkFrontFace GetFrontFace(GLenum frontFace)
VkFrontFace GetFrontFace(GLenum frontFace, bool invertCullFace)
{
// Invert CW and CCW to have the same behavior as OpenGL.
switch (frontFace)
{
case GL_CW:
return VK_FRONT_FACE_COUNTER_CLOCKWISE;
return invertCullFace ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE;
case GL_CCW:
return VK_FRONT_FACE_CLOCKWISE;
return invertCullFace ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE;
default:
UNREACHABLE();
return VK_FRONT_FACE_CLOCKWISE;
......
......@@ -731,8 +731,8 @@ VkFilter GetFilter(const GLenum filter);
VkSamplerMipmapMode GetSamplerMipmapMode(const GLenum filter);
VkSamplerAddressMode GetSamplerAddressMode(const GLenum wrap);
VkPrimitiveTopology GetPrimitiveTopology(gl::PrimitiveMode mode);
VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState, bool invertCullMode);
VkFrontFace GetFrontFace(GLenum frontFace);
VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState);
VkFrontFace GetFrontFace(GLenum frontFace, bool invertCullFace);
VkSampleCountFlagBits GetSamples(GLint sampleCount);
VkComponentSwizzle GetSwizzle(const GLenum swizzle);
VkIndexType GetIndexType(GLenum elementType);
......
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