Commit 1b17a89b authored by Laszlo Agocs's avatar Laszlo Agocs

Add a NonFourAlignedEffectiveIndexBufferOffset feat.flag

sigh
parent 0b0a698e
......@@ -343,6 +343,12 @@ QT_BEGIN_NAMESPACE
supported. When reported as unsupported, uniform (constant) buffers must be
created as \l{QRhiBuffer::Dynamic}{Dynamic}. (which is recommended
regardless)
\value NonFourAlignedEffectiveIndexBufferOffset Indicates that effective
index buffer offsets (\c{indexOffset + firstIndex * indexComponentSize})
that are not 4 byte aligned are supported. When not supported, attempting
to issue a \l{QRhiCommandBuffer::drawIndexed()}{drawIndexed()} with a
non-aligned effective offset may lead to unspecified behavior.
*/
/*!
......@@ -3932,12 +3938,14 @@ void QRhiCommandBuffer::draw(quint32 vertexCount,
Records an indexed draw.
The number of vertices is specified in \a indexCount. \a firstIndex is the
base index. The actual offset in the index buffer is given by
base index. The effective offset in the index buffer is given by
\c{indexOffset + firstIndex * n} where \c n is 2 or 4 depending on the
index element type. \c indexOffset is specified in setVertexInput().
\note The actual offset in the index buffer must be 4-byte aligned with
some backends.
\note The effective offset in the index buffer must be 4 byte aligned with
some backends (for example, Metal). With these backends the
\l{QRhi::NonFourAlignedEffectiveIndexBufferOffset}{NonFourAlignedEffectiveIndexBufferOffset}
feature will be reported as not-supported.
For instanced drawing set \a instanceCount to a value other than 1. \a
firstInstance is the instance ID of the first instance to draw.
......
......@@ -1244,7 +1244,8 @@ public:
PrimitiveRestart,
GeometryShaders,
TessellationShaders,
NonDynamicUniformBuffers
NonDynamicUniformBuffers,
NonFourAlignedEffectiveIndexBufferOffset
};
enum BeginFrameFlag {
......
......@@ -397,6 +397,8 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
return false; // for now
case QRhi::NonDynamicUniformBuffers:
return false; // because UpdateSubresource cannot deal with this
case QRhi::NonFourAlignedEffectiveIndexBufferOffset:
return true;
default:
Q_UNREACHABLE();
return false;
......
......@@ -507,6 +507,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
return false;
case QRhi::NonDynamicUniformBuffers:
return true;
case QRhi::NonFourAlignedEffectiveIndexBufferOffset:
return true;
default:
Q_UNREACHABLE();
return false;
......
......@@ -514,6 +514,8 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
return false; // for now
case QRhi::NonDynamicUniformBuffers:
return true;
case QRhi::NonFourAlignedEffectiveIndexBufferOffset:
return false;
default:
Q_UNREACHABLE();
return false;
......
......@@ -3035,6 +3035,8 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::NonDynamicUniformBuffers:
return true;
case QRhi::NonFourAlignedEffectiveIndexBufferOffset:
return true;
default:
Q_UNREACHABLE();
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment