51 #define EXAMPLEFW_PREINIT
52 #include "../shared/examplefw.h"
53 #include "../shared/cube.h"
54 #include <QRandomGenerator>
89 d.releasePool <<
d.vbuf;
91 d.initialUpdates->uploadStaticBuffer(
d.vbuf, cube);
96 d.releasePool <<
d.ubuf[
i];
99 d.releasePool <<
d.srb[
i];
100 d.srb[
i]->setBindings({
107 d.releasePool <<
d.ps;
108 d.ps->setShaderStages({
114 { 3 *
sizeof(float) },
119 d.ps->setVertexInputLayout(inputLayout);
120 d.ps->setShaderResourceBindings(
d.srb[0]);
121 d.ps->setRenderPassDescriptor(
m_rp);
126 d.instData[
i].x = rgen->
bounded(8000) / 100.0f - 40.0f;
127 d.instData[
i].y = rgen->
bounded(8000) / 100.0f - 40.0f;
128 d.instData[
i].z = rgen->
bounded(100) / -4.0f;
130 d.instData[
i].g = 0.0f;
131 d.instData[
i].b = 0.0f;
138 d.releasePool.clear();
143 const QSize outputSizeInPixels =
m_sc->currentPixelSize();
146 if (
d.initialUpdates) {
147 u =
d.initialUpdates;
148 d.initialUpdates =
nullptr;
152 char *
p =
d.ubuf[
i]->beginFullDynamicBufferUpdateForCurrentFrame();
162 memcpy(
p + 64, &
d.instData[
i].x, 4);
163 memcpy(
p + 68, &
d.instData[
i].y, 4);
164 memcpy(
p + 72, &
d.instData[
i].z, 4);
170 memcpy(
p + 80, &
d.instData[
i].r, 4);
171 memcpy(
p + 84, &
d.instData[
i].g, 4);
172 memcpy(
p + 88, &
d.instData[
i].b, 4);
174 d.ubuf[
i]->endFullDynamicBufferUpdateForCurrentFrame();
179 cb->setGraphicsPipeline(
d.ps);
181 cb->setViewport({ 0, 0, float(outputSizeInPixels.
width()), float(outputSizeInPixels.
height()) });
182 cb->setShaderResources(
d.srb[
i]);
186 cb->setVertexInput(0, 1, vbufBinding);
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void rotate(float angle, const QVector3D &vector)
void scale(const QVector3D &vector)
const float * constData() const
The QRandomGenerator class allows one to obtain random values from a high-quality Random Number Gener...
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
double bounded(double highest)
QPair< QRhiBuffer *, quint32 > VertexInput
@ DoNotTrackResourcesForCompute
QRhiShaderResourceBindings * newShaderResourceBindings()
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
QRhiGraphicsPipeline * newGraphicsPipeline()
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf)
The QSize class defines the size of a two-dimensional object using integer point precision.
constexpr int height() const noexcept
constexpr int width() const noexcept
std::unique_ptr< QRhiSwapChain > m_sc
std::unique_ptr< QRhiRenderPassDescriptor > m_rp
virtual void customRender()
virtual void customInit()
qDeleteAll(list.begin(), list.end())
QShader getShader(const QString &name)
QRhiBuffer * ubuf[INSTANCE_COUNT]
QList< QRhiResource * > releasePool
QRhiGraphicsPipeline * ps
struct @919::@920 instData[INSTANCE_COUNT]
QRhiResourceUpdateBatch * initialUpdates
QRhiShaderResourceBindings * srb[INSTANCE_COUNT]
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)