Skip to content

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.

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.

ReturnsSignatureSummary
PipelineKeyof(IShader shader, RenderState state, Primitive primitive) factoryBuilds the key of a draw of primitive with shader under state.
PipelineKeystencil(IShader shader, RenderState state, Primitive primitive) factoryBuilds 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.

ReturnsSignatureSummary
IShadergetShader()Returns the shader of the draw.
BlendStategetBlend()Returns the blending, BlendState.DISABLED when the state does not blend.
booleanisColorWrite()If true, the draw writes the color channels.
booleanisDepthTest()If true, the draw compares its depth with the stored one.
booleanisDepthWrite()If true, the draw writes its depth; always false without the depth test.
booleanisCull()If true, the back faces are not drawn.
PrimitivegetPrimitive()Returns the topology of the draw: segments or triangles.
booleanisStencil()If true, the key belongs to the WRITE pass of the stencil emulation, built by stencil(...).
booleanequals(Object other)If true, the other object is of the same class with the same shader, blending and switches.
inthashCode()Returns a hash of the values that equals compares.

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.

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.


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

Report a problem with this page