Commit 04371b08 authored by Laszlo Agocs's avatar Laszlo Agocs

Add back geometry stage and add feat.flag for geom/tess.

parent 8ed6c6c3
...@@ -331,6 +331,11 @@ QT_BEGIN_NAMESPACE ...@@ -331,6 +331,11 @@ QT_BEGIN_NAMESPACE
identically across backends, as long as this feature is reported as identically across backends, as long as this feature is reported as
supported, are \l{QRhiGraphicsPipeline::LineStrip}{LineStrip} and supported, are \l{QRhiGraphicsPipeline::LineStrip}{LineStrip} and
\l{QRhiGraphicsPipeline::TriangleStrip}{TriangleStrip}. \l{QRhiGraphicsPipeline::TriangleStrip}{TriangleStrip}.
\value GeometryShaders Indicates that geometry shaders are supported.
\value TessellationShaders Indicates that tessellation control and
evaluation shaders are supported.
*/ */
/*! /*!
...@@ -966,8 +971,10 @@ uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW ...@@ -966,8 +971,10 @@ uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
\inmodule QtRhi \inmodule QtRhi
\brief Specifies the type and the shader code for a shader stage in the graphics pipeline. \brief Specifies the type and the shader code for a shader stage in the graphics pipeline.
\note There is no geometry stage because some graphics APIs (Metal) have no support \note Some backends only support a subset of the stages. Use
for it. QRhi::isFeatureSupported() to query for support at runtime. For example,
Metal has no geometry shader support, while the OpenGL 2.x backend only
supports the vertex and fragment stages.
*/ */
/*! /*!
...@@ -976,6 +983,7 @@ uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW ...@@ -976,6 +983,7 @@ uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
\value Vertex Vertex stage \value Vertex Vertex stage
\value Fragment Fragment (pixel) stage \value Fragment Fragment (pixel) stage
\value Geometry Geometry stage
\value TessellationControl Tessellation control (hull) stage \value TessellationControl Tessellation control (hull) stage
\value TessellationEvaluation Tessellation evaluation (domain) stage \value TessellationEvaluation Tessellation evaluation (domain) stage
*/ */
...@@ -2105,6 +2113,7 @@ bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBind ...@@ -2105,6 +2113,7 @@ bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBind
\value VertexStage Vertex stage \value VertexStage Vertex stage
\value FragmentStage Fragment (pixel) stage \value FragmentStage Fragment (pixel) stage
\value GeometryStage Geometry stage
\value TessellationControlStage Tessellation control (hull) stage \value TessellationControlStage Tessellation control (hull) stage
\value TessellationEvaluationStage Tessellation evaluation (domain) stage \value TessellationEvaluationStage Tessellation evaluation (domain) stage
*/ */
......
...@@ -255,6 +255,7 @@ public: ...@@ -255,6 +255,7 @@ public:
enum Type { enum Type {
Vertex, Vertex,
Fragment, Fragment,
Geometry,
TessellationControl, TessellationControl,
TessellationEvaluation TessellationEvaluation
}; };
...@@ -296,8 +297,9 @@ public: ...@@ -296,8 +297,9 @@ public:
enum StageFlag { enum StageFlag {
VertexStage = 1 << 0, VertexStage = 1 << 0,
FragmentStage = 1 << 1, FragmentStage = 1 << 1,
TessellationControlStage = 1 << 2, GeometryStage = 1 << 2,
TessellationEvaluationStage = 1 << 3 TessellationControlStage = 1 << 3,
TessellationEvaluationStage = 1 << 4
}; };
Q_DECLARE_FLAGS(StageFlags, StageFlag) Q_DECLARE_FLAGS(StageFlags, StageFlag)
...@@ -1215,7 +1217,9 @@ public: ...@@ -1215,7 +1217,9 @@ public:
Timestamps, Timestamps,
Instancing, Instancing,
CustomInstanceStepRate, CustomInstanceStepRate,
PrimitiveRestart PrimitiveRestart,
GeometryShaders,
TessellationShaders
}; };
enum BeginFrameFlag { enum BeginFrameFlag {
......
...@@ -391,6 +391,10 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const ...@@ -391,6 +391,10 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
return true; return true;
case QRhi::PrimitiveRestart: case QRhi::PrimitiveRestart:
return true; return true;
case QRhi::GeometryShaders:
return false; // for now
case QRhi::TessellationShaders:
return false; // for now
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return false; return false;
......
...@@ -501,6 +501,10 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const ...@@ -501,6 +501,10 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
return false; return false;
case QRhi::PrimitiveRestart: case QRhi::PrimitiveRestart:
return false; // say no to madness return false; // say no to madness
case QRhi::GeometryShaders:
return false;
case QRhi::TessellationShaders:
return false;
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return false; return false;
......
...@@ -508,6 +508,10 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const ...@@ -508,6 +508,10 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
return true; return true;
case QRhi::PrimitiveRestart: case QRhi::PrimitiveRestart:
return true; return true;
case QRhi::GeometryShaders:
return false;
case QRhi::TessellationShaders:
return false; // for now
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return false; return false;
......
...@@ -3029,6 +3029,10 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const ...@@ -3029,6 +3029,10 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
return vertexAttribDivisorAvailable; return vertexAttribDivisorAvailable;
case QRhi::PrimitiveRestart: case QRhi::PrimitiveRestart:
return true; return true;
case QRhi::GeometryShaders:
return true;
case QRhi::TessellationShaders:
return true;
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return false; return false;
...@@ -3451,6 +3455,8 @@ static inline VkShaderStageFlagBits toVkShaderStage(QRhiGraphicsShaderStage::Typ ...@@ -3451,6 +3455,8 @@ static inline VkShaderStageFlagBits toVkShaderStage(QRhiGraphicsShaderStage::Typ
return VK_SHADER_STAGE_VERTEX_BIT; return VK_SHADER_STAGE_VERTEX_BIT;
case QRhiGraphicsShaderStage::Fragment: case QRhiGraphicsShaderStage::Fragment:
return VK_SHADER_STAGE_FRAGMENT_BIT; return VK_SHADER_STAGE_FRAGMENT_BIT;
case QRhiGraphicsShaderStage::Geometry:
return VK_SHADER_STAGE_GEOMETRY_BIT;
case QRhiGraphicsShaderStage::TessellationControl: case QRhiGraphicsShaderStage::TessellationControl:
return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
case QRhiGraphicsShaderStage::TessellationEvaluation: case QRhiGraphicsShaderStage::TessellationEvaluation:
...@@ -3689,6 +3695,8 @@ static inline VkShaderStageFlags toVkShaderStageFlags(QRhiShaderResourceBinding: ...@@ -3689,6 +3695,8 @@ static inline VkShaderStageFlags toVkShaderStageFlags(QRhiShaderResourceBinding:
s |= VK_SHADER_STAGE_VERTEX_BIT; s |= VK_SHADER_STAGE_VERTEX_BIT;
if (stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) if (stage.testFlag(QRhiShaderResourceBinding::FragmentStage))
s |= VK_SHADER_STAGE_FRAGMENT_BIT; s |= VK_SHADER_STAGE_FRAGMENT_BIT;
if (stage.testFlag(QRhiShaderResourceBinding::GeometryStage))
s |= VK_SHADER_STAGE_GEOMETRY_BIT;
if (stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage)) if (stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage))
s |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; s |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
if (stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage)) if (stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage))
......
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