357 default:
return {4, 4, 16};
369 for (
u32 level = 0; level < (mipLevels ? mipLevels : 1); ++level) {
370 const u32 lw = (width >> level) ? (width >> level) : 1u;
371 const u32 lh = (height >> level) ? (height >> level) : 1u;
384 for (
u32 level = 0; level < (mipLevels ? mipLevels : 1); ++level) {
385 const u32 lw = (width >> level) ? (width >> level) : 1u;
386 const u32 lh = (height >> level) ? (height >> level) : 1u;
631 std::string out =
"GPU device lost: ";
637 out +=
", frame=" + std::to_string(info.
frame) +
"]";
Core type definitions and utilities for ESEngine.
2D texture for GPU rendering
static constexpr u32 MORPH_TEXTURE_WIDTH
FramebufferHandle
Handle 0 is the default framebuffer (backbuffer); it cannot be created or deleted.
constexpr bool meshShaderReads(MeshChannel c)
Whether the mesh shaders READ a channel, as opposed to the file carrying it.
constexpr AsyncComputeFence kNoAsyncComputeFence
static constexpr u32 MESH_INSTANCE_STRIDE
std::int32_t i32
Signed 32-bit integer.
@ MirroredRepeat
Tile with mirroring.
@ Repeat
Tile the texture.
@ ClampToEdge
Clamp to edge pixels.
GfxStringName
Backend identification strings.
std::uint64_t u64
Unsigned 64-bit integer.
static constexpr u32 MESH_INSTANCE_TEXELS
GfxDeviceLostReason
Why the device was lost. The report leads with this.
@ Validation
The backend rejected our commands fatally.
@ Reset
Driver/GPU reset — a hang watchdog (TDR) or a peer process's fault.
@ Removed
The adapter itself is gone: driver update, eGPU unplugged.
@ Destroyed
We destroyed it. A loss report that is not a failure.
@ Internal
The backend failed inside itself and said no more than that.
@ OutOfMemory
An allocation the backend could not satisfy.
@ ContextLost
The host took the context away (web webglcontextlost, surface teardown).
ClipDepthRange
What a device's clip volume does with depth.
@ ZeroToOne
WebGPU, and every native API behind it.
@ MinusOneToOne
OpenGL / OpenGL ES / WebGL.
static constexpr u32 MESH_INSTANCE_TEXEL_LIGHTMAP
static constexpr u32 MESH_INSTANCE_TEXEL_TINT
@ Storage
Read and written by compute shaders (var<storage, read_write>), and readable back....
static constexpr u32 MESH_INSTANCE_MAX_RECORDS
ComputeHandle
A compute program (GfxDevice::createCompute); only a device that supportsCompute() issues one.
GfxShaderLanguage
Shader source language a backend consumes.
static constexpr u32 MAX_VERTEX_ATTRIBUTES
@ Linear
Bilinear interpolation (smooth).
@ Nearest
No interpolation (pixelated look).
GfxShaderStage
Which pipeline stage rejected a program during createProgram().
GfxCompressedFormat
GPU-compressed texture internal formats for createCompressedTexture.
@ ETC2_RGBA8_SRGB
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC (core).
@ S3TC_DXT5
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT (extension).
@ ETC2_RGB8
GL_COMPRESSED_RGB8_ETC2 (core).
@ S3TC_DXT5_SRGB
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT (extension).
@ ASTC_8x8
GL_COMPRESSED_RGBA_ASTC_8x8_KHR (extension).
@ S3TC_DXT1
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT (extension).
@ ASTC_4x4_SRGB
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR (extension).
@ ETC2_RGBA8
GL_COMPRESSED_RGBA8_ETC2_EAC (core).
@ ASTC_4x4
GL_COMPRESSED_RGBA_ASTC_4x4_KHR (extension).
static constexpr u32 LAYOUT_COUNT
MeshChannelType
How a channel's components are stored, as the file spells it.
@ UNorm16
Skin weights at high precision.
@ UInt8
Joint indices of a skin or chunk of at most 256 bones: a byte each.
u32 gfxCompressedPyramidBytes(GfxCompressedFormat fmt, u32 width, u32 height, u32 mipLevels)
Total bytes of a full mip pyramid (levels 0..mipLevels-1) for a base-size compressed texture — the bl...
GfxDeviceStatus
Whether the device can still be drawn to.
@ Dead
Unrecoverable — the renderer will not draw again this run.
@ Recovering
A replacement device is being built; old handles stay dead.
@ Lost
Every handle issued before is dead; submission has stopped.
GfxReadbackStatus
State of an in-flight readback. GL completes at request time (first poll reports Ready); WebGPU resol...
std::uint32_t u32
Unsigned 32-bit integer.
static constexpr u32 MESH_INSTANCE_TEXTURE_WIDTH
static constexpr u32 MESH_INSTANCE_TEXTURE_UNIT
std::uint8_t u8
Unsigned 8-bit integer.
static constexpr u32 MESH_VARIANTS
@ Color
The page's RGBA, tinted: a rasterized atlas that carries native-AA coverage in alpha,...
static constexpr u32 MESH_MAX_ACTIVE_MORPHS
u32 gfxWholeBlockLevels(GfxCompressedFormat fmt, u32 width, u32 height, u32 mipLevels)
How many mip levels of a width x height image are WHOLE blocks, counting from the base — the levels a...
MeshChannel
What a mesh vertex channel MEANS, and the attribute location it binds to.
u32 gfxBytesPerPixel(GfxPixelFormat fmt)
Bytes one pixel occupies in the CALLER's upload buffer — the single source both backends size a read ...
static constexpr u32 MESH_INSTANCE_TEXEL_NORMAL
LayoutId
Identifies a transient vertex stream / vertex format. Each layout has its own VBO+EBO+VAO in Transien...
@ ParticleInstance
Instanced: a static unit quad + a per-particle instance stream.
static constexpr u32 MAX_VERTEX_BUFFER_SLOTS
const char * gfxDeviceLostReasonName(GfxDeviceLostReason reason)
Human-readable reason, for logs and diagnostics reports.
static constexpr u32 MESH_INSTANCE_TEXEL_MODEL
static constexpr u32 PARTICLE_INSTANCE_STRIDE
GfxBlockInfo gfxCompressedBlockInfo(GfxCompressedFormat fmt)
static constexpr u32 MORPH_MAX_TEXELS
GfxIntParam
Backend integer capabilities/limits.
ReadbackHandle
An in-flight framebuffer readback (GfxDevice::requestReadback).
float f32
32-bit floating point
std::string gfxFormatDeviceLost(const GfxDeviceLostInfo &info)
The whole report as one line, for a log or a crash report.
static constexpr u32 MESH_MAX_BONES
Immutable creation parameters of a GPU buffer.
Attachments of an offscreen render target. The attach point of depthStencil follows its texture's pix...
TextureHandle resolveColor2
TextureHandle resolveColor0
TextureHandle resolveDepthStencil
TextureHandle resolveColor1
Its single-sample twin, when the target is multisampled.
TextureHandle depthStencil
Vertex attribute location binding applied before a program is linked.
Block footprint of a compressed format, the single source both backends use to size each mip level's ...
One resource a compute dispatch binds, at @group(0) @binding(binding).
static GfxComputeBinding storageTexture(u32 binding, TextureHandle texture)
static GfxComputeBinding depth(u32 binding, TextureHandle texture)
static GfxComputeBinding uniform(u32 binding, BufferHandle buffer, u32 offset=0, u32 size=0)
static GfxComputeBinding sampled(u32 binding, TextureHandle texture)
static GfxComputeBinding storageRead(u32 binding, BufferHandle buffer, u32 offset=0, u32 size=0)
static GfxComputeBinding storage(u32 binding, BufferHandle buffer, u32 offset=0, u32 size=0)
u32 offset
Bytes into the buffer (a multiple of 256 for a uniform, 4 for storage) and how many; 0 = the rest.
TextureFilter filter
A Sampler's filter.
static GfxComputeBinding sampler(u32 binding, TextureFilter filter)
A compute program's source. Compute is WGSL only: GLSL ES 3.00 has no compute stage.
GfxShaderLanguage language
const char * entry
The @compute entry point.
Everything a human needs to know about one device loss.
std::string version
Driver / API version string.
std::string backend
"WebGL2", "WebGPU".
GfxDeviceIdentity identity
GfxDeviceLostReason reason
A program's source pair, tagged with the language it is written in.
GfxShaderLanguage language
u32 offset
Byte offset within one element of its buffer slot.
One render pass: a target, which attachments to clear on entry, and the clear values — full load-op s...
u32 clearH
Clear region size; 0 = the whole target.
i32 clearY
Clear region origin (pixels).
Immutable creation parameters of a 2D texture or 2D texture array.
bool asyncShareable
Allow a native compute queue to share this single-sample colour target.
bool layered() const
An array or a volume: pixels given slice by slice, fixed at creation, never an attachment.
Describes how vertex-buffer bytes map to shader attributes.
GfxVertexAttribute attributes[MAX_VERTEX_ATTRIBUTES]
u32 strides[MAX_VERTEX_BUFFER_SLOTS]
bool instanceStep[MAX_VERTEX_BUFFER_SLOTS]