summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/shadowmap
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-03-22 09:55:03 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-06-13 10:13:45 +0200
commit53599592e09edd215bfa1eaa7e6f3a9f3fc50ae6 (patch)
tree1083ec3a18030bb6f09de58b2fe0ac1cb8aedc0b /tests/manual/rhi/shadowmap
parentc143161608ded130919006f151bf92c44a0991d0 (diff)
Introduce the Qt graphics abstraction as private QtGui helpers
Comes with backends for Vulkan, Metal, Direct3D 11.1, and OpenGL (ES). All APIs are private for now. Shader conditioning (i.e. generating a QRhiShader in memory or on disk from some shader source code) is done via the tools and APIs provided by qt-labs/qtshadertools. The OpenGL support follows the cross-platform tradition of requiring ES 2.0 only, while optionally using some (ES) 3.x features. It can operate in core profile contexts as well. Task-number: QTBUG-70287 Change-Id: I246f2e36d562e404012c05db2aa72487108aa7cc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/manual/rhi/shadowmap')
-rw-r--r--tests/manual/rhi/shadowmap/buildshaders.bat4
-rwxr-xr-xtests/manual/rhi/shadowmap/buildshaders.sh4
-rw-r--r--tests/manual/rhi/shadowmap/main.frag30
-rw-r--r--tests/manual/rhi/shadowmap/main.frag.qsbbin0 -> 2489 bytes
-rw-r--r--tests/manual/rhi/shadowmap/main.vert20
-rw-r--r--tests/manual/rhi/shadowmap/main.vert.qsbbin0 -> 1595 bytes
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.cpp304
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.frag5
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.frag.qsbbin0 -> 408 bytes
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.pro8
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.qrc8
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.vert14
-rw-r--r--tests/manual/rhi/shadowmap/shadowmap.vert.qsbbin0 -> 1215 bytes
13 files changed, 397 insertions, 0 deletions
diff --git a/tests/manual/rhi/shadowmap/buildshaders.bat b/tests/manual/rhi/shadowmap/buildshaders.bat
new file mode 100644
index 0000000000..7b84cc0952
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/buildshaders.bat
@@ -0,0 +1,4 @@
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 -c shadowmap.vert -o shadowmap.vert.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 -c shadowmap.frag -o shadowmap.frag.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 -c main.vert -o main.vert.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 -c main.frag -o main.frag.qsb
diff --git a/tests/manual/rhi/shadowmap/buildshaders.sh b/tests/manual/rhi/shadowmap/buildshaders.sh
new file mode 100755
index 0000000000..c4d17841e6
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/buildshaders.sh
@@ -0,0 +1,4 @@
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 shadowmap.vert -o shadowmap.vert.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 shadowmap.frag -o shadowmap.frag.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 main.vert -o main.vert.qsb
+qsb --glsl "120,300 es" --hlsl 50 --msl 12 main.frag -o main.frag.qsb
diff --git a/tests/manual/rhi/shadowmap/main.frag b/tests/manual/rhi/shadowmap/main.frag
new file mode 100644
index 0000000000..8fefe2bb42
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/main.frag
@@ -0,0 +1,30 @@
+#version 440
+
+layout(location = 0) in vec4 vLCVertPos;
+
+layout(location = 0) out vec4 fragColor;
+
+layout(binding = 1) uniform sampler2DShadow shadowMap;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+ mat4 lightMvp;
+ mat4 shadowBias;
+ int useShadow;
+} ubuf;
+
+void main()
+{
+ vec4 adjustedLcVertPos = vLCVertPos;
+ adjustedLcVertPos.z -= 0.0001; // bias to avoid acne
+
+ // no textureProj, that seems to end up not doing the perspective divide for z (?)
+ vec3 v = adjustedLcVertPos.xyz / adjustedLcVertPos.w;
+ float sc = texture(shadowMap, v); // sampler is comparison enabled so compares to z
+
+ float shadowFactor = 0.2;
+ if (sc > 0 || ubuf.useShadow == 0)
+ shadowFactor = 1.0;
+
+ fragColor = vec4(0.5, 0.3 + ubuf.useShadow * 0.2, 0.7, 1.0) * shadowFactor;
+}
diff --git a/tests/manual/rhi/shadowmap/main.frag.qsb b/tests/manual/rhi/shadowmap/main.frag.qsb
new file mode 100644
index 0000000000..3001908b85
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/main.frag.qsb
Binary files differ
diff --git a/tests/manual/rhi/shadowmap/main.vert b/tests/manual/rhi/shadowmap/main.vert
new file mode 100644
index 0000000000..9d6cade634
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/main.vert
@@ -0,0 +1,20 @@
+#version 440
+
+layout(location = 0) in vec4 position;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+ mat4 lightMvp;
+ mat4 shadowBias;
+ int useShadow;
+} ubuf;
+
+out gl_PerVertex { vec4 gl_Position; };
+
+layout(location = 0) out vec4 vLCVertPos;
+
+void main()
+{
+ vLCVertPos = ubuf.shadowBias * ubuf.lightMvp * position;
+ gl_Position = ubuf.mvp * position;
+}
diff --git a/tests/manual/rhi/shadowmap/main.vert.qsb b/tests/manual/rhi/shadowmap/main.vert.qsb
new file mode 100644
index 0000000000..8b81a93c00
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/main.vert.qsb
Binary files differ
diff --git a/tests/manual/rhi/shadowmap/shadowmap.cpp b/tests/manual/rhi/shadowmap/shadowmap.cpp
new file mode 100644
index 0000000000..c31674a520
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.cpp
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../shared/examplefw.h"
+#include "../shared/cube.h"
+
+// Depth texture / shadow sampler / shadow map example.
+// Not available on GLES 2.0.
+
+static float quadVertexData[] =
+{ // Y up, CCW, x-y-z
+ -0.5f, 0.5f, 0.0f,
+ -0.5f, -0.5f, 0.0f,
+ 0.5f, -0.5f, 0.0f,
+ 0.5f, 0.5f, 0.0f,
+};
+
+static quint16 quadIndexData[] =
+{
+ 0, 1, 2, 0, 2, 3
+};
+
+struct {
+ QVector<QRhiResource *> releasePool;
+ QRhiBuffer *vbuf = nullptr;
+ QRhiBuffer *ibuf = nullptr;
+ QRhiBuffer *ubuf = nullptr;
+ QRhiSampler *shadowSampler = nullptr;
+ QRhiShaderResourceBindings *srb = nullptr;
+ QRhiGraphicsPipeline *ps = nullptr;
+ QRhiResourceUpdateBatch *initialUpdates = nullptr;
+ QMatrix4x4 winProj;
+ float cubeRot = 0;
+
+ QRhiTextureRenderTarget *rt = nullptr;
+ QRhiRenderPassDescriptor *rtRp = nullptr;
+ QRhiTexture *shadowMap = nullptr;
+ QRhiShaderResourceBindings *shadowSrb = nullptr;
+ QRhiGraphicsPipeline *shadowPs = nullptr;
+} d;
+
+const int UBLOCK_SIZE = 64 * 3 + 4;
+const int SHADOW_UBLOCK_SIZE = 64 * 1;
+const int UBUF_SLOTS = 4; // 2 objects * 2 passes with different cameras
+
+void Window::customInit()
+{
+ if (!m_r->isTextureFormatSupported(QRhiTexture::D32F))
+ qFatal("Depth texture is not supported");
+
+ d.vbuf = m_r->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(quadVertexData) + sizeof(cube));
+ d.vbuf->build();
+ d.releasePool << d.vbuf;
+
+ d.ibuf = m_r->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::IndexBuffer, sizeof(quadIndexData));
+ d.ibuf->build();
+ d.releasePool << d.ibuf;
+
+ const int oneRoundedUniformBlockSize = m_r->ubufAligned(UBLOCK_SIZE);
+ d.ubuf = m_r->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, UBUF_SLOTS * oneRoundedUniformBlockSize);
+ d.ubuf->build();
+ d.releasePool << d.ubuf;
+
+ d.shadowMap = m_r->newTexture(QRhiTexture::D32F, QSize(1024, 1024), 1, QRhiTexture::RenderTarget);
+ d.releasePool << d.shadowMap;
+ d.shadowMap->build();
+
+ d.shadowSampler = m_r->newSampler(QRhiSampler::Linear, QRhiSampler::Linear, QRhiSampler::None,
+ QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge);
+ d.releasePool << d.shadowSampler;
+ d.shadowSampler->setTextureCompareOp(QRhiSampler::Less);
+ d.shadowSampler->build();
+
+ d.srb = m_r->newShaderResourceBindings();
+ d.releasePool << d.srb;
+ const QRhiShaderResourceBinding::StageFlags stages = QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage;
+ d.srb->setBindings({ QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(0, stages, d.ubuf, UBLOCK_SIZE),
+ QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.shadowMap, d.shadowSampler) });
+ d.srb->build();
+
+ d.ps = m_r->newGraphicsPipeline();
+ d.releasePool << d.ps;
+ d.ps->setShaderStages({
+ { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/main.vert.qsb")) },
+ { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/main.frag.qsb")) }
+ });
+ d.ps->setDepthTest(true);
+ d.ps->setDepthWrite(true);
+ // fits both the quad and cube vertex data
+ QRhiVertexInputLayout inputLayout;
+ inputLayout.setBindings({
+ { 3 * sizeof(float) }
+ });
+ inputLayout.setAttributes({
+ { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
+ });
+ d.ps->setVertexInputLayout(inputLayout);
+ d.ps->setShaderResourceBindings(d.srb);
+ d.ps->setRenderPassDescriptor(m_rp);
+ d.ps->build();
+
+ d.initialUpdates = m_r->nextResourceUpdateBatch();
+ d.initialUpdates->uploadStaticBuffer(d.vbuf, 0, sizeof(quadVertexData), quadVertexData);
+ d.initialUpdates->uploadStaticBuffer(d.vbuf, sizeof(quadVertexData), sizeof(cube), cube);
+ d.initialUpdates->uploadStaticBuffer(d.ibuf, quadIndexData);
+
+ QRhiTextureRenderTargetDescription rtDesc;
+ rtDesc.setDepthTexture(d.shadowMap);
+ d.rt = m_r->newTextureRenderTarget(rtDesc);
+ d.releasePool << d.rt;
+ d.rtRp = d.rt->newCompatibleRenderPassDescriptor();
+ d.releasePool << d.rtRp;
+ d.rt->setRenderPassDescriptor(d.rtRp);
+ d.rt->build();
+
+ d.shadowSrb = m_r->newShaderResourceBindings();
+ d.releasePool << d.shadowSrb;
+ d.shadowSrb->setBindings({ QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(0, stages, d.ubuf, SHADOW_UBLOCK_SIZE) });
+ d.shadowSrb->build();
+
+ d.shadowPs = m_r->newGraphicsPipeline();
+ d.releasePool << d.shadowPs;
+ d.shadowPs->setShaderStages({
+ { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/shadowmap.vert.qsb")) },
+ { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/shadowmap.frag.qsb")) }
+ });
+ d.shadowPs->setDepthTest(true);
+ d.shadowPs->setDepthWrite(true);
+ inputLayout.setBindings({
+ { 3 * sizeof(float) }
+ });
+ inputLayout.setAttributes({
+ { 0, 0, QRhiVertexInputAttribute::Float3, 0 }
+ });
+ d.shadowPs->setVertexInputLayout(inputLayout);
+ d.shadowPs->setShaderResourceBindings(d.shadowSrb);
+ d.shadowPs->setRenderPassDescriptor(d.rtRp);
+ d.shadowPs->build();
+}
+
+void Window::customRelease()
+{
+ qDeleteAll(d.releasePool);
+ d.releasePool.clear();
+}
+
+static void enqueueScene(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int oneRoundedUniformBlockSize, int firstUbufSlot)
+{
+ QRhiCommandBuffer::DynamicOffset ubufOffset(0, quint32(firstUbufSlot * oneRoundedUniformBlockSize));
+ // draw the ground (the quad)
+ cb->setShaderResources(srb, 1, &ubufOffset);
+ QRhiCommandBuffer::VertexInput vbufBinding(d.vbuf, 0);
+ cb->setVertexInput(0, 1, &vbufBinding, d.ibuf, 0, QRhiCommandBuffer::IndexUInt16);
+ cb->drawIndexed(6);
+
+ // Draw the object (the cube). Both vertex and uniform data are in the same
+ // buffer, right after the quad's.
+ ubufOffset.second += oneRoundedUniformBlockSize;
+ cb->setShaderResources(srb, 1, &ubufOffset);
+ vbufBinding.second = sizeof(quadVertexData);
+ cb->setVertexInput(0, 1, &vbufBinding);
+ cb->draw(36);
+}
+
+void Window::customRender()
+{
+ const QSize outputSizeInPixels = m_sc->currentPixelSize();
+ QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer();
+ QRhiResourceUpdateBatch *u = m_r->nextResourceUpdateBatch();
+ if (d.initialUpdates) {
+ u->merge(d.initialUpdates);
+ d.initialUpdates->release();
+ d.initialUpdates = nullptr;
+ }
+
+ const int oneRoundedUniformBlockSize = m_r->ubufAligned(UBLOCK_SIZE);
+
+ QMatrix4x4 shadowBias;
+ // fill it in column-major order to keep our sanity (ctor would take row-major)
+ float *sbp = shadowBias.data();
+ if (m_r->isClipDepthZeroToOne()) {
+ // convert x, y [-1, 1] -> [0, 1]
+ *sbp++ = 0.5f; *sbp++ = 0.0f; *sbp++ = 0.0f; *sbp++ = 0.0f;
+ *sbp++ = 0.0f; *sbp++ = m_r->isYUpInNDC() ? -0.5f : 0.5f; *sbp++ = 0.0f; *sbp++ = 0.0f;
+ *sbp++ = 0.0f; *sbp++ = 0.0f; *sbp++ = 1.0f; *sbp++ = 0.0f;
+ *sbp++ = 0.5f; *sbp++ = 0.5f; *sbp++ = 0.0f; *sbp++ = 1.0f;
+ } else {
+ // convert x, y, z [-1, 1] -> [0, 1]
+ *sbp++ = 0.5f; *sbp++ = 0.0f; *sbp++ = 0.0f; *sbp++ = 0.0f;
+ *sbp++ = 0.0f; *sbp++ = 0.5f; *sbp++ = 0.0f; *sbp++ = 0.0f;
+ *sbp++ = 0.0f; *sbp++ = 0.0f; *sbp++ = 0.5f; *sbp++ = 0.0f;
+ *sbp++ = 0.5f; *sbp++ = 0.5f; *sbp++ = 0.5f; *sbp++ = 1.0f;
+ }
+
+ const QVector3D lightPos(5, 10, 10);
+ QMatrix4x4 lightViewProj = m_r->clipSpaceCorrMatrix();
+ lightViewProj.perspective(45.0f, 1, 0.1f, 100.0f);
+ lightViewProj.lookAt(lightPos, QVector3D(0, 0, 0), QVector3D(0, 1, 0));
+
+ // uniform data for the ground
+ if (d.winProj != m_proj) {
+ d.winProj = m_proj;
+
+ QMatrix4x4 m;
+ m.scale(4.0f);
+ m.rotate(-60, 1, 0, 0);
+
+ // for the main pass
+ const QMatrix4x4 mvp = m_proj * m; // m_proj is in fact projection * view
+ u->updateDynamicBuffer(d.ubuf, 0, 64, mvp.constData());
+ const QMatrix4x4 shadowMvp = lightViewProj * m;
+ u->updateDynamicBuffer(d.ubuf, 64, 64, shadowMvp.constData());
+ u->updateDynamicBuffer(d.ubuf, 128, 64, shadowBias.constData());
+ qint32 useShadows = 1;
+ u->updateDynamicBuffer(d.ubuf, 192, 4, &useShadows);
+
+ // for the shadow pass
+ u->updateDynamicBuffer(d.ubuf, 2 * oneRoundedUniformBlockSize, 64, shadowMvp.constData());
+ }
+
+ // uniform data for the rotating cube
+ QMatrix4x4 m;
+ m.translate(0, 0.5f, 2);
+ m.scale(0.2f);
+ m.rotate(d.cubeRot, 0, 1, 0);
+ m.rotate(45, 1, 0, 0);
+ d.cubeRot += 1;
+
+ // for the main pass
+ const QMatrix4x4 mvp = m_proj * m;
+ u->updateDynamicBuffer(d.ubuf, oneRoundedUniformBlockSize, 64, mvp.constData());
+ const QMatrix4x4 shadowMvp = lightViewProj * m;
+ u->updateDynamicBuffer(d.ubuf, oneRoundedUniformBlockSize + 64, 64, shadowMvp.constData());
+ u->updateDynamicBuffer(d.ubuf, oneRoundedUniformBlockSize + 128, 64, shadowBias.constData());
+ qint32 useShadows = 0;
+ u->updateDynamicBuffer(d.ubuf, oneRoundedUniformBlockSize + 192, 4, &useShadows);
+
+ // for the shadow pass
+ u->updateDynamicBuffer(d.ubuf, 3 * oneRoundedUniformBlockSize, 64, shadowMvp.constData());
+
+ cb->resourceUpdate(u);
+
+ // shadow pass
+ const QSize shadowMapSize = d.shadowMap->pixelSize();
+ cb->beginPass(d.rt, QColor(), { 1.0f, 0 });
+ cb->setGraphicsPipeline(d.shadowPs);
+ cb->setViewport({ 0, 0, float(shadowMapSize.width()), float(shadowMapSize.height()) });
+ enqueueScene(cb, d.shadowSrb, oneRoundedUniformBlockSize, 2);
+ cb->endPass();
+
+ // main pass
+ cb->beginPass(m_sc->currentFrameRenderTarget(), QColor::fromRgbF(0.4f, 0.7f, 0.0f, 1.0f), { 1.0f, 0 });
+ cb->setGraphicsPipeline(d.ps);
+ cb->setViewport({ 0, 0, float(outputSizeInPixels.width()), float(outputSizeInPixels.height()) });
+ enqueueScene(cb, d.srb, oneRoundedUniformBlockSize, 0);
+ cb->endPass();
+}
diff --git a/tests/manual/rhi/shadowmap/shadowmap.frag b/tests/manual/rhi/shadowmap/shadowmap.frag
new file mode 100644
index 0000000000..fa868f31a2
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.frag
@@ -0,0 +1,5 @@
+#version 440
+
+void main()
+{
+}
diff --git a/tests/manual/rhi/shadowmap/shadowmap.frag.qsb b/tests/manual/rhi/shadowmap/shadowmap.frag.qsb
new file mode 100644
index 0000000000..3cad114cf4
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.frag.qsb
Binary files differ
diff --git a/tests/manual/rhi/shadowmap/shadowmap.pro b/tests/manual/rhi/shadowmap/shadowmap.pro
new file mode 100644
index 0000000000..baf740927c
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+
+QT += gui-private
+
+SOURCES = \
+ shadowmap.cpp
+
+RESOURCES = shadowmap.qrc
diff --git a/tests/manual/rhi/shadowmap/shadowmap.qrc b/tests/manual/rhi/shadowmap/shadowmap.qrc
new file mode 100644
index 0000000000..8256d5ca25
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.qrc
@@ -0,0 +1,8 @@
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+ <file>shadowmap.vert.qsb</file>
+ <file>shadowmap.frag.qsb</file>
+ <file>main.vert.qsb</file>
+ <file>main.frag.qsb</file>
+</qresource>
+</RCC>
diff --git a/tests/manual/rhi/shadowmap/shadowmap.vert b/tests/manual/rhi/shadowmap/shadowmap.vert
new file mode 100644
index 0000000000..72b5370aec
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.vert
@@ -0,0 +1,14 @@
+#version 440
+
+layout(location = 0) in vec4 position;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+} ubuf;
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ gl_Position = ubuf.mvp * position;
+}
diff --git a/tests/manual/rhi/shadowmap/shadowmap.vert.qsb b/tests/manual/rhi/shadowmap/shadowmap.vert.qsb
new file mode 100644
index 0000000000..37a5e6ecbf
--- /dev/null
+++ b/tests/manual/rhi/shadowmap/shadowmap.vert.qsb
Binary files differ