Module hotline_rs::gfx
source · Expand description
Graphics and compute abstraction module.
Structs
- Information returned from
Device::get_adapter_info
. - Information to control blending operations on render targets
- Information to create a buffer through
Device::create_buffer
. - Describes how a buffer will be used on the GPU.
- Values to clear colour render targets at the start of a
RenderPass
- Values to clear depth stencil buffers during a
RenderPass
- Information to create a compute pipeline through
Device::create_compute_pipeline
- CPU Access flags for buffers or textures.
- Information to control the depth and stencil testing of primitves when using a
RenderPipeline
- Describes a range of resources for access on the GPU.
- Information to create a device, it contains default heaps for resource views resources will be automatically allocated into these heaps, you can supply custom heaps if necessary.
- Structure of arguments which can be used to execute
dispatch
calls indirectly - Structure of arguments which can be used to execute
draw_instanced
calls indirectly - Structure of arguments which can be used to execute
draw_indexed_instanced
calls indirectly - Information to create a desciptor heap…
Device
will contain default heaps, but you can create your own if required. - Structure of arguments which can be used to change an index buffer during
execute_indirect
- Pair of
IndirectArgumentType
andIndirectTypeArguments
where the type selects the union member of data - Arguments to change a buffer during an
execute_indirect
call whenConstantBuffer
,ShaderResource
orUnorderedAccess
are theIndirectArgumentType
- This can be used for
Draw
,DrawIndexed
, orDispatch
IndirectArgumentType
- Arguments to change push constants during an
execute_indirect
call whenConstant
is theIndirectArgumentType
- Describe a single element of an
InputLayoutInfo
. - Info to control mapping of resources for read/write access
PipelineLayout
is required to create a pipeline it describes the layout of resources for access on the GPU.- You can request this based on resource type, register and space (as specified in shader)
- GPU pipeline statistics obtain by using a
PipelineStatistics
query - Describes space in the shader to send data to via
CmdBuf::push_constants
. - Information to create a query heap.
- Information to control the rasterisation mode of primitives when using a
RenderPipeline
- Results from an issued ReadBackRequest
- Information to create a render pass
- Information to create a pipeline through
Device::create_render_pipeline
. - Blending operations for a single render target
- Individual sampler state binding for use in static samplers in a
PipelineLayout
. - Info to create a sampler state object to sample textures in shaders.
- Structure to specify scissor rect coordinates on a
CmdBuf
. - Shader compilation flags.
- Information required to compile a shader from source code.
- Information to create a shader through
Device::create_shader
. - 3-Dimensional struct for compute shader thread count / thread group size.
- Stencil info for various outcomes of the depth stencil test
- Information to pass to
Device::create_swap_chain
. - Allows user specified heaps to be used for creating views when creating textures through
create_texture_with_heap
you can supplyNone
for the heap types are not applicable and if a view is requested for aNone
heap the default device heaps will be used instead - Information to create a pipeline through
Device::create_texture
. - Textures can be used in one or more of the following ways
- Transitions are required to be performed to switch resources from reading to writing or into different formats
- Info to control writing of mapped resources
- Structure of arguments which can be used to change a vertex buffer during
execute_indirect
- Structure to specify viewport coordinates on a
CmdBuf
. - Render target write mask flags.
Enums
- Controls how the source and destination terms in blend equation are derrived
- Controls how the source and destination terms are combined: final = src (op) dest
- Used for comparison ops in depth testing, samplers.
- Polygon cull mode
- Write to the depth buffer, or omit writes and just perform depth testing
- Describes the type of descriptor binding to create.
- Polygon fillmode
- Format for resource types (textures / buffers). n = normalised unsigned integer, u = unsigned integer, i = signed integer, f = float
- Options for heap types.
- Different types of arguments which can be changed through execute indirect calls
- Describes the frequency of which elements are fetched from a vertex input element.
- The logical operation to configure for a render target blend with logic op enabled
- Enum to differentiate between render and compute pipelines but also still work on them generically
- Options for query heap types, and queries
- All possible resource states, some for buffers and some for textures
- Address mode for the sampler (controls wrapping and clamping).
- Filtering mode for the sampler (controls bilinear and trilinear interpolation).
- The stage to which a shader will bind itself.
- Describes the visibility of which shader stages can access a descriptor.
- Stencil operations
- ome resources may contain subresources for resolving
- Describes the dimension of a texture
- Indicates how the pipeline interprets vertex data at the input assembler stage This will be also used to infer primitive topology types for geometry or hull shaders
Traits
- An opaque Buffer type used for vertex, index, constant or unordered access.
- Responsible for buffering graphics commands. Internally it will contain a platform specific command list for each buffer in the associated swap chain. At the start of each frame
reset
must be called with an associated swap chain to internally switch which buffer we are writing to. At the end of each frameclose
must be called and finally theCmdBuf
can be passed toDevice::execute
to be processed on the GPU. - A command signature is used to
execute_indirect
commands - An opaque compute pipeline type..
- A GPU device is used to create GPU resources, the device also contains a single a single command queue to which all command buffers will submitted and executed each frame. Default heaps for shader resources, render targets and depth stencils are also provided
- An opaque shader heap type, use to create views of resources for binding and access in shaders
- A pipeline trait for shared functionality between Compute and Render pipelines
- An opaque query heap type, use to create queries
- Used to readback data from the GPU, once the request is issued
is_complete
needs to be waited on for completion you must poll this every frame and not block so the GPU can flush the request. Once the result is ready the data can be obtained usingget_data
- An opaque RenderPass containing an optional set of colour render targets and an optional depth stencil target
- An opaque render pipeline type set blend, depth stencil, raster states on a pipeline, and bind with
CmdBuf::set_pipeline_state
- An opaque Shader type
- A swap chain is connected to a window, controls fences and signals as we swap buffers.
- An opaque Texture type
Functions
- Aligns value to the alignment specified by align. value can be non-power of 2
- Aligns value to the alignment specified by align. value must be a power of 2
- Take any sized type and return a u8 slice. This can be useful to pass
data
toDevice::create_buffer
. - Returns the ‘block size’ (texel, compressed block of texels or single buffer element) for a given format
- Returns the number of components for a given format. ie RGBA = 4 and RGB = 3
- Returns the number of mip levels required for a 2D texture
- For the supplied sized struct
&_
returns the number of 32bit constants required for use aspush_constants
- Returns the row pitch of an image in bytes: width * block size
- Return the size in bytes of a 3 dimensional resource: width * height * depth block size
- Return the size in bytes of up to dimensional resource: width * height * depth block size for each mip level and account for array layers
- Take any sized silce and convert to a slice of u8
- Returns the slice pitch of an image in bytes: width * height * block size, a slice is a single 2D image or a single slice of a 3D texture or texture array
Type Definitions
- Input layout describes the layout of vertex buffers bound to the input assembler.
Unions
- Union of
IndirectArguments
where data can be selected by theIndirectArgumentType