summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d11.cpp
diff options
context:
space:
mode:
authorBen Fletcher <ben.fletcher@me.com>2022-01-25 16:59:03 -0800
committerBen Fletcher <ben.fletcher@me.com>2022-01-31 08:52:05 -0800
commit1c3ae79ad36f77a044adb6264396e46575ee8757 (patch)
treeebcc8710d9a67ca8f426991cb1f7d2c17c92af7b /src/gui/rhi/qrhid3d11.cpp
parent1d28fd7a9c4720289f3d41db2ed8e6fcb07d5a30 (diff)
rhi: Add support for polygon fill mode
Support for Polygon Mode (Triangle Fill Mode in Metal, Fill Mode in D3D) in the RHI graphics pipeline. Options are Fill and Line Status: OpenGL - ok Vulkan - ok Metal - ok D3D11 - ok OpenGL ES - does not support glPolygonMode. Change-Id: I20b7ef416624700c3dc8d1cbe6474f4ca3889db8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r--src/gui/rhi/qrhid3d11.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index fc6fd59f4f..a4ad0d0c93 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -3783,6 +3783,19 @@ static inline D3D11_CULL_MODE toD3DCullMode(QRhiGraphicsPipeline::CullMode c)
}
}
+static inline D3D11_FILL_MODE toD3DFillMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::Fill:
+ return D3D11_FILL_SOLID;
+ case QRhiGraphicsPipeline::Line:
+ return D3D11_FILL_WIREFRAME;
+ default:
+ Q_UNREACHABLE();
+ return D3D11_FILL_SOLID;
+ }
+}
+
static inline D3D11_COMPARISON_FUNC toD3DCompareOp(QRhiGraphicsPipeline::CompareOp op)
{
switch (op) {
@@ -4072,7 +4085,7 @@ bool QD3D11GraphicsPipeline::create()
D3D11_RASTERIZER_DESC rastDesc;
memset(&rastDesc, 0, sizeof(rastDesc));
- rastDesc.FillMode = D3D11_FILL_SOLID;
+ rastDesc.FillMode = toD3DFillMode(m_polygonMode);
rastDesc.CullMode = toD3DCullMode(m_cullMode);
rastDesc.FrontCounterClockwise = m_frontFace == CCW;
rastDesc.DepthBias = m_depthBias;