CommandBuffer

class lluvia.core.CommandBuffer
begin(self)

Begin recording.

This method should be called before any record operation. Otherwise the behaviour is undefined.

changeImageLayout(self, Image img, ImageLayout newLayout)

Changes image layout.

The actual change in image layout is performed when this command buffer is submitted to execution. However, calling image.getLayout() right after this call will return the new layout value.

This is necessary to keep track of the current image layout of p image parameter after this call.

Parameters
  • img (Image.) – The image.

  • newLayout (lluvia.ImageLayout.) –

    The new layout. Its value must be one of the values defined in lluvia.ImageLayout:

    • Undefined

    • General

    • ColorAttachmentOptimal

    • DepthStencilAttachmentOptimal

    • DepthStencilReadOnlyOptimal

    • ShaderReadOnlyOptimal

    • TransferSrcOptimal

    • TransferDstOptimal

    • Preinitialized

    • PresentSrcKHR

    • SharedPresentKHR

    • DepthReadOnlyStencilAttachmentOptimalKHR

    • DepthAttachmentStencilReadOnlyOptimalKHR

clearImage(self, Image img)

Clears the pixels of the image to zero.

copyBuffer(self, Buffer src, Buffer dst)

Copies src buffer to dst.

The parameters must satisfy dst.size >= src.size.

Parameters
  • src (Buffer.) – Source buffer.

  • dst (Buffer.) – Destination buffer.

:raises RuntimeError : if dst.size < src.size:

copyBufferToImage(self, Buffer src, Image dst)

Copies the content of src Buffer to dst Image

No size check is currently being tested.

Parameters
  • src (Buffer.) – Source Buffer.

  • dst (Image.) – Source Image.

copyImageToBuffer(self, Image src, Buffer dst)

Copies the content of src Image to dst Buffer.

Parameters
  • src (Image.) – Source image.

  • dst (Buffer.) – Destination buffer.

copyImageToImage(self, Image src, Image dst)

Copies the content of src Image to dst Image.

The image parameters must be in the following layouts:

  • src: TransferSrcOptimal

  • dst: TransferDstOptimal

This method does not check if the images are in the correct layout. The results are undefined if the images are in any other layout.

Parameters
  • src (Image.) – Source image.

  • dst (Image.) – Destination buffer.

durationEnd(self, Duration d)

Stops recording the elapsed time between two points.

Parameters

d (Duration.) – The duration object.

durationStart(self, Duration d)

Starts recording the elapsed time between two points.

Parameters

d (Duration.) – The duration object.

end(self)

Ends recording.

Any following call to recording methods after this call have undefined behavior.

memoryBarrier(self)

Inserts a memory barrier.

TODO: details.

run(self, ComputeNode node)

Records running a compute node.

This operation uses node.grid to dispatch the compute shader. After the call of this method, node.grid can be changed to a new value.

Parameters

node (ComputeNode.) – The compute node.

session