Unverified Commit e004c012 authored by Laszlo Agocs's avatar Laszlo Agocs Committed by GitHub
Browse files

Merge pull request #4 from alpqr/unstructify

Eliminate most of the structs, inner structs, and inline ctors
parents b04ccdb2 1c2a4180
......@@ -47,7 +47,3 @@ shaders, with the only difference being in the QWindow setup.
Additionally, check
https://github.com/alpqr/qvk6/blob/master/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp
for a single-source, cross-API example of drawing a triangle.
The https://github.com/alpqr/qvk6/tree/master/examples/rhi/multiwindow_threaded demo, it being a minimal reimplementation of
QSGThreadedRenderLoop, represents a milestone in the sense that it proves that implementing the traditional threaded Qt Quick
rendering model is possible with QRhi as well.
......@@ -177,13 +177,13 @@ void Window::customRender()
u->updateDynamicBuffer(d.ubuf, 64, 4, &flip);
}
if (!d.compressedData.isEmpty()) {
QRhiTextureUploadDescription desc;
QRhiTextureUploadDescription::Layer layer;
QVector<QRhiTextureMipLevel> mipImages;
for (int i = 0; i < d.compressedData.count(); ++i) {
QRhiTextureUploadDescription::Layer::MipLevel image(d.compressedData[i]);
layer.mipImages.append(image);
QRhiTextureMipLevel image(d.compressedData[i]);
mipImages.append(image);
}
desc.layers.append(layer);
QRhiTextureLayer layer(mipImages);
QRhiTextureUploadDescription desc({ layer });
u->uploadTexture(d.tex, desc);
d.compressedData.clear();
}
......
......@@ -182,27 +182,23 @@ void Window::customRender()
}
if (!d.compressedData.isEmpty()) {
{
QRhiTextureUploadDescription desc;
QRhiTextureUploadDescription::Layer layer;
QRhiTextureUploadDescription::Layer::MipLevel image(d.compressedData[0]);
layer.mipImages.append(image);
desc.layers.append(layer);
QRhiTextureMipLevel image(d.compressedData[0]);
QRhiTextureLayer layer({ image });
QRhiTextureUploadDescription desc({ layer });
u->uploadTexture(d.tex, desc);
d.compressedData.clear();
}
// now exercise uploading a smaller compressed image into the same texture
{
QRhiTextureUploadDescription desc;
QRhiTextureUploadDescription::Layer layer;
QRhiTextureUploadDescription::Layer::MipLevel image(d.compressedData2[0]);
QRhiTextureMipLevel image(d.compressedData2[0]);
// positions and sizes must be multiples of 4 here (for BC1)
image.destinationTopLeft = QPoint(16, 32);
image.setDestinationTopLeft(QPoint(16, 32));
// the image is smaller than the subresource size (224x64 vs
// 256x256) so the size must be specified manually
image.sourceSize = QSize(224, 64);
layer.mipImages.append(image);
desc.layers.append(layer);
image.setSourceSize(QSize(224, 64));
QRhiTextureLayer layer({ image });
QRhiTextureUploadDescription desc({ layer });
u->uploadTexture(d.tex, desc);
d.compressedData2.clear();
}
......
......@@ -82,14 +82,15 @@ void Window::customInit()
QRhiTextureUploadDescription desc;
QImage img = QImage(":/c.png").mirrored().convertToFormat(QImage::Format_RGBA8888); // just use the same image for all faces for now
auto texLayer = QRhiTextureUploadDescription::Layer({ QRhiTextureUploadDescription::Layer::MipLevel(img) });
desc.layers
<< texLayer // +X
<< texLayer // -X
<< texLayer // +Y
<< texLayer // -Y
<< texLayer // +Z
<< texLayer; // -Z
QRhiTextureLayer texLayer({ QRhiTextureMipLevel(img) });
desc.setLayers({
texLayer, // +X
texLayer, // -X
texLayer, // +Y
texLayer, // -Y
texLayer, // +Z
texLayer // -Z
});
d.initialUpdates->uploadTexture(d.tex, desc);
d.sampler = m_r->newSampler(QRhiSampler::Linear, QRhiSampler::Linear, QRhiSampler::None,
......
......@@ -184,17 +184,12 @@ void Window::customRender()
// Partially change the texture.
if (d.testStage == 1) {
QRhiTextureUploadDescription desc;
QRhiTextureUploadDescription::Layer layer;
QRhiTextureUploadDescription::Layer::MipLevel mipDesc;
mipDesc.image = d.customImage;
QRhiTextureMipLevel mipDesc(d.customImage);
// The image here is smaller than the original. Use a non-zero position
// to make it more interesting.
mipDesc.destinationTopLeft = QPoint(100, 20);
layer.mipImages.append(mipDesc);
desc.layers.append(layer);
mipDesc.setDestinationTopLeft(QPoint(100, 20));
QRhiTextureLayer layer({ mipDesc });
QRhiTextureUploadDescription desc({ layer });
u->uploadTexture(d.tex, desc);
}
......@@ -209,19 +204,18 @@ void Window::customRender()
empty.fill(Qt::blue);
u->uploadTexture(d.newTex, empty);
QRhiTextureCopyDescription desc;
// Copy the left-half of tex to the right-half of newTex, while
// leaving the left-half of newTex blue. Keep a 20 pixel gap at
// the top.
desc.sourceTopLeft = QPoint(0, 20);
desc.pixelSize = QSize(sz.width() / 2, sz.height() - 20);
desc.destinationTopLeft = QPoint(sz.width() / 2, 20);
QRhiTextureCopyDescription desc;
desc.setSourceTopLeft(QPoint(0, 20));
desc.setPixelSize(QSize(sz.width() / 2, sz.height() - 20));
desc.setDestinationTopLeft(QPoint(sz.width() / 2, 20));
u->copyTexture(d.newTex, d.tex, desc);
// Now replace d.tex with d.newTex as the shader resource.
auto bindings = d.srb->bindings();
bindings[1].stex.tex = d.newTex; // see customInit, this was d.tex originally
bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.newTex, d.sampler);
d.srb->setBindings(bindings);
// "rebuild", whatever that means for a given backend. This srb is
// already live as the ps in the setGraphicsPipeline references it,
......@@ -235,17 +229,12 @@ void Window::customRender()
// Now again upload customImage but this time only a part of it.
if (d.testStage == 5) {
QRhiTextureUploadDescription desc;
QRhiTextureUploadDescription::Layer layer;
QRhiTextureUploadDescription::Layer::MipLevel mipDesc;
mipDesc.image = d.customImage;
mipDesc.destinationTopLeft = QPoint(10, 120);
mipDesc.sourceSize = QSize(50, 40);
mipDesc.sourceTopLeft = QPoint(20, 10);
layer.mipImages.append(mipDesc);
desc.layers.append(layer);
QRhiTextureMipLevel mipDesc(d.customImage);
mipDesc.setDestinationTopLeft(QPoint(10, 120));
mipDesc.setSourceSize(QSize(50, 40));
mipDesc.setSourceTopLeft(QPoint(20, 10));
QRhiTextureLayer layer({ mipDesc });
QRhiTextureUploadDescription desc({ layer });
u->uploadTexture(d.newTex, desc);
}
......@@ -275,7 +264,7 @@ void Window::customRender()
// switch to showing d.importedTex
auto bindings = d.srb->bindings();
bindings[1].stex.tex = d.importedTex;
bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.importedTex, d.sampler);
d.srb->setBindings(bindings);
d.srb->build();
} else {
......
......@@ -193,17 +193,19 @@ void TexturedCubeRenderer::queueResourceUpdates(QRhiResourceUpdateBatch *resourc
if (!m_image.isNull()) {
if (MIPMAP) {
QRhiTextureUploadDescription desc;
desc.layers.append(QRhiTextureUploadDescription::Layer());
QRhiTextureLayer layer;
if (!AUTOGENMIPMAP) {
// the ghetto mipmap generator...
QVector<QRhiTextureMipLevel> mipImages;
for (int i = 0, ie = m_r->mipLevelsForSize(m_image.size()); i != ie; ++i) {
QImage image = m_image.scaled(m_r->sizeForMipLevel(i, m_image.size()));
desc.layers[0].mipImages.push_back({ image });
mipImages.append(QRhiTextureMipLevel(image));
}
layer.setMipImages(mipImages);
} else {
desc.layers[0].mipImages.push_back({ m_image });
layer.setMipImages({ { m_image } });
}
QRhiTextureUploadDescription desc({ layer });
resourceUpdates->uploadTexture(m_tex, desc);
if (AUTOGENMIPMAP)
resourceUpdates->generateMips(m_tex);
......
This diff is collapsed.
......@@ -59,13 +59,14 @@ class QRhiCommandBuffer;
class QRhiResourceUpdateBatch;
class QRhiResourceUpdateBatchPrivate;
class QRhiProfiler;
class QRhiShaderResourceBindingPrivate;
class Q_RHI_EXPORT QRhiColorClearValue
{
public:
QRhiColorClearValue() : m_rgba(0, 0, 0, 1) { }
explicit QRhiColorClearValue(const QVector4D &c) : m_rgba(c) { }
QRhiColorClearValue(float r, float g, float b, float a) : m_rgba(r, g, b, a) { }
QRhiColorClearValue();
explicit QRhiColorClearValue(const QVector4D &c);
QRhiColorClearValue(float r, float g, float b, float a);
QVector4D rgba() const { return m_rgba; }
void setRgba(const QVector4D &c) { m_rgba = c; }
......@@ -79,8 +80,8 @@ Q_DECLARE_TYPEINFO(QRhiColorClearValue, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiDepthStencilClearValue
{
public:
QRhiDepthStencilClearValue() : m_d(1), m_s(0) { }
QRhiDepthStencilClearValue(float d, quint32 s) : m_d(d), m_s(s) { }
QRhiDepthStencilClearValue();
QRhiDepthStencilClearValue(float d, quint32 s);
float depthClearValue() const { return m_d; }
void setDepthClearValue(float d) { m_d = d; }
......@@ -98,12 +99,8 @@ Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiViewport
{
public:
QRhiViewport()
: m_rect(0, 0, 1280, 720), m_minDepth(0), m_maxDepth(1)
{ }
QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f)
: m_rect(x, y, w, h), m_minDepth(minDepth), m_maxDepth(maxDepth)
{ }
QRhiViewport();
QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f);
QVector4D viewport() const { return m_rect; }
void setViewport(const QVector4D &v) { m_rect = v; }
......@@ -125,10 +122,8 @@ Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiScissor
{
public:
QRhiScissor() { }
QRhiScissor(int x, int y, int w, int h)
: m_rect(x, y, w, h)
{ }
QRhiScissor();
QRhiScissor(int x, int y, int w, int h);
QVector4D scissor() const { return m_rect; }
void setScissor(const QVector4D &v) { m_rect = v; }
......@@ -147,10 +142,8 @@ public:
PerInstance
};
QRhiVertexInputBinding() { }
QRhiVertexInputBinding(quint32 stride, Classification cls = PerVertex, int stepRate = 1)
: m_stride(stride), m_classification(cls), m_instanceStepRate(stepRate)
{ }
QRhiVertexInputBinding();
QRhiVertexInputBinding(quint32 stride, Classification cls = PerVertex, int stepRate = 1);
quint32 stride() const { return m_stride; }
void setStride(quint32 s) { m_stride = s; }
......@@ -165,6 +158,7 @@ private:
quint32 m_stride;
Classification m_classification;
int m_instanceStepRate;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE);
......@@ -182,10 +176,8 @@ public:
UNormByte
};
QRhiVertexInputAttribute() { }
QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset)
: m_binding(binding), m_location(location), m_format(format), m_offset(offset)
{ }
QRhiVertexInputAttribute();
QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset);
int binding() const { return m_binding; }
void setBinding(int b) { m_binding = b; }
......@@ -204,6 +196,7 @@ private:
int m_location;
Format m_format;
quint32 m_offset;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
......@@ -211,6 +204,8 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiVertexInputLayout
{
public:
QRhiVertexInputLayout();
QVector<QRhiVertexInputBinding> bindings() const { return m_bindings; }
void setBindings(const QVector<QRhiVertexInputBinding> &v) { m_bindings = v; }
......@@ -220,6 +215,7 @@ public:
private:
QVector<QRhiVertexInputBinding> m_bindings;
QVector<QRhiVertexInputAttribute> m_attributes;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE);
......@@ -234,10 +230,8 @@ public:
TessellationEvaluation
};
QRhiGraphicsShaderStage() { }
QRhiGraphicsShaderStage(Type type, const QBakedShader &shader)
: m_type(type), m_shader(shader)
{ }
QRhiGraphicsShaderStage();
QRhiGraphicsShaderStage(Type type, const QBakedShader &shader);
Type type() const { return m_type; }
void setType(Type t) { m_type = t; }
......@@ -248,12 +242,14 @@ public:
private:
Type m_type;
QBakedShader m_shader;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiGraphicsShaderStage, Q_MOVABLE_TYPE);
struct Q_RHI_EXPORT QRhiShaderResourceBinding
class Q_RHI_EXPORT QRhiShaderResourceBinding
{
public:
enum Type {
UniformBuffer,
SampledTexture
......@@ -267,37 +263,29 @@ struct Q_RHI_EXPORT QRhiShaderResourceBinding
};
Q_DECLARE_FLAGS(StageFlags, StageFlag)
static QRhiShaderResourceBinding uniformBuffer(int binding_, StageFlags stage_, QRhiBuffer *buf_);
static QRhiShaderResourceBinding uniformBuffer(int binding_, StageFlags stage_, QRhiBuffer *buf_, int offset_, int size_);
static QRhiShaderResourceBinding sampledTexture(int binding_, StageFlags stage_, QRhiTexture *tex_, QRhiSampler *sampler_);
int binding;
StageFlags stage;
Type type;
struct UniformBufferData {
QRhiBuffer *buf;
int offset;
int maybeSize;
};
struct SampledTextureData {
QRhiTexture *tex;
QRhiSampler *sampler;
};
union {
UniformBufferData ubuf;
SampledTextureData stex;
};
QRhiShaderResourceBinding();
QRhiShaderResourceBinding(const QRhiShaderResourceBinding &other);
QRhiShaderResourceBinding &operator=(const QRhiShaderResourceBinding &other);
~QRhiShaderResourceBinding();
void detach();
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf);
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size);
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler);
private:
QRhiShaderResourceBindingPrivate *d;
friend class QRhiShaderResourceBindingPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiColorAttachment
{
public:
QRhiColorAttachment() { }
QRhiColorAttachment(QRhiTexture *texture) : m_texture(texture) { }
QRhiColorAttachment(QRhiRenderBuffer *renderBuffer) : m_renderBuffer(renderBuffer) { }
QRhiColorAttachment();
QRhiColorAttachment(QRhiTexture *texture);
QRhiColorAttachment(QRhiRenderBuffer *renderBuffer);
QRhiTexture *texture() const { return m_texture; }
void setTexture(QRhiTexture *tex) { m_texture = tex; }
......@@ -323,13 +311,12 @@ public:
private:
QRhiTexture *m_texture = nullptr;
QRhiRenderBuffer *m_renderBuffer = nullptr;
int m_layer = 0;
int m_level = 0;
QRhiTexture *m_resolveTexture = nullptr;
int m_resolveLayer = 0;
int m_resolveLevel = 0;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiColorAttachment, Q_MOVABLE_TYPE);
......@@ -337,16 +324,10 @@ Q_DECLARE_TYPEINFO(QRhiColorAttachment, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiTextureRenderTargetDescription
{
public:
QRhiTextureRenderTargetDescription()
{ }
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment)
{ m_colorAttachments.append(colorAttachment); }
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiRenderBuffer *depthStencilBuffer)
: m_depthStencilBuffer(depthStencilBuffer)
{ m_colorAttachments.append(colorAttachment); }
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiTexture *depthTexture)
: m_depthTexture(depthTexture)
{ m_colorAttachments.append(colorAttachment); }
QRhiTextureRenderTargetDescription();
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment);
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiRenderBuffer *depthStencilBuffer);
QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiTexture *depthTexture);
QVector<QRhiColorAttachment> colorAttachments() const { return m_colorAttachments; }
void setColorAttachments(const QVector<QRhiColorAttachment> &att) { m_colorAttachments = att; }
......@@ -361,63 +342,135 @@ private:
QVector<QRhiColorAttachment> m_colorAttachments;
QRhiRenderBuffer *m_depthStencilBuffer = nullptr;
QRhiTexture *m_depthTexture = nullptr;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiTextureRenderTargetDescription, Q_MOVABLE_TYPE);
struct Q_RHI_EXPORT QRhiTextureUploadDescription
class Q_RHI_EXPORT QRhiTextureMipLevel
{
struct Q_RHI_EXPORT Layer {
struct Q_RHI_EXPORT MipLevel {
MipLevel() { }
MipLevel(const QImage &image_) : image(image_) { }
MipLevel(const QByteArray &compressedData_) : compressedData(compressedData_) { }
QImage image;
QByteArray compressedData;
QPoint destinationTopLeft;
QSize sourceSize;
QPoint sourceTopLeft;
};
Layer() { }
Layer(const QVector<MipLevel> &mipImages_) : mipImages(mipImages_) { }
QVector<MipLevel> mipImages;
};
public:
QRhiTextureMipLevel();
QRhiTextureMipLevel(const QImage &image);
QRhiTextureMipLevel(const QByteArray &compressedData);
QImage image() const { return m_image; }
void setImage(const QImage &image) { m_image = image; }
QByteArray compressedData() const { return m_compressedData; }
void setCompressedData(const QByteArray &data) { m_compressedData = data; }
QPoint destinationTopLeft() const { return m_destinationTopLeft; }
void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
QSize sourceSize() const { return m_sourceSize; }
void setSourceSize(const QSize &size) { m_sourceSize = size; }
QPoint sourceTopLeft() const { return m_sourceTopLeft; }
void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
private:
QImage m_image;
QByteArray m_compressedData;
QPoint m_destinationTopLeft;
QSize m_sourceSize;
QPoint m_sourceTopLeft;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiTextureMipLevel, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiTextureLayer
{
public:
QRhiTextureLayer();
QRhiTextureLayer(const QVector<QRhiTextureMipLevel> &mipImages);
QVector<QRhiTextureMipLevel> mipImages() const { return m_mipImages; }
void setMipImages(const QVector<QRhiTextureMipLevel> &images) { m_mipImages = images; }
private:
QVector<QRhiTextureMipLevel> m_mipImages;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiTextureLayer, Q_MOVABLE_TYPE);
class Q_RHI_EXPORT QRhiTextureUploadDescription
{
public:
QRhiTextureUploadDescription();
QRhiTextureUploadDescription(const QVector<QRhiTextureLayer> &layers);
QRhiTextureUploadDescription() { }
QRhiTextureUploadDescription(const QVector<Layer> &layers_) : layers(layers_) { }
QVector<Layer> layers;
QVector<QRhiTextureLayer> layers() const { return m_layers; }
void setLayers(const QVector<QRhiTextureLayer> &layers) { m_layers = layers; }
private:
QVector<QRhiTextureLayer> m_layers;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiTextureUploadDescription::Layer::MipLevel, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiTextureUploadDescription::Layer, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiTextureUploadDescription, Q_MOVABLE_TYPE);
struct Q_RHI_EXPORT QRhiTextureCopyDescription
class Q_RHI_EXPORT QRhiTextureCopyDescription
{
QSize pixelSize;
public:
QRhiTextureCopyDescription();
int sourceLayer = 0;
int sourceLevel = 0;
QPoint sourceTopLeft;
QSize pixelSize() const { return m_pixelSize; }
void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
int destinationLayer = 0;
int destinationLevel = 0;
QPoint destinationTopLeft;
int sourceLayer() const { return m_sourceLayer; }
void setSourceLayer(int layer) { m_sourceLayer = layer; }
int sourceLevel() const { return m_sourceLevel; }
void setSourceLevel(int level) { m_sourceLevel = level; }
QPoint sourceTopLeft() const { return m_sourceTopLeft; }
void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
int destinationLayer() const { return m_destinationLayer; }
void setDestinationLayer(int layer) { m_destinationLayer = layer; }
int destinationLevel() const { return m_destinationLevel; }
void setDestinationLevel(int level) { m_destinationLevel = level; }
QPoint destinationTopLeft() const { return m_destinationTopLeft; }
void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
private:
QSize m_pixelSize;
int m_sourceLayer = 0;
int m_sourceLevel = 0;
QPoint m_sourceTopLeft;
int m_destinationLayer = 0;
int m_destinationLevel = 0;
QPoint m_destinationTopLeft;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiTextureCopyDescription, Q_MOVABLE_TYPE);
struct Q_RHI_EXPORT QRhiReadbackDescription
class Q_RHI_EXPORT QRhiReadbackDescription
{
QRhiReadbackDescription() { }
QRhiReadbackDescription(QRhiTexture *texture_) : texture(texture_) { }
public:
QRhiReadbackDescription();
QRhiReadbackDescription(QRhiTexture *texture);
QRhiTexture *texture() const { return m_texture; }
void setTexture(QRhiTexture *tex) { m_texture = tex; }
int layer() const { return m_layer; }
void setLayer(int layer) { m_layer = layer; }
QRhiTexture *texture = nullptr;
int layer = 0;
int level = 0;
int level() const { return m_level; }
void setLevel(int level) { m_level = level; }
private:
QRhiTexture *m_texture = nullptr;
int m_layer = 0;
int m_level = 0;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
Q_DECLARE_TYPEINFO(QRhiReadbackDescription, Q_MOVABLE_TYPE);
......@@ -476,7 +529,7 @@ protected:
Type m_type;
UsageFlags m_usage;
int m_size;
void *m_reserved;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;