PipelineKey
final class PipelineKey
Package: dev.joid.lib.bridge.render.state · Module: core · Source: PipelineKey.java
The part of the render state that a pipeline object bakes in, as a value that a backend uses as the key of its pipeline cache.
Description
Section titled “Description”An API with immutable pipelines can bake the blending, the depth, the culling, the color writes and the topology into them; the Vulkan backend sets the culling, the depth and the stencil as dynamic states, and still keys its cache on the whole key.
PipelineKey gathers those values for one draw, normalized so that equal pipelines get equal keys: a disabled blending is always BlendState.DISABLED, and the depth writes are off without the depth test.
Two keys with the same values are equal and have the same hash.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
PipelineKey | of(IShader shader, RenderState state, Primitive primitive) factory | Builds the key of a draw of primitive with shader under state. |
PipelineKey | stencil(IShader shader, RenderState state, Primitive primitive) factory | Builds the key of the WRITE pass of StencilEmulation: no blending, no depth test nor depth write, color writes on, and the culling of the state. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
IShader | getShader() | Returns the shader of the draw. |
BlendState | getBlend() | Returns the blending, BlendState.DISABLED when the state does not blend. |
boolean | isColorWrite() | If true, the draw writes the color channels. |
boolean | isDepthTest() | If true, the draw compares its depth with the stored one. |
boolean | isDepthWrite() | If true, the draw writes its depth; always false without the depth test. |
boolean | isCull() | If true, the back faces are not drawn. |
Primitive | getPrimitive() | Returns the topology of the draw: segments or triangles. |
boolean | isStencil() | If true, the key belongs to the WRITE pass of the stencil emulation, built by stencil(...). |
boolean | equals(Object other) | If true, the other object is of the same class with the same shader, blending and switches. |
int | hashCode() | Returns a hash of the values that equals compares. |
Creation details
Section titled “Creation details”PipelineKey of(IShader shader, RenderState state, Primitive primitive) factory
Builds the key of a draw of primitive with shader under state.
stencil
Section titled “stencil”PipelineKey stencil(IShader shader, RenderState state, Primitive primitive) factory
Builds the key of the WRITE pass of StencilEmulation: no blending, no depth test nor depth write, color writes on, and the culling of the state.
Method details
Section titled “Method details”getShader
Section titled “getShader”IShader getShader()
Returns the shader of the draw.
getBlend
Section titled “getBlend”BlendState getBlend()
Returns the blending, BlendState.DISABLED when the state does not blend.
isColorWrite
Section titled “isColorWrite”boolean isColorWrite()
If true, the draw writes the color channels.
isDepthTest
Section titled “isDepthTest”boolean isDepthTest()
If true, the draw compares its depth with the stored one.
isDepthWrite
Section titled “isDepthWrite”boolean isDepthWrite()
If true, the draw writes its depth; always false without the depth test.
isCull
Section titled “isCull”boolean isCull()
If true, the back faces are not drawn.
getPrimitive
Section titled “getPrimitive”Primitive getPrimitive()
Returns the topology of the draw: segments or triangles.
isStencil
Section titled “isStencil”boolean isStencil()
If true, the key belongs to the WRITE pass of the stencil emulation, built by stencil(...).
equals
Section titled “equals”boolean equals(Object other)
If true, the other object is of the same class with the same shader, blending and switches.
hashCode
Section titled “hashCode”int hashCode()
Returns a hash of the values that equals compares.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
