Resource Slot in Daslang

Storing in Daslang + ECS is more convenient.

However, we can store NodeHandleWithSlotsAccess outside ECS with daFrameGraph.resource_slot module.

Unfortunately, NodeHandleWithSlotsAccess can’t be stored in local Daslang variable, because das doesn’t call destructors for local types. If you really need to store handle outside ECS, you have to store handle in heap or make binding for storing it on cpp-side.

Also hot-reload will work automatically for nodes inside ECS.

require daFrameGraph.resource_slot

some_cpp_binding <| $(var handle : NodeHandleWithSlotsAccess &)
  some_struct.handle <- root() |> registerAccess("node_name", [[SlotActions update <- [{auto Update("slot_name", "texture_name", 100)}] ]]) <| @(slots_state; var registry : Registry)

    return <- @ <|
      // some render code

Constants

DEFAULT_READ_PRIORITY = 2147483647
Create

Create fields are

slot

string

resource

string

Update

Update fields are

slot

string

resource

string

priority

int

Read

Read fields are

slot

string

priority

int

SlotActions

SlotActions fields are

create

array< resource_slot::Create >

update

array< resource_slot::Update >

read

array< resource_slot::Read >

Register Access

registerAccess(self: NameSpace; name: string const; slot_decl: SlotActions const; declaration_callback: lambda<(slots_state:ResourceSlotCore::State const;var reg:daFrameGraph::Registry -const):lambda<void>>)

registerAccess returns ResourceSlotCore::NodeHandleWithSlotsAccess.

Argument

Argument type

self

daFrameGraph::NameSpace

name

string const

slot_decl

resource_slot::SlotActions const

declaration_callback

lambda<(slots_state: ResourceSlotCore::State const;reg: daFrameGraph::Registry ):lambda<>>