Commit 37a0dced by Mohan Maiya Committed by Commit Bot

Vulkan: Disable clip space transform based on EXT_clip_control

When depth is set to "ZERO_TO_ONE_EXT" using EXT_clip_control API, don't transform the z position in shader since it now matches Vulkan's depth range. Toggle transformPositionToVulkanClipSpace accordingly. Bug: angleproject:5471 Tests: dEQP-GLES2.functional.clip_control.depth_mode_zero_to_one Change-Id: I7e715cb3c98cecf5aaa5cdc3822a3a83bae9c720 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2615864 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent b1deba2f
......@@ -141,7 +141,7 @@ angle::Result ProgramInfo::initProgram(ContextVk *contextVk,
if (isLastPreFragmentStage)
{
options.preRotation = static_cast<SurfaceRotation>(optionBits.surfaceRotation);
options.transformPositionToVulkanClipSpace = true;
options.transformPositionToVulkanClipSpace = optionBits.enableDepthCorrection;
}
ANGLE_TRY(GlslangWrapperVk::TransformSpirV(contextVk, options, variableInfoMap,
......@@ -686,6 +686,7 @@ angle::Result ProgramExecutableVk::getGraphicsPipeline(
mTransformOptions.enableLineRasterEmulation = contextVk->isBresenhamEmulationEnabled(mode);
mTransformOptions.surfaceRotation = ToUnderlying(desc.getSurfaceRotation());
mTransformOptions.enableDepthCorrection = !glState.isClipControlDepthZeroToOne();
// This must be called after mTransformOptions have been set.
ProgramInfo &programInfo = getGraphicsProgramInfo(mTransformOptions);
......
......@@ -53,8 +53,9 @@ struct ProgramTransformOptions final
uint8_t enableLineRasterEmulation : 1;
uint8_t removeEarlyFragmentTestsOptimization : 1;
uint8_t surfaceRotation : 3;
uint8_t reserved : 3; // must initialize to zero
static constexpr uint32_t kPermutationCount = 0x1 << 5;
uint8_t enableDepthCorrection : 1;
uint8_t reserved : 2; // must initialize to zero
static constexpr uint32_t kPermutationCount = 0x1 << 6;
};
static_assert(sizeof(ProgramTransformOptions) == 1, "Size check failed");
static_assert(static_cast<int>(SurfaceRotation::EnumCount) <= 8, "Size check failed");
......
......@@ -866,6 +866,9 @@ void RendererVk::ensureCapsInitialized() const
// Enable GL_EXT_copy_image
mNativeExtensions.copyImageEXT = true;
// GL_EXT_clip_control
mNativeExtensions.clipControlEXT = true;
// Enable GL_EXT_texture_buffer and OES variant. Nearly all formats required for this extension
// are also required to have the UNIFORM_TEXEL_BUFFER feature bit in Vulkan, except for
// R32G32B32_SFLOAT/UINT/SINT which are optional. For many formats, the STORAGE_TEXEL_BUFFER
......
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