Describes a vertex input binding. 更多...
| 头: | #include <QRhiVertexInputBinding> | 
| CMake: | 
								find_package(Qt6 REQUIRED COMPONENTS Gui)
								 target_link_libraries(mytarget PRIVATE Qt6::Gui)  | 
						
| qmake: | QT += gui | 
| Since: | Qt 6.6 | 
| enum | 分类 { PerVertex, PerInstance } | 
| QRhiVertexInputBinding () | |
| QRhiVertexInputBinding (quint32 stride , QRhiVertexInputBinding::Classification cls = PerVertex, quint32 stepRate = 1) | |
| QRhiVertexInputBinding::Classification | classification () const | 
| quint32 | instanceStepRate () const | 
| void | setClassification (QRhiVertexInputBinding::Classification c ) | 
| void | setInstanceStepRate (quint32 rate ) | 
| void | setStride (quint32 s ) | 
| quint32 | stride () const | 
| size_t | qHash (const QRhiVertexInputBinding & v , size_t seed = 0) | 
| bool | operator!= (const QRhiVertexInputBinding & a , const QRhiVertexInputBinding & b ) | 
| bool | operator== (const QRhiVertexInputBinding & a , const QRhiVertexInputBinding & b ) | 
Specifies the stride (in bytes, must be a multiple of 4), the classification and optionally the instance step rate.
As an example, assume a vertex shader with the following inputs:
layout(location = 0) in vec4 position; layout(location = 1) in vec2 texcoord;
						Now let's assume also that 3 component vertex positions
						
(x, y, z)
						
						and 2 component texture coordinates
						
(u, v)
						
						are provided in a non-interleaved format in a buffer (or separate buffers even). Defining two bindings could then be done like this:
					
QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ { 3 * sizeof(float) }, { 2 * sizeof(float) } });
Only the stride is interesting here since instancing is not used. The binding number is given by the index of the QRhiVertexInputBinding element in the bindings vector of the QRhiVertexInputLayout .
Once a graphics pipeline with this vertex input layout is bound, the vertex inputs could be set up like the following for drawing a cube with 36 vertices, assuming we have a single buffer with first the positions and then the texture coordinates:
const QRhiCommandBuffer::VertexInput vbufBindings[] = { { cubeBuf, 0 }, { cubeBuf, 36 * 3 * sizeof(float) } }; cb->setVertexInput(0, 2, vbufBindings);
						Note how the index defined by
						
startBinding + i
						
						,其中
						
i
						
						is the index in the second argument of
						
							setVertexInput
						
						(), matches the index of the corresponding entry in the
						
bindings
						
						vector of the
						
							QRhiVertexInputLayout
						
						.
					
注意: the stride must always be a multiple of 4.
注意: This is a RHI API with limited compatibility guarantees, see QRhi 了解细节。
另请参阅 QRhiCommandBuffer::setVertexInput ().
Describes the input data classification.
| 常量 | 值 | 描述 | 
|---|---|---|
								
QRhiVertexInputBinding::PerVertex
								
							 | 
							
								
0
								
							 | 
							Data is per-vertex | 
								
QRhiVertexInputBinding::PerInstance
								
							 | 
							
								
1
								
							 | 
							Data is per-instance | 
[constexpr noexcept]
						
						QRhiVertexInputBinding::
						
							QRhiVertexInputBinding
						
						()
						
					Constructs a default vertex input binding description.
Constructs a vertex input binding description with the specified stride , classification cls , and instance step rate stepRate .
注意: stepRate other than 1 is only supported when QRhi::CustomInstanceStepRate is reported to be supported.
Returns the input data classification.
另请参阅 setClassification ().
Returns the instance step rate.
另请参阅 setInstanceStepRate ().
Sets the input data classification c . By default this is set to PerVertex .
另请参阅 classification ().
Sets the instance step rate . By default this is set to 1.
另请参阅 instanceStepRate ().
Sets the stride to s .
另请参阅 stride ().
Returns the stride in bytes.
另请参阅 setStride ().
[noexcept]
						
						
							size_t
						
						
							qHash
						
						(const
						
							
								QRhiVertexInputBinding
							
						
						&
						
							v
						
						,
						
							size_t
						
						
							seed
						
						= 0)
						
					返回哈希值为 v ,使用 seed 做计算种子。
[noexcept]
						
						
							bool
						
						
							operator!=
						
						(const
						
							
								QRhiVertexInputBinding
							
						
						&
						
							a
						
						, const
						
							
								QRhiVertexInputBinding
							
						
						&
						
							b
						
						)
						
					
						返回
						
false
						
						if the values in the two
						
							QRhiVertexInputBinding
						
						对象
						
							a
						
						and
						
							b
						
						相等;否则返回
						
true
						
						.
					
[noexcept]
						
						
							bool
						
						
							operator==
						
						(const
						
							
								QRhiVertexInputBinding
							
						
						&
						
							a
						
						, const
						
							
								QRhiVertexInputBinding
							
						
						&
						
							b
						
						)
						
					
						返回
						
true
						
						if the values in the two
						
							QRhiVertexInputBinding
						
						对象
						
							a
						
						and
						
							b
						
						相等。