From a5be18cc7d4bfee177923a4afbe51f9fd81ffbc6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 30 Jan 2020 09:57:12 +0100 Subject: rhi: Enable sampler address mode W in the API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internally this is already supported by all backends. The frontend was just not exposing addressW, instead defaulting to the (arbitrarily chosen) ClampToEdge. Add the parameter to newSampler(), but make it optional, defaulting to the more natural Repeat (because that's what one would get with OpenGL for WRAP_R by default) Change-Id: I0b991d8b649db37d4da86ac8e98ab7845601cf67 Reviewed-by: Christian Strømme --- src/gui/rhi/qrhigles2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/rhi/qrhigles2.cpp') diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index ec5e531e14..2620cc4d7b 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -838,9 +838,9 @@ QRhiTexture *QRhiGles2::createTexture(QRhiTexture::Format format, const QSize &p QRhiSampler *QRhiGles2::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, - QRhiSampler::AddressMode u, QRhiSampler::AddressMode v) + QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) { - return new QGles2Sampler(this, magFilter, minFilter, mipmapMode, u, v); + return new QGles2Sampler(this, magFilter, minFilter, mipmapMode, u, v, w); } QRhiTextureRenderTarget *QRhiGles2::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, @@ -3626,8 +3626,8 @@ QRhiTexture::NativeTexture QGles2Texture::nativeTexture() } QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, - AddressMode u, AddressMode v) - : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v) + AddressMode u, AddressMode v, AddressMode w) + : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w) { } -- cgit v1.2.3 From 19510abbffc433c2d6435e558047e55aa5800531 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 4 Feb 2020 13:52:21 +0100 Subject: rhi: Add depth bias and slope scaled depth bias Beware of the API terminology: GL 'factor' = 'slope scaled depth bias', GL 'units' = '(constant) depth bias'. Task-number: QTBUG-81843 Change-Id: I03e3618d007cbf7100add0de4950a6163d788cc7 Reviewed-by: Eirik Aavitsland --- src/gui/rhi/qrhigles2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/gui/rhi/qrhigles2.cpp') diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 2620cc4d7b..62f808ce81 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -2386,7 +2386,14 @@ void QRhiGles2::executeBindGraphicsPipeline(QRhiGraphicsPipeline *ps) f->glDisable(GL_STENCIL_TEST); } - if (psD->topology() == QRhiGraphicsPipeline::Lines || psD->topology() == QRhiGraphicsPipeline::LineStrip) + if (psD->m_depthBias != 0 || !qFuzzyIsNull(psD->m_slopeScaledDepthBias)) { + f->glPolygonOffset(psD->m_slopeScaledDepthBias, psD->m_depthBias); + f->glEnable(GL_POLYGON_OFFSET_FILL); + } else { + f->glDisable(GL_POLYGON_OFFSET_FILL); + } + + if (psD->m_topology == QRhiGraphicsPipeline::Lines || psD->m_topology == QRhiGraphicsPipeline::LineStrip) f->glLineWidth(psD->m_lineWidth); f->glUseProgram(psD->program); -- cgit v1.2.3