summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/gen7_pipeline.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-07-18 14:15:49 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-07-20 10:59:44 -0700
commit0d77f08042b00cff81bebceb7877bc20f80c0965 (patch)
tree8484fbb470c8cd7622e1940521447ab699163596 /src/intel/vulkan/gen7_pipeline.c
parent6b6727026228bd1eab715034416194317e4d0fc6 (diff)
downloadexternal_mesa3d-0d77f08042b00cff81bebceb7877bc20f80c0965.zip
external_mesa3d-0d77f08042b00cff81bebceb7877bc20f80c0965.tar.gz
external_mesa3d-0d77f08042b00cff81bebceb7877bc20f80c0965.tar.bz2
anv: Fix near plane clipping on Gen7/7.5.
The Gen7/7.5 clip code used APIMODE_OGL, while the Gen8+ clip code used APIMODE_D3D. The meaning hasn't changed, so one of these must be wrong. It appears that the hardware documentation is completely wrong. It claims that the "API Mode" bit means: 0h APIMODE_OGL NEAR_VP boundary == 0.0 (NDC) 1h APIMODE_D3D NEAR_VP boundary == -1.0 (NDC) However, DirectX typically uses 0.0 for the near plane, while unextended OpenGL uses -1.0. i965's gen6_clip_state.c uses APIMODE_D3D for the GL_ZERO_TO_ONE case, so I believe the meanings are backwards from what the documentation says. Section 23.2 ("Primitive Clipping") of the Vulkan 1.0.21 specification contains the following equations: -w_c <= x_c <= w_c -w_c <= y_c <= w_c 0 <= z_c <= w_c This means that Vulkan follows D3D semantics. Cc: "12.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/intel/vulkan/gen7_pipeline.c')
-rw-r--r--src/intel/vulkan/gen7_pipeline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c
index 01c04f3..a50d9c7 100644
--- a/src/intel/vulkan/gen7_pipeline.c
+++ b/src/intel/vulkan/gen7_pipeline.c
@@ -124,7 +124,7 @@ genX(graphics_pipeline_create)(
clip.FrontWinding = vk_to_gen_front_face[rs_info->frontFace],
clip.CullMode = vk_to_gen_cullmode[rs_info->cullMode],
clip.ClipEnable = !(extra && extra->use_rectlist),
- clip.APIMode = APIMODE_OGL,
+ clip.APIMode = APIMODE_D3D,
clip.ViewportXYClipTestEnable = true,
clip.ViewportZClipTestEnable = !pipeline->depth_clamp_enable,
clip.ClipMode = CLIPMODE_NORMAL,