-
using wgpu as a base for this
-
remove a lot of complexity from:
-
latent ID initialization
-
different forms of API (core vs hal)
-
buffer init descriptor:
-
content (actual buffer data)
-
usage (vertex, index, image, uniform, copy dst etc.)
-
vertex buffer layout:
-
stride
-
step mode (vertex vs instance)
-
attributes[]:
-
texture descriptor:
-
size:
-
width
-
height
-
depth or array layers
-
mip level count
-
sample count
-
dimension (2D, 3D etc.)
-
format
-
usage (texture binding, render attachment, copy dst etc.)
-
sampler descriptor:
-
address mode[] (repeat, clamp to edge etc.):
-
mag filter (linear, nearest)
-
min filter (linear, nearest)
-
mipmap filter
-
lod min clamp
-
lod max clamp
-
compare func
-
anisotropy clamp
-
border color
-
binding type texture:
-
sample type
-
view dimension
-
multisampled
-
binding type sampler (filtering, comparison etc.)
-
binding type buffer:
-
ty (storage, uniform)
-
has dynamic offset
-
binding type storage texture:
-
acces (RO, WO, RW)
-
format
-
view dimension
-
bind group layout descriptor:
-
entries[]:
-
binding (0, 1, ...)
-
visibility (fragment, vertex etc.)
-
ty (binding type)
-
count (only relevant if ty is a texture -> num of elements in array texture)
-
bind group descriptor:
-
bind group layout descriptor
-
entries[]:
-
binding (0, 1, ...)
-
resource (texture view obj, sampler obj)
-
shader module descriptor:
-
color target state:
-
format (of texture)
-
blend (replace, alpha etc.)
-
write_mask (all, just alpha etc.)
-
render pipeline descriptor:
-
pipeline layout descriptor:
-
bind group layout[]
-
push constant ranges[]
-
vertex state:
-
shader module descriptor
-
buffers[] (vertex buffer layout)
-
fragment state:
-
shader module descriptor
-
targets[]
-
primitive state:
-
topology (triangle list, fan etc.)
-
strip index format
-
front face (CW vs CCW)
-
cull mode (back, front etc.)
-
polygon mode (fill, lines etc.)
-
depth stencil:
-
format
-
depth write enabled
-
depth compare func
-
stencil
-
bias
-
multisample state:
-
count
-
mask (which samples are active)
-
alpha to coverage enabled (supposedly for AA, don't know more tho)
-
multiview (array texture target)
-
render pass descriptor:
-
color attachments[]:
-
view (of render target)
-
ops[] (clear on load etc.)
-
depth stencil attachment:
-
view (texture view of depth texture)
-
depth ops (e.g. clear op to 1.0)
-
stencil ops (similar to above)
-
get device and queue
-
create command encoder on device
-
create renderpass on command encoder from renderpass descriptor
-
set pipeline descriptor on render pass
-
set bind group at group index
-
set vertex buffer at slot
-
set index buffer with format (u16, u8 etc.)
-
call draw on renderpass (with vertex and instance count)
-
submit renderpass to a queue