Module rokol::gfx[][src]

Graphics (FFI)

Resource types

BakedResource implementations:

  • Buffer: index or vertex buffer
  • Image: 2D or 3D image
  • Pass: offscreen rendering pass
  • Pipeline: vertex-layouts, shader and render states
  • Shader: vertex and fragment shaders with shader-parameter declarations

Be sure to specify uniform names when making Shader.

Render loop

For example, for one frame with one screen rendering pass:

References

Structs

ColorMask
PassAction

Pass action

Enums

Action

Defines what action should be performed at the start of a render pass:

BlendFactor

The source and destination factors in blending operations.

BufferType

Index | Vertex

CompareFunc

", !=, >, >=, <, <=, true, false

CullMode

Front | Back | None

FaceWinding

CCW | CW

Filter

The filtering mode when sampling a texture image

ImageType

2D | 3D | Array | Cube

IndexType

UInt16 | UInt32

PassActionKind

Actions to be performed at the start of a rendering pass in begin_pass or begin_default_pass

PixelFormat

Pixel format

PrimitiveType

Common subset of 3D primitive types supported across all 3D APIs. Field of PipelineDesc.

ResourceUsage

Update strategy of buffers and images

SamplerType

Float | SInt | UInt

ShaderStage

Fs | Vs

UniformType

Mat4 | Float | Float2 | Float3 | Float4

VertexFormat

Data type of a vertex component

Wrap

The texture coordinates wrapping mode when sampling a texture image

Traits

BakedResource

Buffer | Image | Pipeline | Pass | Shader

Functions

append_buffer

Appends vertices/indices to vertex/index buffer

apply_bindings

Applies buffer Bindings: vertex/index buffer and images

apply_pipeline

Applies Pipeline: vertex-layouts, shader and render states)

apply_uniforms

Applies uniform data to shader

apply_uniforms_as_bytes

[Non-Sokol] Helper for setting shader uniform

begin_default_pass

Screen rendering pass

begin_default_pass_f
begin_pass

Offscreeen rendering pass

buf_desc

[Non-Sokol] Helper for creating dynamic vertex buffer

commit
draw

draw(base_elems, n_elems, n_instances)

end_pass
ibuf_desc_dyn

[Non-Sokol] Helper for creating index buffer

ibuf_desc_immutable

[Non-Sokol] Helper for creating index buffer

scissor

Discard output fragments outside of this rectangle

scissor_f
setup

Should be called from crate::app::RApp::init

shader_desc

[Non-Sokol] Helper for making shaders

update_buffer

Uploads vertices/indices to vertex/index buffer

update_image

Only one update per frame is allowed for buffer and image resources

vbuf_desc_dyn

[Non-Sokol] Helper for creating dynamic vertex buffer

vbuf_desc_immutable

[Non-Sokol] Helper for creating immutable vertex buffer

viewport

Output rectangle space

viewport_f

Type Definitions

Bindings

Vertex/index buffer and image slots

BlendState
Buffer

(Resource) Handle (ID) of vertex | index buffer

BufferDesc
BufferInfo
BufferLayoutDesc
Color

An RGBA color value (f32)

ColorAttachmentAction
Context
ContextDesc
D3D11ContextDesc
DepthAttachmentAction
DepthState
Features
GlContextDesc
Image

(Resource) Handle (ID) of image

ImageData
ImageDesc

The width and height are scaled size (e.g. if on 2x DPI monitor display with 2560x1440 pixels, give scaled size of 1280x720. c.f. crate::app::dpi_scale.

ImageInfo
LayoutDesc
Limits
MetalContextDesc
Pass

(Resource) Handle(ID) of rendering pass

PassAttachmentDesc
PassDesc
PassInfo
Pipeline

(Resource) Handle (ID) of pipeline object: vertex layouts, shader and render states

PipelineDesc
PipelineInfo
PixelFormatInfo
Range

Can be created from &[u8]

SetupDesc

setup parameter, which is created from crate::glue::app_desc

Shader

(Resource) Handle (ID) of shader

ShaderAttrDesc
ShaderDesc
ShaderImageDesc
ShaderInfo
ShaderStageDesc
ShaderUniformBlockDesc
ShaderUniformDesc
SlotInfo
StencilAttachmentAction
StencilState
TraceHooks
VertexAttrDesc
WgpuContextDesc