Table of Contents

Class Drawing

Namespace
Hi.Disp
Assembly
HiDisp.dll

The most efficient elemental 3D rendering unit.

public class Drawing : IDisplayee, IExpandToBox3d, IDisposable
Inheritance
Drawing
Implements
Inherited Members
Extension Methods

Remarks

Thread safe for Display(Bind), Display(Bind, int), ExpandToBox3d(ref box3d_t), Dispose() and IsStale: the two displays, the dispose and IsStale take one lock of the drawing, so the drawing is never deleted while a display draws it, whichever thread deletes it (a stale drawing is deleted on the thread that disposes it); ExpandToBox3d(ref box3d_t) reads the box kept at construction.

Constructors

Drawing(double[], Stamp, int)

Construct a Drawing.

public Drawing(double[] src, Stamp stamp, int glPrimitive)

Parameters

src double[]

src

stamp Stamp

stamp

glPrimitive int

gl primitive

Drawing(double[], Stamp, int, bool)

Construct a Drawing; a rebuildable one when rebuildable is true.

public Drawing(double[] src, Stamp stamp, int glPrimitive, bool rebuildable)

Parameters

src double[]

src

stamp Stamp

stamp

glPrimitive int

gl primitive

rebuildable bool

whether to make the drawing rebuildable (the remarks): for an owner that keeps what it made src from and makes the drawing again once it went stale

Remarks

A drawing's buffer lives in the share group of the process's GL contexts, and the group dies with the last of them: when no canvas is shown, the display thread is idle and nothing is resident (ShareGroupGeneration). What becomes of the drawing then depends on its kind. Made with rebuildable false, a drawing of 64 KiB of data or less keeps a copy of it in core.dll and is uploaded again at its first display under the next group; a larger one keeps no copy and is resident: core.dll keeps a context alive for it as long as it exists (GlResidentNum), and on Intel's Windows driver every live context keeps one of the driver's threads busy on a whole core.

A rebuildable drawing, of whatever size, keeps no copy and is not resident. Once its group died it is stale (IsStale) and draws nothing; its owner disposes it, which deletes no GL name, and makes a new one inside its Display(Bind), where a context is current and the group cannot die. So the owner keeps the data on the CPU for as long as it may draw it. Made outside a frame while no other context lives (in a constructor, on a request thread), a rebuildable drawing is stale when the constructor returns: the context made for the construction was the whole group, and the group died with it. Its box is taken from src, never read back from the GPU.

With a core.dll older than the rebuildable kind the drawing is made as with rebuildable false, and IsRebuildable is false.

Properties

GlPrimitive

OpenGL Primitive.

public int GlPrimitive { get; set; }

Property Value

int

IsRebuildable

Whether this drawing is of the rebuildable kind: the path its constructor took (Drawing(double[], Stamp, int, bool)). False when the kind was not asked for, and false with a core.dll older than the kind: the drawing is then the one Drawing(double[], Stamp, int) makes.

public bool IsRebuildable { get; }

Property Value

bool

IsStale

Whether this drawing's GL buffer belongs to a share group that died (ShareGroupGeneration). A stale rebuildable drawing draws nothing, and its owner disposes it and makes a new one inside its Display(Bind); a stale drawing that is not rebuildable and holds 64 KiB of data or less is uploaded again from the copy core.dll keeps of it, at its next display, and is current again from then on. False once disposed, and false with a core.dll older than the question. Thread safe for Display(Bind), Display(Bind, int), ExpandToBox3d(ref box3d_t), Dispose() and IsStale.

public bool IsStale { get; }

Property Value

bool

Remarks

Asked inside a display, where a context is current, a false holds for the rest of the frame: a share group dies only with its last context. A true turns false only by a display of this drawing that uploads it again (the small drawing's case above), so it holds until the drawing is displayed. Asked anywhere else, it may be out of date by the time it is used.

KeyStamp

The only Stamp of this

public Stamp KeyStamp { get; }

Property Value

Stamp

Methods

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

Display(Bind, double[], Stamp, int)

Display by the given parameter.

public static void Display(Bind bind, double[] src, Stamp stamp, int glPrimitive)

Parameters

bind Bind

bind

src double[]

src

stamp Stamp

stamp

glPrimitive int

gl primitive

Display(Bind, int)

Display(Bind) with the forced gl primitive. Thread safe for Display(Bind), Display(Bind, int), ExpandToBox3d(ref box3d_t), Dispose() and IsStale.

public void Display(Bind bind, int forceGlPrimitive)

Parameters

bind Bind

bind

forceGlPrimitive int

forced gl primitive

Dispose()

public void Dispose()

Remarks

A stale drawing (IsStale) is deleted at once on the calling thread: it holds no GL name of a live group, so the delete needs no context and wakes nothing. Any other drawing is deleted through EnqueueTask(Task), on the display thread or at once on a thread that has a context.

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

ExpandToBox3d(ref box3d_t)

public void ExpandToBox3d(ref box3d_t dst)

Parameters

dst box3d_t

~Drawing()

protected ~Drawing()