summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/vulkan/hellovulkancubes/renderer.cpp2
-rw-r--r--examples/vulkan/hellovulkantexture/hellovulkantexture.cpp2
-rw-r--r--examples/vulkan/shared/trianglerenderer.cpp4
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp14
4 files changed, 9 insertions, 13 deletions
diff --git a/examples/vulkan/hellovulkancubes/renderer.cpp b/examples/vulkan/hellovulkancubes/renderer.cpp
index 2e913bcae8..5ada79ce79 100644
--- a/examples/vulkan/hellovulkancubes/renderer.cpp
+++ b/examples/vulkan/hellovulkancubes/renderer.cpp
@@ -53,7 +53,7 @@
#include <QtConcurrentRun>
#include <QTime>
-static float quadVert[] = {
+static float quadVert[] = { // Y up, front = CW
-1, -1, 0,
-1, 1, 0,
1, -1, 0,
diff --git a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
index ffe1a31442..67ae0ca5dc 100644
--- a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
+++ b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
@@ -59,7 +59,7 @@
// Vulkan Y is negated in clip space and the near/far plane is at 0/1 instead
// of -1/1. These will be corrected for by an extra transformation when
// calculating the modelview-projection matrix.
-static float vertexData[] = {
+static float vertexData[] = { // Y up, front = CW
// x, y, z, u, v
-1, -1, 0, 0, 1,
-1, 1, 0, 0, 0,
diff --git a/examples/vulkan/shared/trianglerenderer.cpp b/examples/vulkan/shared/trianglerenderer.cpp
index 6ed7e65ff9..b48f564003 100644
--- a/examples/vulkan/shared/trianglerenderer.cpp
+++ b/examples/vulkan/shared/trianglerenderer.cpp
@@ -56,7 +56,7 @@
// Vulkan Y is negated in clip space and the near/far plane is at 0/1 instead
// of -1/1. These will be corrected for by an extra transformation when
// calculating the modelview-projection matrix.
-static float vertexData[] = {
+static float vertexData[] = { // Y up, front = CCW
0.0f, 0.5f, 1.0f, 0.0f, 0.0f,
-0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
0.5f, -0.5f, 0.0f, 0.0f, 1.0f
@@ -337,7 +337,7 @@ void TriangleRenderer::initResources()
rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rs.polygonMode = VK_POLYGON_MODE_FILL;
rs.cullMode = VK_CULL_MODE_NONE; // we want the back face as well
- rs.frontFace = VK_FRONT_FACE_CLOCKWISE;
+ rs.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rs.lineWidth = 1.0f;
pipelineInfo.pRasterizationState = &rs;
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index 7dea743ea8..e45a16170e 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -2694,15 +2694,11 @@ QImage QVulkanWindow::grab()
system differences between OpenGL and Vulkan.
By pre-multiplying the projection matrix with this matrix, applications can
- continue to assume OpenGL-style Y coordinates in clip space (i.e. Y pointing
- upwards), and can set minDepth and maxDepth to 0 and 1, respectively,
- without any further corrections to the vertex Z positions, while using the
- projection matrices retrieved from the QMatrix4x4 functions, such as
- QMatrix4x4::perspective(), as-is.
-
- \note With vertex data following the default OpenGL rules (that is, the
- front face being CCW), the correct winding order in the rasterization state
- after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}).
+ continue to assume that Y is pointing upwards, and can set minDepth and
+ maxDepth in the viewport to 0 and 1, respectively, without having to do any
+ further corrections to the vertex Z positions. Geometry from OpenGL
+ applications can then be used as-is, assuming a rasterization state matching
+ the OpenGL culling and front face settings.
*/
QMatrix4x4 QVulkanWindow::clipCorrectionMatrix()
{