From 6f4aa5413183f3f18dd1b15dbc90bcee9ef85bdd Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 12 Jun 2019 14:22:33 +0200 Subject: rhi: Add compute api and implement for Vulkan and Metal D3D11 and GL (4.3+, ES 3.1+) will come separately at a later time. Change-Id: If30f2f3d062fa27e57e9912674669225b82a7b93 Reviewed-by: Lars Knoll --- .../compressedtexture_bc1.cpp | 4 +- .../compressedtexture_bc1_subupload.cpp | 4 +- tests/manual/rhi/computebuffer/buffer.comp | 41 ++++ tests/manual/rhi/computebuffer/buffer.comp.qsb | Bin 0 -> 2160 bytes tests/manual/rhi/computebuffer/buildshaders.bat | 3 + tests/manual/rhi/computebuffer/computebuffer.cpp | 202 ++++++++++++++++++ tests/manual/rhi/computebuffer/computebuffer.pro | 8 + tests/manual/rhi/computebuffer/computebuffer.qrc | 7 + tests/manual/rhi/computebuffer/main.frag | 8 + tests/manual/rhi/computebuffer/main.frag.qsb | Bin 0 -> 672 bytes tests/manual/rhi/computebuffer/main.vert | 11 + tests/manual/rhi/computebuffer/main.vert.qsb | Bin 0 -> 852 bytes tests/manual/rhi/computeimage/buildshaders.bat | 1 + tests/manual/rhi/computeimage/computeimage.cpp | 228 +++++++++++++++++++++ tests/manual/rhi/computeimage/computeimage.pro | 8 + tests/manual/rhi/computeimage/computeimage.qrc | 8 + tests/manual/rhi/computeimage/image.comp | 20 ++ tests/manual/rhi/computeimage/image.comp.qsb | Bin 0 -> 1811 bytes tests/manual/rhi/cubemap/cubemap.cpp | 4 +- tests/manual/rhi/floattexture/floattexture.cpp | 4 +- .../hellominimalcrossgfxtriangle.cpp | 4 +- tests/manual/rhi/mrt/mrt.cpp | 8 +- .../rhi/msaarenderbuffer/msaarenderbuffer.cpp | 8 +- tests/manual/rhi/msaatexture/msaatexture.cpp | 14 +- tests/manual/rhi/multiwindow/multiwindow.cpp | 4 +- .../multiwindow_threaded/multiwindow_threaded.cpp | 4 +- tests/manual/rhi/offscreen/offscreen.cpp | 4 +- tests/manual/rhi/rhi.pro | 4 +- tests/manual/rhi/shadowmap/shadowmap.cpp | 8 +- tests/manual/rhi/texuploads/texuploads.cpp | 4 +- .../rhi/triquadcube/texturedcuberenderer.cpp | 4 +- .../rhi/triquadcube/triangleoncuberenderer.cpp | 4 +- tests/manual/rhi/triquadcube/trianglerenderer.cpp | 4 +- tests/manual/rhi/triquadcube/triquadcube.cpp | 1 + 34 files changed, 592 insertions(+), 44 deletions(-) create mode 100644 tests/manual/rhi/computebuffer/buffer.comp create mode 100644 tests/manual/rhi/computebuffer/buffer.comp.qsb create mode 100755 tests/manual/rhi/computebuffer/buildshaders.bat create mode 100644 tests/manual/rhi/computebuffer/computebuffer.cpp create mode 100644 tests/manual/rhi/computebuffer/computebuffer.pro create mode 100644 tests/manual/rhi/computebuffer/computebuffer.qrc create mode 100644 tests/manual/rhi/computebuffer/main.frag create mode 100644 tests/manual/rhi/computebuffer/main.frag.qsb create mode 100644 tests/manual/rhi/computebuffer/main.vert create mode 100644 tests/manual/rhi/computebuffer/main.vert.qsb create mode 100755 tests/manual/rhi/computeimage/buildshaders.bat create mode 100644 tests/manual/rhi/computeimage/computeimage.cpp create mode 100644 tests/manual/rhi/computeimage/computeimage.pro create mode 100644 tests/manual/rhi/computeimage/computeimage.qrc create mode 100644 tests/manual/rhi/computeimage/image.comp create mode 100644 tests/manual/rhi/computeimage/image.comp.qsb (limited to 'tests') diff --git a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp index d50e183096..27dd8097ad 100644 --- a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp +++ b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp @@ -113,8 +113,8 @@ void Window::customInit() qFatal("Failed to load shader pack (fragment)"); d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp b/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp index 7ae5dd0d73..87d1e7646a 100644 --- a/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp +++ b/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp @@ -117,8 +117,8 @@ void Window::customInit() qFatal("Failed to load shader pack (fragment)"); d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/computebuffer/buffer.comp b/tests/manual/rhi/computebuffer/buffer.comp new file mode 100644 index 0000000000..a0d0350e37 --- /dev/null +++ b/tests/manual/rhi/computebuffer/buffer.comp @@ -0,0 +1,41 @@ +#version 440 + +layout (local_size_x = 256) in; + +struct Data +{ + vec2 pos; + float dir; +}; + +layout(std140, binding = 0) buffer StorageBuffer +{ + Data d[]; +} buf; + +layout(std140, binding = 1) uniform UniformBuffer +{ + float step; + uint count; +} ubuf; + +void main() +{ + uint index = gl_GlobalInvocationID.x; + if (index < ubuf.count) { + vec2 p = buf.d[index].pos; + float dir = buf.d[index].dir; + + p.x += dir * ubuf.step * 0.01; + if (p.x > 1.0) { + p.x = 1.0; + buf.d[index].dir *= -1.0; + } + if (p.x < -1.0) { + p.x = -1.0; + buf.d[index].dir *= -1.0; + } + + buf.d[index].pos = p; + } +} diff --git a/tests/manual/rhi/computebuffer/buffer.comp.qsb b/tests/manual/rhi/computebuffer/buffer.comp.qsb new file mode 100644 index 0000000000..b1a666f185 Binary files /dev/null and b/tests/manual/rhi/computebuffer/buffer.comp.qsb differ diff --git a/tests/manual/rhi/computebuffer/buildshaders.bat b/tests/manual/rhi/computebuffer/buildshaders.bat new file mode 100755 index 0000000000..2768273b70 --- /dev/null +++ b/tests/manual/rhi/computebuffer/buildshaders.bat @@ -0,0 +1,3 @@ +qsb --glsl "310 es,430" --hlsl 50 --msl 12 buffer.comp -o buffer.comp.qsb +qsb --glsl "310 es,430" --hlsl 50 --msl 12 main.vert -o main.vert.qsb +qsb --glsl "310 es,430" --hlsl 50 --msl 12 main.frag -o main.frag.qsb diff --git a/tests/manual/rhi/computebuffer/computebuffer.cpp b/tests/manual/rhi/computebuffer/computebuffer.cpp new file mode 100644 index 0000000000..d6c576cf3b --- /dev/null +++ b/tests/manual/rhi/computebuffer/computebuffer.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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 + +// Compute shader example. Writes to a storage buffer from a compute shader, +// then uses the same buffer as vertex buffer in the vertex stage. This would +// be typical when implementing particles for example. Here we just simply move +// the positions back and forth along the X axis. + +// Note that the example relies on gl_PointSize which is not supported +// everywhere. So in some cases the points will be of size 1. + +struct { + QVector releasePool; + QRhiBuffer *sbuf = nullptr; + QRhiBuffer *computeUniBuf = nullptr; + QRhiShaderResourceBindings *computeBindings = nullptr; + QRhiComputePipeline *computePipeline = nullptr; + QRhiShaderResourceBindings *graphicsBindings = nullptr; + QRhiGraphicsPipeline *graphicsPipeline = nullptr; + QRhiResourceUpdateBatch *initialUpdates = nullptr; + float step = 0.2f; +} d; + +// these struct must match the std140 packing rules +struct Data { + float pos[2]; + float dir; + quint32 pad[1]; +}; +struct ComputeUBuf { + float step; + quint32 count; +}; + +const int DATA_COUNT = 256 * 128; + +const int COMPUTE_UBUF_SIZE = 8; + +void Window::customInit() +{ + if (!m_r->isFeatureSupported(QRhi::Compute)) + qFatal("Compute is not supported"); + + // compute pass + + d.sbuf = m_r->newBuffer(QRhiBuffer::Immutable, + QRhiBuffer::StorageBuffer | QRhiBuffer::VertexBuffer, + sizeof(Data) * DATA_COUNT); + d.sbuf->build(); + d.releasePool << d.sbuf; + + d.computeUniBuf = m_r->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, COMPUTE_UBUF_SIZE); + d.computeUniBuf->build(); + d.releasePool << d.computeUniBuf; + + d.initialUpdates = m_r->nextResourceUpdateBatch(); + + QByteArray data; + data.resize(sizeof(Data) * DATA_COUNT); + Data *p = reinterpret_cast(data.data()); + QRandomGenerator *rgen = QRandomGenerator::global(); + for (int i = 0; i < DATA_COUNT; ++i) { + p->pos[0] = rgen->bounded(1000) / 500.0f - 1.0f; + p->pos[1] = rgen->bounded(1000) / 500.0f - 1.0f; + p->dir = rgen->bounded(2) ? 1 : -1; + ++p; + } + d.initialUpdates->uploadStaticBuffer(d.sbuf, data.constData()); + + ComputeUBuf ud; + ud.step = d.step; + ud.count = DATA_COUNT; + d.initialUpdates->updateDynamicBuffer(d.computeUniBuf, 0, COMPUTE_UBUF_SIZE, &ud); + + d.computeBindings = m_r->newShaderResourceBindings(); + d.computeBindings->setBindings({ + QRhiShaderResourceBinding::bufferLoadStore(0, QRhiShaderResourceBinding::ComputeStage, d.sbuf), + QRhiShaderResourceBinding::uniformBuffer(1, QRhiShaderResourceBinding::ComputeStage, d.computeUniBuf) + }); + d.computeBindings->build(); + d.releasePool << d.computeBindings; + + d.computePipeline = m_r->newComputePipeline(); + d.computePipeline->setShaderResourceBindings(d.computeBindings); + d.computePipeline->setShaderStage({ QRhiShaderStage::Compute, getShader(QLatin1String(":/buffer.comp.qsb")) }); + d.computePipeline->build(); + d.releasePool << d.computePipeline; + + // graphics pass + + d.graphicsBindings = m_r->newShaderResourceBindings(); + d.graphicsBindings->build(); + d.releasePool << d.graphicsBindings; + + d.graphicsPipeline = m_r->newGraphicsPipeline(); + d.graphicsPipeline->setTopology(QRhiGraphicsPipeline::Points); + d.graphicsPipeline->setShaderStages({ + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/main.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/main.frag.qsb")) } + }); + QRhiVertexInputLayout inputLayout; + inputLayout.setBindings({ + { 2 * sizeof(float) } + }); + inputLayout.setAttributes({ + { 0, 0, QRhiVertexInputAttribute::Float2, 0 }, + }); + d.graphicsPipeline->setVertexInputLayout(inputLayout); + d.graphicsPipeline->setShaderResourceBindings(d.graphicsBindings); + d.graphicsPipeline->setRenderPassDescriptor(m_rp); + d.graphicsPipeline->build(); + d.releasePool << d.graphicsPipeline; +} + +void Window::customRelease() +{ + qDeleteAll(d.releasePool); + d.releasePool.clear(); +} + +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; + } + +#if 0 + u->updateDynamicBuffer(d.computeUniBuf, 0, sizeof(float), &d.step); + d.step += 0.01f; +#endif + + // compute pass + cb->beginComputePass(u); + cb->setComputePipeline(d.computePipeline); + cb->setShaderResources(); + cb->dispatch(DATA_COUNT / 256, 1, 1); + cb->endComputePass(); + + // graphics pass + cb->beginPass(m_sc->currentFrameRenderTarget(), QColor::fromRgbF(0.4f, 0.7f, 0.0f, 1.0f), { 1.0f, 0 }); + cb->setGraphicsPipeline(d.graphicsPipeline); + cb->setViewport({ 0, 0, float(outputSizeInPixels.width()), float(outputSizeInPixels.height()) }); + QRhiCommandBuffer::VertexInput vbufBinding(d.sbuf, 0); + cb->setVertexInput(0, 1, &vbufBinding); + cb->draw(DATA_COUNT); + cb->endPass(); +} diff --git a/tests/manual/rhi/computebuffer/computebuffer.pro b/tests/manual/rhi/computebuffer/computebuffer.pro new file mode 100644 index 0000000000..ab3c8001f1 --- /dev/null +++ b/tests/manual/rhi/computebuffer/computebuffer.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += gui-private + +SOURCES = \ + computebuffer.cpp + +RESOURCES = computebuffer.qrc diff --git a/tests/manual/rhi/computebuffer/computebuffer.qrc b/tests/manual/rhi/computebuffer/computebuffer.qrc new file mode 100644 index 0000000000..d9e877a15d --- /dev/null +++ b/tests/manual/rhi/computebuffer/computebuffer.qrc @@ -0,0 +1,7 @@ + + + buffer.comp.qsb + main.vert.qsb + main.frag.qsb + + diff --git a/tests/manual/rhi/computebuffer/main.frag b/tests/manual/rhi/computebuffer/main.frag new file mode 100644 index 0000000000..4785a404d3 --- /dev/null +++ b/tests/manual/rhi/computebuffer/main.frag @@ -0,0 +1,8 @@ +#version 440 + +layout(location = 0) out vec4 fragColor; + +void main() +{ + fragColor = vec4(1.0); +} diff --git a/tests/manual/rhi/computebuffer/main.frag.qsb b/tests/manual/rhi/computebuffer/main.frag.qsb new file mode 100644 index 0000000000..f05da411e5 Binary files /dev/null and b/tests/manual/rhi/computebuffer/main.frag.qsb differ diff --git a/tests/manual/rhi/computebuffer/main.vert b/tests/manual/rhi/computebuffer/main.vert new file mode 100644 index 0000000000..5dfb778d2e --- /dev/null +++ b/tests/manual/rhi/computebuffer/main.vert @@ -0,0 +1,11 @@ +#version 440 + +layout(location = 0) in vec4 position; + +out gl_PerVertex { vec4 gl_Position; float gl_PointSize; }; + +void main() +{ + gl_PointSize = 4.0; // required with Vulkan when drawing points + gl_Position = position; +} diff --git a/tests/manual/rhi/computebuffer/main.vert.qsb b/tests/manual/rhi/computebuffer/main.vert.qsb new file mode 100644 index 0000000000..944645ffbf Binary files /dev/null and b/tests/manual/rhi/computebuffer/main.vert.qsb differ diff --git a/tests/manual/rhi/computeimage/buildshaders.bat b/tests/manual/rhi/computeimage/buildshaders.bat new file mode 100755 index 0000000000..41a324d2b2 --- /dev/null +++ b/tests/manual/rhi/computeimage/buildshaders.bat @@ -0,0 +1 @@ +qsb --glsl "310 es,430" --hlsl 50 --msl 12 image.comp -o image.comp.qsb diff --git a/tests/manual/rhi/computeimage/computeimage.cpp b/tests/manual/rhi/computeimage/computeimage.cpp new file mode 100644 index 0000000000..7bc05fc04f --- /dev/null +++ b/tests/manual/rhi/computeimage/computeimage.cpp @@ -0,0 +1,228 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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" + +// Compute shader example with image load/store. The texture sampled in the +// fragment shader is generated by the compute shader. + +struct { + QVector releasePool; + + QRhiTexture *texIn = nullptr; + QRhiTexture *texOut = nullptr; + QRhiBuffer *computeUBuf = nullptr; + QRhiShaderResourceBindings *computeBindings = nullptr; + QRhiComputePipeline *computePipeline = nullptr; + + QRhiBuffer *vbuf = nullptr; + QRhiBuffer *ibuf = nullptr; + QRhiBuffer *ubuf = nullptr; + QRhiSampler *sampler = nullptr; + QRhiShaderResourceBindings *srb = nullptr; + QRhiGraphicsPipeline *ps = nullptr; + + QRhiResourceUpdateBatch *initialUpdates = nullptr; + QSize imageSize; + QMatrix4x4 winProj; + float factor = 1.0f; +} d; + +static float quadVertexData[] = +{ // Y up, CCW + -0.5f, 0.5f, 0.0f, 0.0f, + -0.5f, -0.5f, 0.0f, 1.0f, + 0.5f, -0.5f, 1.0f, 1.0f, + 0.5f, 0.5f, 1.0f, 0.0f +}; + +static quint16 quadIndexData[] = +{ + 0, 1, 2, 0, 2, 3 +}; + +void Window::customInit() +{ + if (!m_r->isFeatureSupported(QRhi::Compute)) + qFatal("Compute is not supported"); + + d.initialUpdates = m_r->nextResourceUpdateBatch(); + + // compute pass + + const QImage image = QImage(QLatin1String(":/qt256.png")).convertToFormat(QImage::Format_RGBA8888); + d.imageSize = image.size(); + d.texIn = m_r->newTexture(QRhiTexture::RGBA8, d.imageSize, 1, QRhiTexture::UsedWithLoadStore); + d.texIn->build(); + d.releasePool << d.texIn; + + d.texOut = m_r->newTexture(QRhiTexture::RGBA8, d.imageSize, 1, QRhiTexture::UsedWithLoadStore); + d.texOut->build(); + d.releasePool << d.texOut; + + d.initialUpdates->uploadTexture(d.texIn, image); + + d.computeUBuf = m_r->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 4); + d.computeUBuf->build(); + d.releasePool << d.computeUBuf; + + d.computeBindings = m_r->newShaderResourceBindings(); + d.computeBindings->setBindings({ + QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::ComputeStage, d.computeUBuf), + QRhiShaderResourceBinding::imageLoad(1, QRhiShaderResourceBinding::ComputeStage, d.texIn, 0), + QRhiShaderResourceBinding::imageStore(2, QRhiShaderResourceBinding::ComputeStage, d.texOut, 0) + }); + d.computeBindings->build(); + d.releasePool << d.computeBindings; + + d.computePipeline = m_r->newComputePipeline(); + d.computePipeline->setShaderResourceBindings(d.computeBindings); + d.computePipeline->setShaderStage({ QRhiShaderStage::Compute, getShader(QLatin1String(":/image.comp.qsb")) }); + d.computePipeline->build(); + d.releasePool << d.computePipeline; + + // graphics pass + + d.vbuf = m_r->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(quadVertexData)); + d.vbuf->build(); + d.releasePool << d.vbuf; + + d.initialUpdates->uploadStaticBuffer(d.vbuf, quadVertexData); + + d.ibuf = m_r->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::IndexBuffer, sizeof(quadIndexData)); + d.ibuf->build(); + d.releasePool << d.ibuf; + + d.initialUpdates->uploadStaticBuffer(d.ibuf, quadIndexData); + + d.ubuf = m_r->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 68); + d.ubuf->build(); + d.releasePool << d.ubuf; + + qint32 flip = m_r->isYUpInFramebuffer() ? 1 : 0; + d.initialUpdates->updateDynamicBuffer(d.ubuf, 64, 4, &flip); + + d.sampler = m_r->newSampler(QRhiSampler::Linear, QRhiSampler::Linear, QRhiSampler::None, + QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge); + d.releasePool << d.sampler; + d.sampler->build(); + + d.srb = m_r->newShaderResourceBindings(); + d.releasePool << d.srb; + d.srb->setBindings({ + QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d.ubuf), + QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.texOut, d.sampler) + }); + d.srb->build(); + + d.ps = m_r->newGraphicsPipeline(); + d.releasePool << d.ps; + d.ps->setShaderStages({ + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + }); + QRhiVertexInputLayout inputLayout; + inputLayout.setBindings({ + { 4 * sizeof(float) } + }); + inputLayout.setAttributes({ + { 0, 0, QRhiVertexInputAttribute::Float2, 0 }, + { 0, 1, QRhiVertexInputAttribute::Float2, 2 * sizeof(float) } + }); + d.ps->setVertexInputLayout(inputLayout); + d.ps->setShaderResourceBindings(d.srb); + d.ps->setRenderPassDescriptor(m_rp); + d.ps->build(); +} + +void Window::customRelease() +{ + qDeleteAll(d.releasePool); + d.releasePool.clear(); +} + +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; + } + + if (d.winProj != m_proj) { + d.winProj = m_proj; + QMatrix4x4 mvp = m_proj; + mvp.scale(2.5f); + u->updateDynamicBuffer(d.ubuf, 0, 64, mvp.constData()); + } + + u->updateDynamicBuffer(d.computeUBuf, 0, 4, &d.factor); + d.factor += 0.1f; + if (d.factor >= 50.0f) + d.factor = 1.0f; + + cb->beginComputePass(u); + cb->setComputePipeline(d.computePipeline); + cb->setShaderResources(); + cb->dispatch(d.imageSize.width() / 16, d.imageSize.height() / 16, 1); + cb->endComputePass(); + + 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()) }); + cb->setShaderResources(); + QRhiCommandBuffer::VertexInput vbufBinding(d.vbuf, 0); + cb->setVertexInput(0, 1, &vbufBinding, d.ibuf, 0, QRhiCommandBuffer::IndexUInt16); + cb->drawIndexed(6); + cb->endPass(); +} diff --git a/tests/manual/rhi/computeimage/computeimage.pro b/tests/manual/rhi/computeimage/computeimage.pro new file mode 100644 index 0000000000..291a4e91b1 --- /dev/null +++ b/tests/manual/rhi/computeimage/computeimage.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += gui-private + +SOURCES = \ + computeimage.cpp + +RESOURCES = computeimage.qrc diff --git a/tests/manual/rhi/computeimage/computeimage.qrc b/tests/manual/rhi/computeimage/computeimage.qrc new file mode 100644 index 0000000000..5299e1ae22 --- /dev/null +++ b/tests/manual/rhi/computeimage/computeimage.qrc @@ -0,0 +1,8 @@ + + + image.comp.qsb + ../shared/texture.vert.qsb + ../shared/texture.frag.qsb + ../shared/qt256.png + + diff --git a/tests/manual/rhi/computeimage/image.comp b/tests/manual/rhi/computeimage/image.comp new file mode 100644 index 0000000000..9826ed7c6c --- /dev/null +++ b/tests/manual/rhi/computeimage/image.comp @@ -0,0 +1,20 @@ +#version 440 + +layout (local_size_x = 16, local_size_y = 16) in; + +layout(std140, binding = 0) uniform UniformBuffer +{ + float factor; +} ubuf; + +layout (binding = 1, rgba8) uniform readonly image2D texIn; +layout (binding = 2, rgba8) uniform writeonly image2D texOut; + +void main() +{ + ivec2 pos = ivec2(gl_GlobalInvocationID.xy); + ivec2 d = ivec2(1, 1); + vec4 diff = imageLoad(texIn, pos + d) - imageLoad(texIn, pos - d); + float c = (diff.x + diff.y + diff.z) / ubuf.factor + 0.5f; + imageStore(texOut, pos, vec4(c, c, c, 1.0)); +} diff --git a/tests/manual/rhi/computeimage/image.comp.qsb b/tests/manual/rhi/computeimage/image.comp.qsb new file mode 100644 index 0000000000..725629f7ab Binary files /dev/null and b/tests/manual/rhi/computeimage/image.comp.qsb differ diff --git a/tests/manual/rhi/cubemap/cubemap.cpp b/tests/manual/rhi/cubemap/cubemap.cpp index 0420a38cbd..df302736a2 100644 --- a/tests/manual/rhi/cubemap/cubemap.cpp +++ b/tests/manual/rhi/cubemap/cubemap.cpp @@ -121,8 +121,8 @@ void Window::customInit() QShader fs = getShader(QLatin1String(":/cubemap.frag.qsb")); Q_ASSERT(fs.isValid()); d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/floattexture/floattexture.cpp b/tests/manual/rhi/floattexture/floattexture.cpp index b62ef290f7..16e58ff00f 100644 --- a/tests/manual/rhi/floattexture/floattexture.cpp +++ b/tests/manual/rhi/floattexture/floattexture.cpp @@ -266,8 +266,8 @@ void Window::customInit() d.ps = m_r->newGraphicsPipeline(); d.releasePool << d.ps; d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } }); QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ diff --git a/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp b/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp index a24b980173..3c39ff1719 100644 --- a/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp +++ b/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp @@ -339,8 +339,8 @@ void Window::init() qFatal("Failed to load shader pack (fragment)"); m_ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/mrt/mrt.cpp b/tests/manual/rhi/mrt/mrt.cpp index 2bbd879dc4..b80af7ac87 100644 --- a/tests/manual/rhi/mrt/mrt.cpp +++ b/tests/manual/rhi/mrt/mrt.cpp @@ -157,8 +157,8 @@ void Window::customInit() d.ps = m_r->newGraphicsPipeline(); d.releasePool << d.ps; d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } }); QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ @@ -197,8 +197,8 @@ void Window::customInit() d.triPs = m_r->newGraphicsPipeline(); d.releasePool << d.triPs; d.triPs->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/mrt.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/mrt.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/mrt.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/mrt.frag.qsb")) } }); QVector blends; for (int i = 0; i < ATTCOUNT; ++i) { diff --git a/tests/manual/rhi/msaarenderbuffer/msaarenderbuffer.cpp b/tests/manual/rhi/msaarenderbuffer/msaarenderbuffer.cpp index b61fb91c6d..b77a27b1b5 100644 --- a/tests/manual/rhi/msaarenderbuffer/msaarenderbuffer.cpp +++ b/tests/manual/rhi/msaarenderbuffer/msaarenderbuffer.cpp @@ -146,8 +146,8 @@ void Window::customInit() d.releasePool << d.triPs; d.triPs->setSampleCount(4); // must match the render target d.triPs->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/color.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/color.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/color.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/color.frag.qsb")) } }); QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ @@ -178,8 +178,8 @@ void Window::customInit() d.ps = m_r->newGraphicsPipeline(); d.releasePool << d.ps; d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } }); inputLayout.setBindings({ { 4 * sizeof(float) } diff --git a/tests/manual/rhi/msaatexture/msaatexture.cpp b/tests/manual/rhi/msaatexture/msaatexture.cpp index 1b652cce92..46a9b2830c 100644 --- a/tests/manual/rhi/msaatexture/msaatexture.cpp +++ b/tests/manual/rhi/msaatexture/msaatexture.cpp @@ -164,8 +164,8 @@ void Window::customInit() d.psLeft = m_r->newGraphicsPipeline(); d.releasePool << d.psLeft; d.psLeft->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } }); QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ { 4 * sizeof(float) } }); @@ -181,11 +181,11 @@ void Window::customInit() d.psRight = m_r->newGraphicsPipeline(); d.releasePool << d.psRight; d.psRight->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, #ifndef NO_MSAA - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture_ms4.frag.qsb")) } + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture_ms4.frag.qsb")) } #else - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } #endif }); d.psRight->setVertexInputLayout(d.psLeft->vertexInputLayout()); @@ -219,8 +219,8 @@ void Window::customInit() d.releasePool << d.triPs; d.triPs->setSampleCount(1); d.triPs->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/color.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/color.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/color.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/color.frag.qsb")) } }); inputLayout.setBindings({ { 5 * sizeof(float) } diff --git a/tests/manual/rhi/multiwindow/multiwindow.cpp b/tests/manual/rhi/multiwindow/multiwindow.cpp index a5eed78b1d..4c5d5c345a 100644 --- a/tests/manual/rhi/multiwindow/multiwindow.cpp +++ b/tests/manual/rhi/multiwindow/multiwindow.cpp @@ -234,8 +234,8 @@ void ensureSharedResources(QRhiRenderPassDescriptor *rp) qFatal("Failed to load shader pack (fragment)"); d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp b/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp index 45818e91e9..8fda2b73c8 100644 --- a/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp +++ b/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp @@ -484,8 +484,8 @@ void Renderer::init() m_ps->setFrontFace(QRhiGraphicsPipeline::CCW); m_ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, - { QRhiGraphicsShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/texture.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/texture.frag.qsb")) } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/offscreen/offscreen.cpp b/tests/manual/rhi/offscreen/offscreen.cpp index 838dc9d2c8..678d6ffe48 100644 --- a/tests/manual/rhi/offscreen/offscreen.cpp +++ b/tests/manual/rhi/offscreen/offscreen.cpp @@ -264,8 +264,8 @@ int main(int argc, char **argv) qFatal("Failed to load shader pack (fragment)"); ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/rhi.pro b/tests/manual/rhi/rhi.pro index 1a65f84a89..a06d973efe 100644 --- a/tests/manual/rhi/rhi.pro +++ b/tests/manual/rhi/rhi.pro @@ -14,7 +14,9 @@ SUBDIRS += \ offscreen \ floattexture \ mrt \ - shadowmap + shadowmap \ + computebuffer \ + computeimage qtConfig(widgets) { SUBDIRS += \ diff --git a/tests/manual/rhi/shadowmap/shadowmap.cpp b/tests/manual/rhi/shadowmap/shadowmap.cpp index c31674a520..9146be5cc9 100644 --- a/tests/manual/rhi/shadowmap/shadowmap.cpp +++ b/tests/manual/rhi/shadowmap/shadowmap.cpp @@ -128,8 +128,8 @@ void Window::customInit() 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")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/main.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/main.frag.qsb")) } }); d.ps->setDepthTest(true); d.ps->setDepthWrite(true); @@ -168,8 +168,8 @@ void Window::customInit() 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")) } + { QRhiShaderStage::Vertex, getShader(QLatin1String(":/shadowmap.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String(":/shadowmap.frag.qsb")) } }); d.shadowPs->setDepthTest(true); d.shadowPs->setDepthWrite(true); diff --git a/tests/manual/rhi/texuploads/texuploads.cpp b/tests/manual/rhi/texuploads/texuploads.cpp index 6576b763d5..dc20ffb1fc 100644 --- a/tests/manual/rhi/texuploads/texuploads.cpp +++ b/tests/manual/rhi/texuploads/texuploads.cpp @@ -124,8 +124,8 @@ void Window::customInit() qFatal("Failed to load shader pack (fragment)"); d.ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp index d2e1f99923..3f15881e2d 100644 --- a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp +++ b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp @@ -121,8 +121,8 @@ void TexturedCubeRenderer::initResources(QRhiRenderPassDescriptor *rp) QShader fs = getShader(QLatin1String(":/texture.frag.qsb")); Q_ASSERT(fs.isValid()); m_ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp b/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp index 40d9615aa1..250ae3a2ee 100644 --- a/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp +++ b/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp @@ -138,8 +138,8 @@ void TriangleOnCubeRenderer::initResources(QRhiRenderPassDescriptor *rp) QShader fs = getShader(QLatin1String(":/texture.frag.qsb")); Q_ASSERT(fs.isValid()); m_ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/triquadcube/trianglerenderer.cpp b/tests/manual/rhi/triquadcube/trianglerenderer.cpp index aac76d4110..0980acca49 100644 --- a/tests/manual/rhi/triquadcube/trianglerenderer.cpp +++ b/tests/manual/rhi/triquadcube/trianglerenderer.cpp @@ -112,8 +112,8 @@ void TriangleRenderer::initResources(QRhiRenderPassDescriptor *rp) QShader fs = getShader(QLatin1String(":/color.frag.qsb")); Q_ASSERT(fs.isValid()); m_ps->setShaderStages({ - { QRhiGraphicsShaderStage::Vertex, vs }, - { QRhiGraphicsShaderStage::Fragment, fs } + { QRhiShaderStage::Vertex, vs }, + { QRhiShaderStage::Fragment, fs } }); QRhiVertexInputLayout inputLayout; diff --git a/tests/manual/rhi/triquadcube/triquadcube.cpp b/tests/manual/rhi/triquadcube/triquadcube.cpp index 741e64be0a..8c7f5db042 100644 --- a/tests/manual/rhi/triquadcube/triquadcube.cpp +++ b/tests/manual/rhi/triquadcube/triquadcube.cpp @@ -171,6 +171,7 @@ void Window::customInit() qDebug("isFeatureSupported(NPOTTextureRepeat): %d", m_r->isFeatureSupported(QRhi::NPOTTextureRepeat)); qDebug("isFeatureSupported(RedOrAlpha8IsRed): %d", m_r->isFeatureSupported(QRhi::RedOrAlpha8IsRed)); qDebug("isFeatureSupported(ElementIndexUint): %d", m_r->isFeatureSupported(QRhi::ElementIndexUint)); + qDebug("isFeatureSupported(Compute): %d", m_r->isFeatureSupported(QRhi::Compute)); qDebug("Min 2D texture width/height: %d", m_r->resourceLimit(QRhi::TextureSizeMin)); qDebug("Max 2D texture width/height: %d", m_r->resourceLimit(QRhi::TextureSizeMax)); qDebug("Max color attachment count: %d", m_r->resourceLimit(QRhi::MaxColorAttachments)); -- cgit v1.2.3