From bb67e6e202def47488aae09d9f75745a762ed497 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Apr 2015 14:20:52 +0800 Subject: intel: support only VK_DEPTH_MODE_ZERO_TO_ONE Fail pipeline creation when VK_DEPTH_MODE_NEGATIVE_ONE_TO_ONE is specified. Update viewport transformation for depth range [0, 1]. Demos are updated too. --- demos/cube.c | 2 ++ demos/cube.vert | 1 + demos/tri.c | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index 796a1400..58a265f7 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -1362,6 +1362,7 @@ static VkShader demo_prepare_vs(struct demo *demo) "\n" " // GL->VK conventions\n" " gl_Position.y = -gl_Position.y;\n" + " gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;\n" "}\n"; return demo_prepare_shader(demo, VK_SHADER_STAGE_VERTEX, @@ -1424,6 +1425,7 @@ static void demo_prepare_pipeline(struct demo *demo) rs.fillMode = VK_FILL_MODE_SOLID; rs.cullMode = VK_CULL_MODE_BACK; rs.frontFace = VK_FRONT_FACE_CCW; + rs.depthClipEnable = VK_TRUE; memset(&cb, 0, sizeof(cb)); cb.sType = VK_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO; diff --git a/demos/cube.vert b/demos/cube.vert index 672bcced..091ff51b 100644 --- a/demos/cube.vert +++ b/demos/cube.vert @@ -18,4 +18,5 @@ void main() // GL->VK conventions gl_Position.y = -gl_Position.y; + gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0; } diff --git a/demos/tri.c b/demos/tri.c index 026f49d2..0a2a435b 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -775,8 +775,8 @@ static void demo_prepare_vertices(struct demo *demo) { const float vb[3][5] = { /* position texcoord */ - { -1.0f, -1.0f, -0.6f, 0.0f, 0.0f }, - { 1.0f, -1.0f, -0.5f, 1.0f, 0.0f }, + { -1.0f, -1.0f, 0.2f, 0.0f, 0.0f }, + { 1.0f, -1.0f, 0.25f, 1.0f, 0.0f }, { 0.0f, 1.0f, 1.0f, 0.5f, 1.0f }, }; const VkBufferCreateInfo buf_info = { @@ -993,6 +993,7 @@ static void demo_prepare_pipeline(struct demo *demo) rs.fillMode = VK_FILL_MODE_SOLID; rs.cullMode = VK_CULL_MODE_BACK; rs.frontFace = VK_FRONT_FACE_CW; + rs.depthClipEnable = VK_TRUE; memset(&cb, 0, sizeof(cb)); cb.sType = VK_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO; -- cgit v1.2.3