Deprecated: use gitlab.freedesktop.org/emersion/go-kdf

package webgpu

import "git.sr.ht/~emersion/go-kdf/webgpu"

Package webgpu exposes WebGPU pixel formats.

WebGPU pixel formats are defined in: https://www.w3.org/TR/webgpu/#texture-formats

Index

Variables

var FormatTable map[string]Format = formatTable

Functions

func GetDescriptor

func GetDescriptor(fmt Format, endianness kdf.Endianness, options *FormatOptions) *kdf.Descriptor

Types

type Format

type Format int
const (
	// 8-bit formats
	FormatR8Unorm Format = 0
	FormatR8Snorm Format = 1
	FormatR8Uint  Format = 2
	FormatR8Sint  Format = 3

	// 16-bit formats
	FormatR16Uint  Format = 4
	FormatR16Sint  Format = 5
	FormatR16Float Format = 6
	FormatRg8Unorm Format = 7
	FormatRg8Snorm Format = 8
	FormatRg8Uint  Format = 9
	FormatRg8Sint  Format = 10

	// 32-bit formats
	FormatR32Uint        Format = 11
	FormatR32Sint        Format = 12
	FormatR32Float       Format = 13
	FormatRg16Uint       Format = 14
	FormatRg16Sint       Format = 15
	FormatRg16Float      Format = 16
	FormatRgba8Unorm     Format = 17
	FormatRgba8UnormSrgb Format = 18
	FormatRgba8Snorm     Format = 19
	FormatRgba8Uint      Format = 20
	FormatRgba8Sint      Format = 21
	FormatBgra8Unorm     Format = 22
	FormatBgra8UnormSrgb Format = 23
	// Packed 32-bit formats
	FormatRgb9e5uFloat  Format = 24
	FormatRgb10a2Unorm  Format = 25
	FormatRg11b10Ufloat Format = 26

	// 64-bit formats
	FormatRg32Uint    Format = 27
	FormatRg32Sint    Format = 28
	FormatRg32Float   Format = 29
	FormatRgba16Uint  Format = 30
	FormatRgba16Sint  Format = 31
	FormatRgba16Float Format = 32

	// 128-bit formats
	FormatRgba32Uint  Format = 33
	FormatRgba32Sint  Format = 34
	FormatRgba32Float Format = 35

	// Depth/stencil formats
	FormatStencil8            Format = 36
	FormatDepth16Unorm        Format = 37
	FormatDepth24Plus         Format = 38
	FormatDepth24PlusStencil8 Format = 39
	FormatDepth32Float        Format = 40

	// "depth32float-stencil8" feature
	FormatDepth32FloatStencil8 Format = 41

	// BC compressed formats, "texture-compression-bc"
	FormatBc1RgbaUnorm     Format = 42
	FormatBc1RgbaUnormSrgb Format = 43
	FormatBc2RgbaUnorm     Format = 44
	FormatBc2RgbaUnormSrgb Format = 45
	FormatBc3RgbaUnorm     Format = 46
	FormatBc3RgbaUnormSrgb Format = 47
	FormatBc4RUnorm        Format = 48
	FormatBc4RSnorm        Format = 49
	FormatBc5RgUnorm       Format = 50
	FormatBc5RgSnorm       Format = 51
	FormatBc6hRgbUfloat    Format = 52
	FormatBc6hRgbFloat     Format = 53
	FormatBc7RgbaUnorm     Format = 54
	FormatBc7RgbaUnormSrgb Format = 55

	// ETC2 compressed formats, "texture-compression-etc2"
	FormatEtc2Rgb8Unorm       Format = 56
	FormatEtc2Rgb8UnormSrgb   Format = 57
	FormatEtc2Rgb8a1Unorm     Format = 58
	FormatEtc2Rgb8a1UnormSrgb Format = 59
	FormatEtc2Rgba8Unorm      Format = 60
	FormatEtc2Rgba8UnormSrgb  Format = 61
	FormatEacR11Unorm         Format = 62
	FormatEacR11Snorm         Format = 63
	FormatEacRg11Unorm        Format = 64
	FormatEacRg11Snorm        Format = 65

	// ASTC compressed formats, "texture-compression-astc"
	FormatAstc4x4Unorm       Format = 66
	FormatAstc4x4UnormSrgb   Format = 67
	FormatAstc5x4Unorm       Format = 68
	FormatAstc5x4UnormSrgb   Format = 69
	FormatAstc5x5Unorm       Format = 70
	FormatAstc5x5UnormSrgb   Format = 71
	FormatAstc6x5Unorm       Format = 72
	FormatAstc6x5UnormSrgb   Format = 73
	FormatAstc6x6Unorm       Format = 74
	FormatAstc6x6UnormSrgb   Format = 75
	FormatAstc8x5Unorm       Format = 76
	FormatAstc8x5UnormSrgb   Format = 77
	FormatAstc8x6Unorm       Format = 78
	FormatAstc8x6UnormSrgb   Format = 79
	FormatAstc8x8Unorm       Format = 80
	FormatAstc8x8UnormSrgb   Format = 81
	FormatAstc10x5Unorm      Format = 82
	FormatAstc10x5UnormSrgb  Format = 83
	FormatAstc10x6Unorm      Format = 84
	FormatAstc10x6UnormSrgb  Format = 85
	FormatAstc10x8Unorm      Format = 86
	FormatAstc10x8UnormSrgb  Format = 87
	FormatAstc10x10Unorm     Format = 88
	FormatAstc10x10UnormSrgb Format = 89
	FormatAstc12x10Unorm     Format = 90
	FormatAstc12x10UnormSrgb Format = 91
	FormatAstc12x12Unorm     Format = 92
	FormatAstc12x12UnormSrgb Format = 93
)

type FormatOptions

type FormatOptions struct {
	// The depth24plus format may be implemented as a 24-bit depth format or a
	// depth32float.
	Depth24Is32bit bool
	// The depth24plus-stencil8 format may be implemented as a 24-bit depth or
	// a depth32float.
	Depth24Stencil8Is32Bit bool
	// The stencil8 format may be implemented as a real stencil8 format or
	// depth24stencil8 where the depth is inaccessible.
	Stencil8IsReal bool
}

FormatOptions contains options for GetDescriptor.

webgpu's conversions sometimes depend on the runtime environment.

Source Files

formats.go webgpu.go

Version
v0.0.0-20240521102637-b6d8ec684be0 (latest)
Published
May 21, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
3 weeks ago

Tools for package owners.