summaryrefslogtreecommitdiffstats
path: root/src/render/renderstates/renderstates.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-06-02 16:19:17 +0200
committerPaul Lemire <paul.lemire@kdab.com>2018-03-19 09:06:35 +0000
commit4b83e2ee155c9ebf71e2fc46ab9abdb40bbb1061 (patch)
treef6d9074e336cce1ded818cdecd14e46c847053c3 /src/render/renderstates/renderstates.cpp
parentab046302d593be2bfc368a321417a208d88f53ca (diff)
RenderStates: rework to split node and rendering part
The apply method was removed from GenericState and its subclasses. This allows to keep the GenericStates in the aspect part and let the renderer perform the right calls based on the state class it is provided with. Change-Id: I9c3ac04b4eb489e7443e67615e35e850c0aba07f Task-number: QTBUG-61151 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/render/renderstates/renderstates.cpp')
-rw-r--r--src/render/renderstates/renderstates.cpp144
1 files changed, 0 insertions, 144 deletions
diff --git a/src/render/renderstates/renderstates.cpp b/src/render/renderstates/renderstates.cpp
index 4a2ec69b0..d6be80b1c 100644
--- a/src/render/renderstates/renderstates.cpp
+++ b/src/render/renderstates/renderstates.cpp
@@ -60,34 +60,6 @@ void RenderStateImpl::updateProperty(const char *name, const QVariant &value)
Q_UNUSED(value);
}
-void BlendEquationArguments::apply(GraphicsContext* gc) const
-{
- // Un-indexed BlendEquationArguments -> Use normal GL1.0 functions
- if (std::get<5>(m_values) < 0) {
- if (std::get<4>(m_values)) {
- gc->openGLContext()->functions()->glEnable(GL_BLEND);
- gc->openGLContext()->functions()->glBlendFuncSeparate(std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values), std::get<3>(m_values));
- } else {
- gc->openGLContext()->functions()->glDisable(GL_BLEND);
- }
- }
- // BlendEquationArguments for a particular Draw Buffer. Different behaviours for
- // (1) 3.0-3.3: only enablei/disablei supported.
- // (2) 4.0+: all operations supported.
- // We just ignore blend func parameter for (1), so no warnings get
- // printed.
- else {
- if (std::get<4>(m_values)) {
- gc->enablei(GL_BLEND, std::get<5>(m_values));
- if (gc->supportsDrawBuffersBlend()) {
- gc->blendFuncSeparatei(std::get<5>(m_values), std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values), std::get<3>(m_values));
- }
- } else {
- gc->disablei(GL_BLEND, std::get<5>(m_values));
- }
- }
-}
-
void BlendEquationArguments::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("sourceRgb")) std::get<0>(m_values) = value.toInt();
@@ -98,21 +70,11 @@ void BlendEquationArguments::updateProperty(const char *name, const QVariant &va
else if (name == QByteArrayLiteral("bufferIndex")) std::get<5>(m_values) = value.toInt();
}
-void BlendEquation::apply(GraphicsContext *gc) const
-{
- gc->blendEquation(std::get<0>(m_values));
-}
-
void BlendEquation::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("blendFunction")) std::get<0>(m_values) = value.toInt();
}
-void AlphaFunc::apply(GraphicsContext* gc) const
-{
- gc->alphaTest(std::get<0>(m_values), std::get<1>(m_values));
-}
-
void AlphaFunc::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("alphaFunction"))
@@ -121,73 +83,32 @@ void AlphaFunc::updateProperty(const char *name, const QVariant &value)
std::get<1>(m_values) = value.toFloat();
}
-void MSAAEnabled::apply(GraphicsContext *gc) const
-{
- gc->setMSAAEnabled(std::get<0>(m_values));
-}
-
void MSAAEnabled::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("enabled"))
std::get<0>(m_values) = value.toBool();
}
-void DepthTest::apply(GraphicsContext *gc) const
-{
- gc->depthTest(std::get<0>(m_values));
-}
-
void DepthTest::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("depthFunction")) std::get<0>(m_values) = value.toInt();
}
-void CullFace::apply(GraphicsContext *gc) const
-{
- if (std::get<0>(m_values) == QCullFace::NoCulling) {
- gc->openGLContext()->functions()->glDisable(GL_CULL_FACE);
- } else {
- gc->openGLContext()->functions()->glEnable(GL_CULL_FACE);
- gc->openGLContext()->functions()->glCullFace(std::get<0>(m_values));
- }
-}
-
void CullFace::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("mode")) std::get<0>(m_values) = value.toInt();
}
-void FrontFace::apply(GraphicsContext *gc) const
-{
- gc->frontFace(std::get<0>(m_values));
-}
-
void FrontFace::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("direction")) std::get<0>(m_values) = value.toInt();
}
-void NoDepthMask::apply(GraphicsContext *gc) const
-{
- gc->depthMask(std::get<0>(m_values));
-}
-
void NoDepthMask::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("mask")) std::get<0>(m_values) = value.toBool();
}
-void Dithering::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glEnable(GL_DITHER);
-}
-
-void ScissorTest::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glEnable(GL_SCISSOR_TEST);
- gc->openGLContext()->functions()->glScissor(std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values), std::get<3>(m_values));
-}
-
void ScissorTest::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("left")) std::get<0>(m_values) = value.toInt();
@@ -196,13 +117,6 @@ void ScissorTest::updateProperty(const char *name, const QVariant &value)
else if (name == QByteArrayLiteral("height")) std::get<3>(m_values) = value.toInt();
}
-void StencilTest::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glEnable(GL_STENCIL_TEST);
- gc->openGLContext()->functions()->glStencilFuncSeparate(GL_FRONT, std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values));
- gc->openGLContext()->functions()->glStencilFuncSeparate(GL_BACK, std::get<3>(m_values), std::get<4>(m_values), std::get<5>(m_values));
-}
-
void StencilTest::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("arguments")) {
@@ -216,39 +130,18 @@ void StencilTest::updateProperty(const char *name, const QVariant &value)
}
}
-void AlphaCoverage::apply(GraphicsContext *gc) const
-{
- gc->setAlphaCoverageEnabled(true);
-}
-
-void PointSize::apply(GraphicsContext *gc) const
-{
- gc->pointSize(std::get<0>(m_values), std::get<1>(m_values));
-}
-
void PointSize::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("sizeMode")) std::get<0>(m_values) = (value.toInt() == QPointSize::Programmable);
else if (name == QByteArrayLiteral("value")) std::get<1>(m_values) = value.toFloat();
}
-void PolygonOffset::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glEnable(GL_POLYGON_OFFSET_FILL);
- gc->openGLContext()->functions()->glPolygonOffset(std::get<0>(m_values), std::get<1>(m_values));
-}
-
void PolygonOffset::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("scaleFactor")) std::get<0>(m_values) = value.toFloat();
else if (name == QByteArrayLiteral("depthSteps")) std::get<1>(m_values) = value.toFloat();
}
-void ColorMask::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glColorMask(std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values), std::get<3>(m_values));
-}
-
void ColorMask::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("redMasked")) std::get<0>(m_values) = value.toBool();
@@ -257,12 +150,6 @@ void ColorMask::updateProperty(const char *name, const QVariant &value)
else if (name == QByteArrayLiteral("alphaMasked")) std::get<3>(m_values) = value.toBool();
}
-void ClipPlane::apply(GraphicsContext *gc) const
-{
- gc->enableClipPlane(std::get<0>(m_values));
- gc->setClipPlane(std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values));
-}
-
void ClipPlane::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("planeIndex")) std::get<0>(m_values) = value.toInt();
@@ -270,17 +157,6 @@ void ClipPlane::updateProperty(const char *name, const QVariant &value)
else if (name == QByteArrayLiteral("distance")) std::get<2>(m_values) = value.toFloat();
}
-void SeamlessCubemap::apply(GraphicsContext *gc) const
-{
- gc->setSeamlessCubemap(true);
-}
-
-void StencilOp::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glStencilOpSeparate(GL_FRONT, std::get<0>(m_values), std::get<1>(m_values), std::get<2>(m_values));
- gc->openGLContext()->functions()->glStencilOpSeparate(GL_BACK, std::get<3>(m_values), std::get<4>(m_values), std::get<5>(m_values));
-}
-
void StencilOp::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("arguments")) {
@@ -294,32 +170,12 @@ void StencilOp::updateProperty(const char *name, const QVariant &value)
}
}
-void StencilMask::apply(GraphicsContext *gc) const
-{
- gc->openGLContext()->functions()->glStencilMaskSeparate(GL_FRONT, std::get<0>(m_values));
- gc->openGLContext()->functions()->glStencilMaskSeparate(GL_BACK, std::get<1>(m_values));
-}
-
void StencilMask::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("frontOutputMask")) std::get<0>(m_values) = value.toInt();
else if (name == QByteArrayLiteral("backOutputMask")) std::get<1>(m_values) = value.toInt();
}
-#ifndef GL_LINE_SMOOTH
-#define GL_LINE_SMOOTH 0x0B20
-#endif
-
-void LineWidth::apply(GraphicsContext *gc) const
-{
- if (std::get<1>(m_values))
- gc->openGLContext()->functions()->glEnable(GL_LINE_SMOOTH);
- else
- gc->openGLContext()->functions()->glDisable(GL_LINE_SMOOTH);
-
- gc->openGLContext()->functions()->glLineWidth(std::get<0>(m_values));
-}
-
void LineWidth::updateProperty(const char *name, const QVariant &value)
{
if (name == QByteArrayLiteral("value"))