51 #include "../shared/examplefw.h"
52 #include "../shared/cube.h"
53 #include "../shared/dds_bc1.h"
72 qFatal(
"This backend does not support BC1");
101 d.ps->setDepthTest(
true);
102 d.ps->setDepthWrite(
true);
110 qFatal(
"Failed to load shader pack (vertex)");
113 qFatal(
"Failed to load shader pack (fragment)");
115 d.ps->setShaderStages({
122 { 3 *
sizeof(float) },
123 { 2 *
sizeof(float) }
130 d.ps->setVertexInputLayout(inputLayout);
131 d.ps->setShaderResourceBindings(
d.srb);
132 d.ps->setRenderPassDescriptor(
m_rp);
163 u->uploadStaticBuffer(
d.vbuf, cube);
165 u->updateDynamicBuffer(
d.ubuf, 64, 4, &flip);
167 if (!
d.compressedData.isEmpty()) {
169 for (
int i = 0;
i <
d.compressedData.count(); ++
i) {
175 u->uploadTexture(
d.tex,
desc);
176 d.compressedData.clear();
181 mvp.
rotate(
d.rotation, 0, 1, 0);
182 u->updateDynamicBuffer(
d.ubuf, 0, 64, mvp.
constData());
185 const QSize outputSizeInPixels =
m_sc->currentPixelSize();
189 cb->setGraphicsPipeline(
d.ps);
190 cb->setViewport({ 0, 0, float(outputSizeInPixels.
width()), float(outputSizeInPixels.
height()) });
191 cb->setShaderResources();
194 {
d.vbuf,
quint32(36 * 3 *
sizeof(
float)) }
196 cb->setVertexInput(0, 2, vbufBindings);
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
The QByteArrayList class provides a list of byte arrays.
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
QPair< QRhiBuffer *, quint32 > VertexInput
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
QRhiShaderResourceBindings * newShaderResourceBindings()
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
QRhiSampler * newSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode addressU, QRhiSampler::AddressMode addressV, QRhiSampler::AddressMode addressW=QRhiSampler::Repeat)
QRhiGraphicsPipeline * newGraphicsPipeline()
int mipLevelsForSize(const QSize &size) const
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
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
const_iterator cbegin() const noexcept
const_iterator cend() const noexcept
std::unique_ptr< QRhiSwapChain > m_sc
std::unique_ptr< QRhiRenderPassDescriptor > m_rp
virtual void customRender()
virtual void customInit()
QByteArrayList compressedData
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * ps
QShader getShader(const QString &name)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)