Package icyllis.arc3d.engine
Class VertexInputLayout
java.lang.Object
icyllis.arc3d.engine.VertexInputLayout
Describes the vertex input state of a graphics pipeline.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Describes a vertex or instance attribute.static class
A set of attributes that can iterated. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
Input rates other than 0 and 1 are not supported. -
Constructor Summary
ConstructorDescriptionVertexInputLayout
(VertexInputLayout.AttributeSet... attributeSets) Enable all attributes for each AttributeSet.VertexInputLayout
(VertexInputLayout.AttributeSet[] attributeSets, int[] masks) The constructor wraps the two given arrays (no copy), the caller should ensure the immutability. -
Method Summary
Modifier and TypeMethodDescriptionint
getAttributeCount
(int binding) Returns the number of used attributes (input variables).getAttributes
(int binding) Returns an iterator of used attributes.int
Returns the number of binding points.int
getInputRate
(int binding) Returns the input rate for the given binding point.int
getLocationCount
(int binding) Returns the number of used per-vertex attribute locations (slots).int
getStride
(int binding) Returns the number of bytes from one vertex to the next vertex, including paddings.
-
Field Details
-
INPUT_RATE_VERTEX
public static final int INPUT_RATE_VERTEXInput rates other than 0 and 1 are not supported.- See Also:
-
INPUT_RATE_INSTANCE
public static final int INPUT_RATE_INSTANCE- See Also:
-
-
Constructor Details
-
VertexInputLayout
Enable all attributes for each AttributeSet.- See Also:
-
VertexInputLayout
public VertexInputLayout(@Nonnull VertexInputLayout.AttributeSet[] attributeSets, @Nullable int[] masks) The constructor wraps the two given arrays (no copy), the caller should ensure the immutability.Each AttributeSet contains all attributes for the corresponding binding point. It may be shared across
VertexInputLayout
instances, then the masks array is used to control which attributes of the corresponding AttributeSet need to be used. A binding point can be empty but that is discouraged.E.g. if you want the 0, 2, 3 attributes are enabled, then mask is 0b1101.
-
-
Method Details
-
getBindingCount
public int getBindingCount()Returns the number of binding points. -
getAttributeCount
public int getAttributeCount(int binding) Returns the number of used attributes (input variables). Note: attribute of a matrix type counts as just one.- See Also:
-
getLocationCount
public int getLocationCount(int binding) Returns the number of used per-vertex attribute locations (slots). An attribute (variable) may take up multiple consecutive locations. The max number of locations matches the max number of attributes inCaps
.- See Also:
-
getStride
public int getStride(int binding) Returns the number of bytes from one vertex to the next vertex, including paddings. A common practice is to populate the vertex's memory using an implicit array of structs. In this case, it is best to assert that: stride == sizeof(struct). -
getInputRate
public int getInputRate(int binding) Returns the input rate for the given binding point. 0 means per-vertex data, 1 means per-instance data. -
getAttributes
Returns an iterator of used attributes. It's safe to call even if there's no attribute. The iterator handles hides two pieces of complexity:- It skips unused attributes (see mask in constructor).
- It always returns an attribute with a known offset.
-