summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-05-19 19:30:53 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-05-31 17:16:57 +0200
commit51c22a1f51e2f91289c938be7754f957c9bfa47e (patch)
tree58eea1c4aeb83f4ee2ede516f321624ab5558181 /src/gui/rhi/qrhi_p.h
parent5eab5d62530f351307a01ca57af964e5c506079c (diff)
rhi: Add support for 3D textures
Supported on OpenGL (and ES) 3.0+ and everywhere else. Can also be a render target, targeting a single slice at a time. Can be mipmapped, cannot be multisample. Reading back a given slice from a 3D texture is left as a future exercise, for now it is documented to be not supported. Upload is going to be limited to one slice in one upload entry, just like we specify one face or one miplevel for cubemap and mipmapped textures. This also involves some welcome hardening of how texture subresources are described internally: as we no longer can count on a layer index between 0..5 (as is the case with cubemaps), simply arrays with MAX_LAYER==6 are no longer sufficient. Switch to sufficiently dynamic data structures where applicable. On Vulkan rendering to a slice needs Vulkan 1.1 (and 1.1 enabled on the VkInstance). Task-number: QTBUG-89703 Change-Id: Ide6c20124ec9201d94ffc339dd479cd1ece777b0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p.h')
-rw-r--r--src/gui/rhi/qrhi_p.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index c915f8df0d..c2a09b7edf 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -753,7 +753,8 @@ public:
UsedWithGenerateMips = 1 << 6,
UsedWithLoadStore = 1 << 7,
UsedAsCompressedAtlas = 1 << 8,
- ExternalOES = 1 << 9
+ ExternalOES = 1 << 9,
+ ThreeDimensional = 1 << 10
};
Q_DECLARE_FLAGS(Flags, Flag)
@@ -819,6 +820,9 @@ public:
QSize pixelSize() const { return m_pixelSize; }
void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
+ int depth() const { return m_depth; }
+ void setDepth(int depth) { m_depth = depth; }
+
Flags flags() const { return m_flags; }
void setFlags(Flags f) { m_flags = f; }
@@ -831,10 +835,11 @@ public:
virtual void setNativeLayout(int layout);
protected:
- QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_,
+ QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
int sampleCount_, Flags flags_);
Format m_format;
QSize m_pixelSize;
+ int m_depth;
int m_sampleCount;
Flags m_flags;
};
@@ -1540,7 +1545,9 @@ public:
ReadBackAnyTextureFormat,
PipelineCacheDataLoadSave,
ImageDataStride,
- RenderBufferImport
+ RenderBufferImport,
+ ThreeDimensionalTextures,
+ RenderTo3DTextureSlice
};
enum BeginFrameFlag {
@@ -1600,6 +1607,11 @@ public:
int sampleCount = 1,
QRhiTexture::Flags flags = {});
+ QRhiTexture *newTexture(QRhiTexture::Format format,
+ int width, int height, int depth,
+ int sampleCount = 1,
+ QRhiTexture::Flags flags = {});
+
QRhiSampler *newSampler(QRhiSampler::Filter magFilter,
QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
@@ -1646,8 +1658,7 @@ public:
QRhiProfiler *profiler();
- static const int MAX_LAYERS = 6; // cubemaps only
- static const int MAX_LEVELS = 16; // a width and/or height of 65536 should be enough for everyone
+ static const int MAX_MIP_LEVELS = 16; // a width and/or height of 65536 should be enough for everyone
void releaseCachedResources();