GPU Compute Utilities (gpu.compute)

This module provides access to the global GPU compute functions.

gpu.compute.dispatch(shader, groups_x_len, groups_y_len, groups_z_len, barrier=GPU_BARRIER_TEXTURE_FETCH | GPU_BARRIER_SHADER_IMAGE_ACCESS)

Dispatches GPU compute.

Parameters:
  • shader (gpu.types.GPUShader) – The shader that you want to dispatch.

  • groups_x_len (int) – Int for group x length:

  • groups_y_len (int) – Int for group y length:

  • groups_z_len (int) – Int for group z length:

  • barrier (int) – Optional bitmask for GPU_memory_barrier(). Default: GPU_BARRIER_TEXTURE_FETCH | GPU_BARRIER_SHADER_IMAGE_ACCESS.

Available flags:

  • gpu.GPU_BARRIER_FRAMEBUFFER

  • gpu.GPU_BARRIER_SHADER_IMAGE_ACCESS

  • gpu.GPU_BARRIER_TEXTURE_FETCH

  • gpu.GPU_BARRIER_TEXTURE_UPDATE

  • gpu.GPU_BARRIER_COMMAND

  • gpu.GPU_BARRIER_SHADER_STORAGE

  • gpu.GPU_BARRIER_VERTEX_ATTRIB_ARRAY

  • gpu.GPU_BARRIER_ELEMENT_ARRAY

  • gpu.GPU_BARRIER_UNIFORM

  • gpu.GPU_BARRIER_BUFFER_UPDATE

Compose with |, e.g.:

gpu.GPU_BARRIER_SHADER_STORAGE | gpu.GPU_BARRIER_TEXTURE_FETCH
Returns:

Shader object.

Return type:

gpu.types.GPUShader