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