summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhinull.cpp
diff options
context:
space:
mode:
authorBen Fletcher <ben.fletcher@me.com>2022-10-30 12:19:38 -0700
committerBen Fletcher <ben.fletcher@me.com>2022-11-15 11:36:18 -0800
commit85a1663eb15cd85f91fe1f6dd924588d9cc7c2a8 (patch)
treed04ee874657d709c9815b561acf1074d8e9f22a5 /src/gui/rhi/qrhinull.cpp
parenta47c7a98264c85e9ff0bc3e5a42b9554dd20576e (diff)
RHI: Add support for 1D textures
Support for 1D textures on Vulkan, OpenGL, Metal, and D3D. Change-Id: Ie74ec103da9cfcbf83fa78588cf8cfc1bd6e104f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhinull.cpp')
-rw-r--r--src/gui/rhi/qrhinull.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index 88afb004f7..ec1b5aa64a 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -661,7 +661,9 @@ bool QNullTexture::create()
const bool is3D = m_flags.testFlag(ThreeDimensional);
const bool isArray = m_flags.testFlag(TextureArray);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
- QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
+ const bool is1D = m_flags.testFlags(OneDimensional);
+ QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
m_depth = qMax(1, m_depth);
const int mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
m_arraySize = qMax(0, m_arraySize);