Documentation ¶
Index ¶
- type AaConfig
- type BinHeader
- type BindType
- type BindTypeType
- type BufferProxy
- type BufferSize
- type BufferSizes
- type BumpAllocatorMemory
- type BumpAllocators
- type BumpEstimator
- type Clear
- type Clip
- type ClipBbox
- type ClipBic
- type ClipElement
- type Command
- type ConfigUniform
- type Dispatch
- type DispatchIndirect
- type Download
- type DrawBbox
- type DrawMonoid
- type FreeBuffer
- type FreeImage
- type FullShaders
- type ImageFormat
- type ImageProxy
- type IndirectCount
- type Layout
- type LineSoup
- type Path
- type PathBbox
- type PathMonoid
- type PathSegment
- type Ramps
- type Recording
- func (rec *Recording) ClearAll(arena *mem.Arena, buf BufferProxy)
- func (rec *Recording) Dispatch(arena *mem.Arena, shader ShaderID, wgSize [3]uint32, resources []ResourceProxy)
- func (rec *Recording) DispatchIndirect(arena *mem.Arena, shader ShaderID, buf BufferProxy, offset uint64, ...)
- func (rec *Recording) Download(arena *mem.Arena, buf BufferProxy)
- func (rec *Recording) FreeBuffer(arena *mem.Arena, buf BufferProxy)
- func (rec *Recording) FreeImage(arena *mem.Arena, image ImageProxy)
- func (rec *Recording) FreeResource(arena *mem.Arena, resource ResourceProxy)
- func (rec *Recording) Upload(arena *mem.Arena, name string, data []byte) BufferProxy
- func (rec *Recording) UploadImage(arena *mem.Arena, width, height uint32, format ImageFormat, data []byte) ImageProxy
- func (rec *Recording) UploadUniform(arena *mem.Arena, name string, data []byte) BufferProxy
- type Render
- type RenderConfig
- type RenderParams
- type Renderer
- func (rd *Renderer) RecordFine(arena *mem.Arena, r *Render, shaders *FullShaders, recording Recording, ...) Recording
- func (rd *Renderer) RenderEncodingCoarse(arena *mem.Arena, r *Render, encoding *encoding.Encoding, resolver *Resolver, ...) Recording
- func (rd *Renderer) RenderFull(arena *mem.Arena, enc *encoding.Encoding, resolver *Resolver, ...) (Recording, ResourceProxy)
- type ResolvedPatch
- type ResolvedPatchImage
- type ResolvedPatchKind
- type ResolvedPatchRamp
- type Resolver
- type ResourceID
- type ResourceProxy
- type ResourceProxyKind
- type SegmentCount
- type ShaderID
- type Tile
- type Upload
- type UploadImage
- type UploadUniform
- type WorkgroupCounts
- type WorkgroupSize
- type WriteImage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindType ¶
type BindType struct { Type BindTypeType ImageFormat ImageFormat }
type BindTypeType ¶
type BindTypeType int
const ( BindTypeBuffer BindTypeType = iota + 1 BindTypeBufReadOnly BindTypeUniform BindTypeImage BindTypeImageRead BindTypeImageArrayRead )
type BufferProxy ¶
type BufferProxy struct { Size uint64 ID ResourceID Name string }
func NewBufferProxy ¶
func NewBufferProxy(size uint64, name string) BufferProxy
func (BufferProxy) Resource ¶
func (p BufferProxy) Resource() ResourceProxy
type BufferSize ¶
func NewBufferSize ¶
func NewBufferSize[T any](x uint32) BufferSize[T]
type BufferSizes ¶
type BufferSizes struct { // Known size buffers PathReduced BufferSize[PathMonoid] PathReduced2 BufferSize[PathMonoid] PathReducedScan BufferSize[PathMonoid] PathMonoids BufferSize[PathMonoid] PathBboxes BufferSize[PathBbox] DrawReduced BufferSize[DrawMonoid] DrawMonoids BufferSize[DrawMonoid] Info BufferSize[uint32] ClipInps BufferSize[Clip] ClipEls BufferSize[ClipElement] ClipBics BufferSize[ClipBic] ClipBboxes BufferSize[ClipBbox] DrawBboxes BufferSize[DrawBbox] BumpAlloc BufferSize[BumpAllocators] IndirectCount BufferSize[IndirectCount] BinHeaders BufferSize[BinHeader] Paths BufferSize[Path] // Bump allocated buffers Lines BufferSize[LineSoup] BinData BufferSize[uint32] Tiles BufferSize[Tile] SegCounts BufferSize[SegmentCount] Segments BufferSize[PathSegment] BlendSpill BufferSize[[4]float32] Ptcl BufferSize[uint32] }
func NewBufferSizes ¶
func NewBufferSizes(layout *Layout, workgroups *WorkgroupCounts) BufferSizes
type BumpAllocatorMemory ¶
type BumpAllocatorMemory struct { Total uint32 Binning BufferSize[uint32] Ptcl BufferSize[uint32] Tile BufferSize[Tile] SegCounts BufferSize[SegmentCount] Segments BufferSize[PathSegment] Lines BufferSize[LineSoup] }
type BumpAllocators ¶
type BumpAllocators struct { Failed uint32 Binning uint32 Ptcl uint32 Tile uint32 SegCounts uint32 Segments uint32 Blend uint32 Lines uint32 // contains filtered or unexported fields }
func (*BumpAllocators) Memory ¶
func (ba *BumpAllocators) Memory() BumpAllocatorMemory
type BumpEstimator ¶
type BumpEstimator struct {
// contains filtered or unexported fields
}
func (*BumpEstimator) Append ¶
func (be *BumpEstimator) Append(other *BumpEstimator, transform *jmath.Transform)
Append combines the counts of this estimator with other after applying an optional transform.
func (*BumpEstimator) Reset ¶
func (be *BumpEstimator) Reset()
func (*BumpEstimator) Tally ¶
func (est *BumpEstimator) Tally(transform *jmath.Transform) BumpAllocatorMemory
Tally produces the final total, applying an optional transform to all content.
type Clear ¶
type Clear struct { Buffer BufferProxy Offset uint64 Size int64 }
type Clip ¶
type Clip struct { // Index of the draw object. Idx uint32 // This is a packed encoding of an enum with the sign bit as the tag. If positive, // this entry is a `BeginClip` and contains the associated path index. If negative, // it is an `EndClip` and contains the bitwise-not of the `EndClip` draw object index. PathIdx int32 // contains filtered or unexported fields }
type ClipBic ¶
type ClipElement ¶
type ConfigUniform ¶
type ConfigUniform struct { // Width of the scene in tiles. WidthInTiles uint32 // Height of the scene in tiles. HeightInTiles uint32 // Width of the target in pixels. TargetWidth uint32 // Height of the target in pixels. TargetHeight uint32 // The base background color applied to the target before any blends. BaseColor [4]float32 // Layout of packed scene data. Layout Layout // Size of line soup buffer allocation (in [`LineSoup`]s) LinesSize uint32 // Size of binning buffer allocation (in `uint32`s). BinningSize uint32 // Size of tile buffer allocation (in [`Tile`]s). TilesSize uint32 // Size of segment count buffer allocation (in [`SegmentCount`]s). SegCountsSize uint32 // Size of segment buffer allocation (in [`PathSegment`]s). SegmentsSize uint32 // Size of blend spill buffer (in `u32` pixels) // TODO: Maybe store in TILE_WIDTH * TILE_HEIGHT blocks of pixels instead? BlendSize uint32 // Size of per-tile command list buffer allocation (in `uint32`s). PtclSize uint32 // contains filtered or unexported fields }
ConfigUniform contains uniform render configuration data used by all GPU stages.
This data structure must be kept in sync with the definition in `shaders/shared/config.wgsl`.
type Dispatch ¶
type Dispatch struct { Shader ShaderID WorkgroupSize [3]uint32 Bindings []ResourceProxy }
type DispatchIndirect ¶
type DispatchIndirect struct { Shader ShaderID Buffer BufferProxy Offset uint64 Bindings []ResourceProxy }
type Download ¶
type Download struct {
Buffer BufferProxy
}
type DrawMonoid ¶
type DrawMonoid struct { // The number of paths preceding this draw object. PathIdx uint32 // The number of clip operations preceding this draw object. ClipIdx uint32 // The offset of the encoded draw object in the scene (u32s). SceneOffset uint32 // The offset of the associated info. InfoOffset uint32 // contains filtered or unexported fields }
func NewDrawMonoid ¶
func NewDrawMonoid(tag encoding.DrawTag) DrawMonoid
func (DrawMonoid) Combine ¶
func (m DrawMonoid) Combine(other DrawMonoid) DrawMonoid
type FreeBuffer ¶
type FreeBuffer struct {
Buffer BufferProxy
}
type FreeImage ¶
type FreeImage struct {
Image ImageProxy
}
type FullShaders ¶
type FullShaders struct { PathtagReduce ShaderID PathtagReduce2 ShaderID PathtagScan1 ShaderID PathtagScanSmall ShaderID PathtagScanLarge ShaderID BboxClear ShaderID Flatten ShaderID DrawReduce ShaderID DrawLeaf ShaderID ClipReduce ShaderID ClipLeaf ShaderID Binning ShaderID TileAlloc ShaderID BackdropDyn ShaderID PathCountSetup ShaderID PathCount ShaderID Coarse ShaderID PathTilingSetup ShaderID PathTiling ShaderID FineArea ShaderID FineMSAA8 ShaderID FineMSAA16 ShaderID // 2-level dispatch works for CPU pathtag scan even for large // inputs 3-level is not yet implemented. PathtagIsCPU bool }
type ImageFormat ¶
type ImageFormat int
const ( Rgba8 ImageFormat = iota Rgba8Srgb Bgra8 Rgba16Float )
type ImageProxy ¶
type ImageProxy struct { Width uint32 Height uint32 Format ImageFormat ID ResourceID }
func NewImageProxy ¶
func NewImageProxy(width, height uint32, format ImageFormat) ImageProxy
func (ImageProxy) Resource ¶
func (p ImageProxy) Resource() ResourceProxy
type IndirectCount ¶
IndirectCount stores indirect dispatch size values.
The original plan was to reuse BumpAllocators, but the WebGPU compatible usage list rules forbid that being used as indirect counts while also bound as writable.
type Layout ¶
type Layout struct { // Number of draw objects. NumDrawObjects uint32 // Number of paths. NumPaths uint32 // Number of clips. NumClips uint32 // Start of binning data. BinDataStart uint32 // Start of path tag stream. PathTagBase uint32 // Start of path data stream. PathDataBase uint32 // Start of draw tag stream. DrawTagBase uint32 // Start of draw data stream. DrawDataBase uint32 // Start of transform stream. TransformBase uint32 // Start of style stream. StyleBase uint32 // contains filtered or unexported fields }
type PathMonoid ¶
type PathMonoid struct { // Index into transform stream. TransIdx uint32 // Path segment index. PathSegIdx uint32 // Offset into path segment stream. PathSegOffset uint32 // Index into style stream. StyleIdx uint32 // Index of containing path. PathIdx uint32 // contains filtered or unexported fields }
func NewPathMonoid ¶
func NewPathMonoid(tagWord uint32) PathMonoid
func (PathMonoid) Combine ¶
func (m PathMonoid) Combine(other PathMonoid) PathMonoid
type PathSegment ¶
type Recording ¶
type Recording struct {
Commands []Command
}
func (*Recording) DispatchIndirect ¶
func (rec *Recording) DispatchIndirect( arena *mem.Arena, shader ShaderID, buf BufferProxy, offset uint64, resources []ResourceProxy, )
func (*Recording) FreeBuffer ¶
func (rec *Recording) FreeBuffer(arena *mem.Arena, buf BufferProxy)
func (*Recording) FreeResource ¶
func (rec *Recording) FreeResource(arena *mem.Arena, resource ResourceProxy)
func (*Recording) UploadImage ¶
func (rec *Recording) UploadImage(arena *mem.Arena, width, height uint32, format ImageFormat, data []byte) ImageProxy
func (*Recording) UploadUniform ¶
type Render ¶
type Render struct {
// contains filtered or unexported fields
}
func (*Render) OutImage ¶
func (r *Render) OutImage() ImageProxy
type RenderConfig ¶
type RenderConfig struct {
// contains filtered or unexported fields
}
func NewRenderConfig ¶
type RenderParams ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func (*Renderer) RecordFine ¶
func (rd *Renderer) RecordFine(arena *mem.Arena, r *Render, shaders *FullShaders, recording Recording, pgroup profiler.ProfilerGroup) Recording
func (*Renderer) RenderEncodingCoarse ¶
func (rd *Renderer) RenderEncodingCoarse( arena *mem.Arena, r *Render, encoding *encoding.Encoding, resolver *Resolver, shaders *FullShaders, params *RenderParams, robust bool, pgroup profiler.ProfilerGroup, ) Recording
func (*Renderer) RenderFull ¶
func (rd *Renderer) RenderFull( arena *mem.Arena, enc *encoding.Encoding, resolver *Resolver, shaders *FullShaders, params *RenderParams, pgroup profiler.ProfilerGroup, ) (Recording, ResourceProxy)
type ResolvedPatch ¶
type ResolvedPatch struct { Kind ResolvedPatchKind Ramp ResolvedPatchRamp Image ResolvedPatchImage }
type ResolvedPatchImage ¶
type ResolvedPatchKind ¶
type ResolvedPatchKind int
const ( ResolvedPatchKindRamp ResolvedPatchKind = iota + 1 ResolvedPatchKindImage )
type ResolvedPatchRamp ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver() *Resolver
type ResourceID ¶
type ResourceID uint64
type ResourceProxy ¶
type ResourceProxy struct { Kind ResourceProxyKind BufferProxy ImageProxy ImageArray []ImageProxy }
type ResourceProxyKind ¶
type ResourceProxyKind int
const ( ResourceProxyKindBuffer ResourceProxyKind = iota + 1 ResourceProxyKindImage ResourceProxyKindImageArray )
type SegmentCount ¶
type Upload ¶
type Upload struct { Buffer BufferProxy Data []byte }
type UploadImage ¶
type UploadImage struct { Proxy ImageProxy Data []byte }
type UploadUniform ¶
type UploadUniform struct { Buffer BufferProxy Data []byte }
type WorkgroupCounts ¶
type WorkgroupCounts struct { UseLargePathScan bool PathReduce WorkgroupSize PathReduce2 WorkgroupSize PathScan1 WorkgroupSize PathScan WorkgroupSize BboxClear WorkgroupSize Flatten WorkgroupSize DrawReduce WorkgroupSize DrawLeaf WorkgroupSize ClipReduce WorkgroupSize ClipLeaf WorkgroupSize Binning WorkgroupSize TileAlloc WorkgroupSize PathCountSetup WorkgroupSize // Note `pathCount` must use an indirect dispatch Backdrop WorkgroupSize Coarse WorkgroupSize PathTilingSetup WorkgroupSize // Note `pathTiling` must use an indirect dispatch Fine WorkgroupSize }
func NewWorkgroupCounts ¶
func NewWorkgroupCounts( layout *Layout, widthInTiles uint32, heightInTiles uint32, numPathTags uint32, ) WorkgroupCounts
type WorkgroupSize ¶
type WorkgroupSize [3]uint32
type WriteImage ¶
type WriteImage struct { Proxy ImageProxy Coords [4]uint32 Image image.Image }
Click to show internal directories.
Click to hide internal directories.