XU XUv0.13.1
中文

#gpu/layout

import: #gpu/layout

counts: 3 functions, 3 methods, 3 types, 20 constants, 0 method sets

Standard library package `#gpu/layout`.

struct Level2D

XuAPI
pub struct Level2D {
    pub width int
    pub height int
    pub block_columns int
    pub block_rows int
    pub row_bytes int
    pub row_pitch int
    pub offset int
    pub size_bytes int
}

Purpose

One 2D mip level. size_bytes includes padding in every row, including the last row. offset aligns the start of this level within a transfer buffer.

Public fields

width int
field (int)
height int
field (int)
block_columns int
field (int)
block_rows int
field (int)
row_bytes int
field (int)
row_pitch int
field (int)
offset int
offset
size_bytes int
field (int)

struct TextureLayout2D

XuAPI
pub struct TextureLayout2D {

}

Purpose

Immutable computed layout. This describes logical/transfer storage, not a driver's physical allocation size. It owns only a bounded metadata array.

Public fields

This type has no public fields.

(&TextureLayout2D) level_count

XuAPI
pub fn (texture &TextureLayout2D) level_count() int

Purpose

Operation on &TextureLayout2D: level count.

Parameters

texture &TextureLayout2D
The TextureLayout2D instance used by this call (borrow).

Returns

int — a value of this type

(&TextureLayout2D) total_bytes

XuAPI
pub fn (texture &TextureLayout2D) total_bytes() int

Purpose

Operation on &TextureLayout2D: total bytes.

Parameters

texture &TextureLayout2D
The TextureLayout2D instance used by this call (borrow).

Returns

int — a value of this type

(&TextureLayout2D) level

XuAPI
pub fn (texture &TextureLayout2D) level(index int) Level2D

Purpose

Execute level on &TextureLayout2D. Throws on failure; handle the error or propagate it to the caller.

Parameters

texture &TextureLayout2D
The TextureLayout2D instance used by this call (borrow).
index int
index (int)

Returns

Level2D — a value of this type

mip_count_2d

XuAPI
pub fn mip_count_2d(width int, height int) int

Purpose

Full chain length, including level zero. At most 63 for positive Xu int64 dimensions. Device-specific maximum dimensions are checked by its caller. Throws on failure; handle the error or propagate it to the caller.

Parameters

width int
width (int)
height int
height (int)

Returns

int — a value of this type

texture_2d

XuAPI
pub fn texture_2d(format int, width int, height int, levels int, row_alignment int, level_alignment int) TextureLayout2D

Purpose

levels=0 means the full mip chain. Otherwise levels is 1...mip_count_2d. Alignments are in bytes; (1,1) returns tight logical storage. Device limits, resource budgets, allocation, row copies and mip generation are separate. All products, sums and rounding are checked before growing the result. Throws on failure; handle the error or propagate it to the caller.

Parameters

format int
format (int)
width int
width (int)
height int
height (int)
levels int
levels (int)
row_alignment int
row_alignment (int)
level_alignment int
level_alignment (int)

Returns

TextureLayout2D — a value of this type

const R8_UNORM

XuAPI
pub const R8_UNORM = 1

Purpose

Xu format IDs describe storage, not platform enum values or device support.

const RG8_UNORM

XuAPI
pub const RG8_UNORM = 2

Purpose

Constant RG8_UNORM, defining protocol or algorithm parameters.

const RGBA8_UNORM

XuAPI
pub const RGBA8_UNORM = 3

Purpose

Constant RGBA8_UNORM, defining protocol or algorithm parameters.

const RGBA8_SRGB

XuAPI
pub const RGBA8_SRGB = 4

Purpose

Constant RGBA8_SRGB, defining protocol or algorithm parameters.

const BGRA8_UNORM

XuAPI
pub const BGRA8_UNORM = 5

Purpose

Constant BGRA8_UNORM, defining protocol or algorithm parameters.

const BGRA8_SRGB

XuAPI
pub const BGRA8_SRGB = 6

Purpose

Constant BGRA8_SRGB, defining protocol or algorithm parameters.

const R16_FLOAT

XuAPI
pub const R16_FLOAT = 7

Purpose

Constant R16_FLOAT, defining protocol or algorithm parameters.

const RG16_FLOAT

XuAPI
pub const RG16_FLOAT = 8

Purpose

Constant RG16_FLOAT, defining protocol or algorithm parameters.

const RGBA16_FLOAT

XuAPI
pub const RGBA16_FLOAT = 9

Purpose

Constant RGBA16_FLOAT, defining protocol or algorithm parameters.

const R32_FLOAT

XuAPI
pub const R32_FLOAT = 10

Purpose

Constant R32_FLOAT, defining protocol or algorithm parameters.

const RG32_FLOAT

XuAPI
pub const RG32_FLOAT = 11

Purpose

Constant RG32_FLOAT, defining protocol or algorithm parameters.

const RGBA32_FLOAT

XuAPI
pub const RGBA32_FLOAT = 12

Purpose

Constant RGBA32_FLOAT, defining protocol or algorithm parameters.

const DEPTH32_FLOAT

XuAPI
pub const DEPTH32_FLOAT = 13

Purpose

Constant DEPTH32_FLOAT, defining protocol or algorithm parameters.

const BC1_RGBA_UNORM

XuAPI
pub const BC1_RGBA_UNORM = 14

Purpose

Constant BC1_RGBA_UNORM, defining protocol or algorithm parameters.

const BC1_RGBA_SRGB

XuAPI
pub const BC1_RGBA_SRGB = 15

Purpose

Constant BC1_RGBA_SRGB, defining protocol or algorithm parameters.

const BC3_RGBA_UNORM

XuAPI
pub const BC3_RGBA_UNORM = 16

Purpose

Constant BC3_RGBA_UNORM, defining protocol or algorithm parameters.

const BC3_RGBA_SRGB

XuAPI
pub const BC3_RGBA_SRGB = 17

Purpose

Constant BC3_RGBA_SRGB, defining protocol or algorithm parameters.

const BC5_RG_UNORM

XuAPI
pub const BC5_RG_UNORM = 18

Purpose

Constant BC5_RG_UNORM, defining protocol or algorithm parameters.

const BC7_RGBA_UNORM

XuAPI
pub const BC7_RGBA_UNORM = 19

Purpose

Constant BC7_RGBA_UNORM, defining protocol or algorithm parameters.

const BC7_RGBA_SRGB

XuAPI
pub const BC7_RGBA_SRGB = 20

Purpose

Constant BC7_RGBA_SRGB, defining protocol or algorithm parameters.

struct FormatInfo

XuAPI
pub struct FormatInfo {
    pub block_width int
    pub block_height int
    pub block_bytes int
    pub srgb bool
    pub depth bool
}

Purpose

Structure encapsulating block_width, block_height, block_bytes, srgb, depth.

Public fields

block_width int
field (int)
block_height int
field (int)
block_bytes int
field (int)
srgb bool
field (bool)
depth bool
field (bool)

format_info

XuAPI
pub fn format_info(format int) FormatInfo

Purpose

Metadata is independent of sampler/render/storage usage support. Query the actual device before creating a resource with any of these formats. Throws on failure; handle the error or propagate it to the caller.

Parameters

format int
format (int)

Returns

FormatInfo — a value of this type