Skip to main content

Crate flow_ngin

Crate flow_ngin 

Source
Expand description

flow-ngin

A lightweight, cross-platform instancing-oriented game engine focused on native and WASM compatibility. This crate exposes a small surface for constructing GPU resources, rendering pipelines and scene data. The design emphasizes reuse of pipelines, efficient instancing and a minimal runtime surface suitable for embedding in native applications or the web.

High-level modules

  • camera: camera types, controller and uniforms for view/projection
  • context: central GPU and window context that owns device/queue/pipelines
  • data_structures: engine data models (meshes, instances, textures)
  • flow: high level flow control (scenes / update loops)
  • pick: object picking utilities and shaders
  • pipelines: definitions for various render pipelines (basic, light, gui)
  • resources: helpers to load textures/models and create GPU resources
  • render: render composition for efficient pipeline reuse

Modules§

camera
context
conv
Constrained conversion functions for assisting in situations where type inference is difficult.
data_structures
Engine data structures: models, textures, scene graphs, and instances.
flow
Flow control and application event loop.
hal
A cross-platform unsafe graphics abstraction.
num_traits
Numeric traits for generic mathematics
pick
Object picking and selection.
pipelines
prelude
This module contains the most common traits used in cgmath. By glob-importing this module, you can avoid the need to import each trait individually, while still being selective about what types you import.
render
Render composition and pipeline batching.
resources
rwh
Interoperability library for Rust Windowing applications.
util
Utility structures and functions that are built on top of the main wgpu API.
wgc
This library safely implements WebGPU on native platforms. It is designed for integration into browsers, as well as wrapping into other language-specific user-friendly libraries.
wgt
This library describes the API surface of WebGPU that is agnostic of the backend. This API is used for targeting both Web and Native.

Macros§

abs_diff_eq
Approximate equality of using the absolute difference.
abs_diff_ne
Approximate inequality of using the absolute difference.
assert_abs_diff_eq
An assertion that delegates to abs_diff_eq!, and panics with a helpful error on failure.
assert_abs_diff_ne
An assertion that delegates to abs_diff_ne!, and panics with a helpful error on failure.
assert_relative_eq
An assertion that delegates to relative_eq!, and panics with a helpful error on failure.
assert_relative_ne
An assertion that delegates to relative_ne!, and panics with a helpful error on failure.
assert_ulps_eq
An assertion that delegates to ulps_eq!, and panics with a helpful error on failure.
assert_ulps_ne
An assertion that delegates to ulps_ne!, and panics with a helpful error on failure.
include_spirv_raw
Macro to load raw SPIR-V data statically, for use with Features::EXPERIMENTAL_PASSTHROUGH_SHADERS.
include_wgsl
Load WGSL source code from a file at compile time.
relative_eq
Approximate equality using both the absolute difference and relative based comparisons.
relative_ne
Approximate inequality using both the absolute difference and relative based comparisons.
ulps_eq
Approximate equality using both the absolute difference and ULPs (Units in Last Place).
ulps_ne
Approximate inequality using both the absolute difference and ULPs (Units in Last Place).
vertex_attr_array
Macro to produce an array of [VertexAttribute].

Structs§

AbsDiff
The requisite parameters for testing for approximate equality using a absolute difference based comparison.
Adapter
Handle to a physical graphics and/or compute device.
AdapterInfo
Information about an adapter.
AllocatorReport
A report that can be generated for informational purposes using Allocator::generate_report().
BackendOptions
Options that are passed to a given backend.
Backends
Represents the backends that wgpu will use.
Basis2
A two-dimensional rotation matrix.
Basis3
A three-dimensional rotation matrix.
BindGroup
Handle to a binding group.
BindGroupDescriptor
Describes a group of bindings and the resources to be bound.
BindGroupEntry
An element of a BindGroupDescriptor, consisting of a bindable resource and the slot to bind it to.
BindGroupLayout
Handle to a binding group layout.
BindGroupLayoutDescriptor
Describes a BindGroupLayout.
BindGroupLayoutEntry
Describes a single binding inside a bind group.
Blas
Bottom Level Acceleration Structure (BLAS).
BlasAsyncError
Error occurred when trying to asynchronously prepare a blas for compaction.
BlasBuildEntry
Builds the given sets of geometry into the given Blas.
BlasTriangleGeometry
Definition for a triangle geometry for a Bottom Level Acceleration Structure (BLAS).
BlendComponent
Describes a blend component of a BlendState.
BlendState
Describe the blend state of a render pipeline, within ColorTargetState.
Buffer
Handle to a GPU-accessible buffer.
BufferAsyncError
Error occurred when trying to async map a buffer.
BufferBinding
Describes the segment of a buffer to bind.
BufferSlice
A slice of a Buffer, to be mapped, used for vertex or index data, or the like.
BufferTextureCopyInfo
Information about a copy between a buffer and a texture.
BufferTransition
A buffer transition for use with CommandEncoder::transition_resources.
BufferUsages
Different ways that you can use a buffer.
BufferUses
Similar to BufferUsages, but used only for CommandEncoder::transition_resources.
BufferView
A read-only view of a mapped buffer’s bytes.
BufferViewMut
A write-only view of a mapped buffer’s bytes.
Color
RGBA double precision color.
ColorTargetState
Describes the color state of a render pipeline.
ColorWrites
Color write mask. Disabled color channels will not be written to.
CommandBuffer
Handle to a command buffer on the GPU.
CommandBufferDescriptor
Describes a CommandBuffer.
CommandEncoder
Encodes a series of GPU operations.
CompilationInfo
Compilation information for a shader module.
CompilationMessage
A single message from the shader compilation process.
ComputePass
In-progress recording of a compute pass.
ComputePassDescriptor
Describes the attachments of a compute pass.
ComputePassTimestampWrites
Describes the timestamp writes of a compute pass.
ComputePipeline
Handle to a compute pipeline.
ComputePipelineDescriptor
Describes a compute pipeline.
ContextBlasBuildEntry
Context version see BlasBuildEntry.
ContextBlasTriangleGeometry
Context version of BlasTriangleGeometry.
CopyExternalImageDestInfo
View of a texture which can be used to copy to a texture, including color space and alpha premultiplication information.
CoreCounters
wgpu-core’s part of InternalCounters.
CreateSurfaceError
Instance::create_surface() or a related function failed.
Decomposed
A generic transformation consisting of a rotation, displacement vector and scale amount.
Deg
An angle, in degrees.
DepthBiasState
Describes the biasing setting for the depth target.
DepthStencilState
Describes the depth/stencil state in a render pipeline.
Device
Open connection to a graphics and/or compute device.
DownlevelCapabilities
Lists various ways the underlying platform does not conform to the WebGPU standard.
DownlevelFlags
Binary flags listing features that may or may not be present on downlevel adapters.
DownlevelLimits
Represents the sets of additional limits on an adapter, which take place when running on downlevel backends.
Dx12BackendOptions
Configuration for the DX12 backend.
ErrorScopeGuard
Guard for an error scope pushed with Device::push_error_scope().
Euler
A set of Euler angles representing a rotation in three-dimensional space.
ExperimentalFeatures
Token of the user agreeing to access experimental features.
Extent3d
Extent of a texture related operation.
ExternalTexture
Handle to an external texture on the GPU.
ExternalTextureTransferFunction
Parameters describing a gamma encoding transfer function in the form tf = { k * linear | linear < b { a * pow(linear, 1/g) - (a-1) | linear >= b
Features
Features that are not guaranteed to be supported.
FeaturesWGPU
Features that are not guaranteed to be supported.
FeaturesWebGPU
Features that are not guaranteed to be supported.
FragmentState
Describes the fragment processing in a render pipeline.
GlBackendOptions
Configuration for the OpenGL/OpenGLES backend.
HalCounters
wgpu-hal’s part of InternalCounters.
ImageSubresourceRange
Subresource range within an image
Instance
Contains the various entry points to start interacting with the system’s GPUs.
InstanceDescriptor
Options for creating an instance.
InstanceFlags
Instance debugging flags.
InternalCounters
All internal counters, exposed for debugging purposes.
Limits
Represents the sets of limits an adapter/device supports.
LoadOpDontCare
Token of the user agreeing to use LoadOp::DontCare.
Matrix2
A 2 x 2, column major matrix
Matrix3
A 3 x 3, column major matrix
Matrix4
A 4 x 4, column major matrix
MemoryBudgetThresholds
Memory budget thresholds used by backends to try to avoid high memory pressure situations.
MeshPipelineDescriptor
Describes a mesh shader (graphics) pipeline.
MeshState
Describes the mesh shader stage in a mesh shader pipeline.
MultisampleState
Describes the multi-sampling state of a render pipeline.
NoopBackendOptions
Configuration for the noop backend.
Operations
Pair of load and store operations for an attachment aspect.
Origin2d
Origin of a copy from a 2D image.
Origin3d
Origin of a copy to/from a texture.
Ortho
An orthographic projection with arbitrary left/right/bottom/top distances
Perspective
A perspective projection with arbitrary left/right/bottom/top distances
PerspectiveFov
A perspective projection based on a vertical field-of-view angle.
PhysicalPosition
A position represented in physical pixels.
PipelineCache
Handle to a pipeline cache, which is used to accelerate creating RenderPipelines and ComputePipelines in subsequent executions
PipelineCacheDescriptor
Describes a pipeline cache, which allows reusing compilation work between program runs.
PipelineCompilationOptions
Advanced options for use when a pipeline is compiled
PipelineLayout
Handle to a pipeline layout.
PipelineLayoutDescriptor
Describes a PipelineLayout.
PipelineStatisticsTypes
Flags for which pipeline data should be recorded in a query.
Point1
A point in 1-dimensional space.
Point2
A point in 2-dimensional space.
Point3
A point in 3-dimensional space.
PresentationTimestamp
Nanosecond timestamp used by the presentation engine.
PrimitiveState
Describes the state of primitive assembly and rasterization in a render pipeline.
Quaternion
A quaternion in scalar/vector form.
QuerySet
Handle to a query set.
Queue
Handle to a command queue on a device.
QueueWriteBufferView
A write-only view into a staging buffer.
Rad
An angle, in radians.
Relative
The requisite parameters for testing for approximate equality using a relative based comparison.
RenderBundle
Pre-prepared reusable bundle of GPU operations.
RenderBundleDepthStencil
Describes the depth/stencil attachment for render bundles.
RenderBundleEncoder
Encodes a series of GPU operations into a reusable “render bundle”.
RenderBundleEncoderDescriptor
Describes a RenderBundleEncoder.
RenderPass
In-progress recording of a render pass: a list of render commands in a CommandEncoder.
RenderPassColorAttachment
Describes a color attachment to a RenderPass.
RenderPassDepthStencilAttachment
Describes a depth/stencil attachment to a RenderPass.
RenderPassDescriptor
Describes the attachments of a render pass.
RenderPassTimestampWrites
Describes the timestamp writes of a render pass.
RenderPipeline
Handle to a rendering (graphics) pipeline.
RenderPipelineDescriptor
Describes a render (graphics) pipeline.
RequestAdapterOptionsBase
Options for requesting adapter.
RequestDeviceError
Requesting a device from an Adapter failed.
Sampler
Handle to a sampler.
ShaderModule
Handle to a compiled shader module.
ShaderModuleDescriptor
Descriptor for use with Device::create_shader_module.
ShaderRuntimeChecks
Describes how shader bound checks should be performed.
ShaderStages
Describes the shader stages that a binding will be visible from.
SourceLocation
A human-readable representation for a span, tailored for text source.
StencilFaceState
Describes stencil state in a render pipeline.
StencilState
State of the stencil operation (fixed-pipeline stage).
SubmissionIndex
Identifier for a particular call to Queue::submit. Can be used as part of an argument to Device::poll to block for a particular submission to finish.
Surface
Handle to a presentable surface.
SurfaceCapabilities
Defines the capabilities of a given surface and adapter.
SurfaceTexture
Surface texture that can be rendered to. Result of a successful call to Surface::get_current_texture.
TaskState
Describes the task shader stage in a mesh shader pipeline.
TexelCopyBufferInfoBase
View of a buffer which can be used to copy to/from a texture.
TexelCopyBufferLayout
Layout of a texture in a buffer’s memory.
TexelCopyTextureInfoBase
View of a texture which can be used to copy to/from a buffer/texture.
Texture
Handle to a texture on the GPU.
TextureFormatFeatureFlags
Feature flags for a texture format.
TextureFormatFeatures
Features supported by a given texture format
TextureTransition
A texture transition for use with CommandEncoder::transition_resources.
TextureUsages
Different ways that you can use a texture.
TextureUses
Similar to TextureUsages, but used only for CommandEncoder::transition_resources.
TextureView
Handle to a texture view.
Tlas
Top Level Acceleration Structure (TLAS).
TlasInstance
Safe instance for a Tlas.
Ulps
The requisite parameters for testing for approximate equality using an ULPs based comparison.
Vector1
A 1-dimensional vector.
Vector2
A 2-dimensional vector.
Vector3
A 3-dimensional vector.
Vector4
A 4-dimensional vector.
VertexAttribute
Vertex inputs (attributes) to shaders.
VertexBufferLayout
Specifies an interpretation of the bytes of a vertex buffer as vertex attributes.
VertexState
Describes the vertex processing in a render pipeline.
WgslLanguageFeatures
WGSL language extensions.

Enums§

AddressMode
How edges should be handled in texture addressing.
AstcBlock
ASTC block dimensions
AstcChannel
ASTC RGBA channel
Backend
Backends supported by wgpu.
BindingResource
Resource to be bound by a BindGroup for use with a pipeline.
BindingType
Type of a binding in a bind group layout.
BlasGeometries
Contains the sets of geometry that go into a Blas.
BlendFactor
Alpha blend factor.
BlendOperation
Alpha blend operation.
BufferBindingType
Specific type of a buffer binding.
CompareFunction
Comparison function used for depth and stencil operations.
CompilationMessageType
The type of a compilation message.
CompositeAlphaMode
Specifies how the alpha channel of the textures should be handled during compositing.
ContextBlasGeometries
Context version of BlasGeometries.
DeviceEvent
Represents raw hardware events that are not associated with any particular window.
DeviceLostReason
Corresponds to a GPUDeviceLostReason.
DeviceType
Supported physical device types.
Dx12Compiler
Selects which DX12 shader compiler to use.
Dx12SwapchainKind
Selects which kind of swapchain to use on DX12.
Dx12UseFrameLatencyWaitableObject
Whether and how to use a waitable handle obtained from GetFrameLatencyWaitableObject.
DxcShaderModel
DXC shader model.
Error
Errors resulting from usage of GPU APIs.
ErrorFilter
Kinds of Errors a Device::push_error_scope() may be configured to catch.
ExternalTextureFormat
Format of an ExternalTexture. This indicates the number of underlying planes used by the ExternalTexture as well as each plane’s format.
Face
Face of a vertex.
FilterMode
Texel mixing mode when sampling between texels.
FrontFace
Vertex winding order which classifies the “front” face of a triangle.
GlFenceBehavior
Dictate the behavior of fences in OpenGL.
Gles3MinorVersion
Selects which OpenGL ES 3 minor version to request.
IndexFormat
Format of indices used with pipeline.
LoadOp
Operation to perform to the output attachment at the start of a render pass.
MapMode
Type of buffer mapping.
MemoryHints
Hints to the device about the memory allocation strategy.
MipmapFilterMode
Texel mixing mode when sampling between texels.
PollError
Error states after a device poll.
PollStatus
Status of device poll operation.
PolygonMode
Type of drawing mode for polygons
PowerPreference
Power Preference when choosing a physical adapter.
PredefinedColorSpace
Color spaces supported on the web.
PresentMode
Timing and queueing with which frames are actually displayed to the user.
PrimitiveTopology
Primitive type the input mesh is composed of.
QueryType
Type of query contained in a QuerySet.
RequestAdapterError
Error when Instance::request_adapter() fails.
SamplerBindingType
Specific type of a sampler binding.
SamplerBorderColor
Color variation to use when sampler addressing mode is AddressMode::ClampToBorder
ShaderModel
Collections of shader features a device supports if they support less than WebGPU normally allows.
ShaderSource
Source of a shader module.
StencilOperation
Operation to perform on the stencil value.
StorageTextureAccess
Specific type of a sample in a texture binding.
StoreOp
Operation to perform to the output attachment at the end of a render pass.
SurfaceError
Result of an unsuccessful call to Surface::get_current_texture.
SurfaceStatus
Status of the received surface image.
SurfaceTarget
The window/canvas/surface/swap-chain/etc. a surface is attached to, for use with safe surface creation.
SurfaceTargetUnsafe
The window/canvas/surface/swap-chain/etc. a surface is attached to, for use with unsafe surface creation.
TextureAspect
Selects a subset of the data a Texture holds.
TextureDimension
Dimensionality of a texture.
TextureFormat
Format in which a texture’s texels are stored in GPU memory.
TextureSampleType
Specific type of a sample in a texture binding.
TextureViewDimension
Dimensions of a particular texture view.
Trace
Controls API call tracing and specifies where the trace is written.
VertexFormat
Vertex Format for a VertexAttribute (input).
VertexStepMode
Whether a vertex buffer is indexed by vertex or by instance.
WindowEvent
Describes an event from a [Window].

Constants§

COPY_BUFFER_ALIGNMENT
Buffer to buffer copy as well as buffer clear offsets and sizes must be aligned to this number.
COPY_BYTES_PER_ROW_ALIGNMENT
Buffer-texture copies must have bytes_per_row aligned to this number.
IMMEDIATE_DATA_ALIGNMENT
Ranges of writes to immediate data must be at least this aligned.
MAP_ALIGNMENT
Minimum alignment of buffer mappings.
MAXIMUM_SUBGROUP_MAX_SIZE
The maximum allowed value for AdapterInfo::subgroup_max_size.
MINIMUM_SUBGROUP_MIN_SIZE
The minimum allowed value for AdapterInfo::subgroup_min_size.
QUERY_RESOLVE_BUFFER_ALIGNMENT
An offset into the query resolve buffer has to be aligned to this.
QUERY_SET_MAX_QUERIES
Maximum queries in a QuerySetDescriptor.
QUERY_SIZE
Size in bytes of a single piece of query data.
VERTEX_ALIGNMENT
Vertex buffer offsets and strides have to be a multiple of this number.
VERTEX_STRIDE_ALIGNMENTDeprecated
Vertex buffer strides have to be a multiple of this number.

Traits§

AbsDiffEq
Equality that is defined using the absolute difference of two numbers.
Angle
Angles and their associated trigonometric functions.
Array
An array containing elements of type Element
BaseFloat
Base floating point types
BaseNum
Base numeric types with partial ordering
Bounded
Numbers which have upper and lower bounds
ElementWise
Element-wise arithmetic operations. These are supplied for pragmatic reasons, but will usually fall outside of traditional algebraic properties.
EuclideanSpace
Points in a Euclidean space with an associated space of displacement vectors.
InnerSpace
Vectors that also have a dot (or inner) product.
Matrix
A column-major matrix of arbitrary dimensions.
MetricSpace
A type with a distance function between values.
One
Defines a multiplicative identity element for Self.
RelativeEq
Equality comparisons between two numbers using both the absolute difference and relative based comparisons.
Rotation
A trait for a generic rotation. A rotation is a transformation that creates a circular motion, and preserves at least one point in the space.
Rotation2
A two-dimensional rotation.
Rotation3
A three-dimensional rotation.
SquareMatrix
A column-major major matrix where the rows and column vectors are of the same dimensions.
Transform
A trait representing an affine transformation that can be applied to points or vectors. An affine transformation is one which
Transform2
Transform3
UlpsEq
Equality comparisons between two numbers using both the absolute difference and ULPs (Units in Last Place) based comparisons.
UncapturedErrorHandler
The callback of Device::on_uncaptured_error().
VectorSpace
Vectors that can be added together and multiplied by scalars.
WasmNotSend
WasmNotSendSync
WasmNotSync
WindowHandle
Super trait for window handles as used in SurfaceTarget.
Zero
Defines an additive identity element for Self.

Functions§

dot
Dot product of two vectors.
frustum
Create a perspective matrix from a view frustum.
ortho
Create an orthographic projection matrix.
perspective
Create a perspective projection matrix.
point1
The short constructor.
point2
The short constructor.
point3
The short constructor.
vec1
The short constructor.
vec2
The short constructor.
vec3
The short constructor.
vec4
The short constructor.

Type Aliases§

AccelerationStructureFlags
Flags for an acceleration structure.
AccelerationStructureGeometryFlags
Flags for a geometry inside a bottom level acceleration structure.
AccelerationStructureUpdateMode
Update mode for acceleration structure builds.
BlasGeometrySizeDescriptors
Descriptor for the size defining attributes, for a bottom level acceleration structure.
BlasTriangleGeometrySizeDescriptor
Descriptor for the size defining attributes of a triangle geometry, for a bottom level acceleration structure.
BufferAddress
Integral type used for Buffer offsets and sizes.
BufferDescriptor
Describes a Buffer.
BufferSize
Integral type used for BufferSlice sizes.
CommandEncoderDescriptor
Describes a CommandEncoder.
CreateBlasDescriptor
Descriptor to create bottom level acceleration structures.
CreateTlasDescriptor
Descriptor to create top level acceleration structures.
DeviceDescriptor
Describes a Device.
DynamicOffset
Integral type used for dynamic bind group offsets.
ErrorSource
Lower level source of the error.
ExternalTextureDescriptor
Describes an ExternalTexture.
Label
Object debugging label.
PollType
Passed to Device::poll to control how and if it should block.
QuerySetDescriptor
Describes a QuerySet.
RenderBundleDescriptor
Describes a RenderBundle.
RequestAdapterOptions
Additional information required when requesting an adapter.
SamplerDescriptor
Describes a Sampler.
ShaderLocation
Integral type used for binding locations in shaders.
ShaderModuleDescriptorPassthrough
Descriptor for a shader module given by any of several sources. At least one of the shader types that may be used by the backend must be Some
SurfaceConfiguration
Describes a Surface.
TexelCopyBufferInfo
View of a buffer which can be used to copy to/from a texture.
TexelCopyTextureInfo
View of a texture which can be used to copy to/from a buffer/texture.
TextureDescriptor
Describes a Texture.
TextureViewDescriptor
Describes a TextureView.