< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_gpu_buffer library

Description

Low level GPU buffers management module: creation, destruction and update (uniform buffers, shader storage buffer, etc).


Number of functions: 28

  1. gh_gpu_buffer.atomic_counter_set_value (Lua - Python)
  2. gh_gpu_buffer.atomic_counter_get_value (Lua - Python)
  3. gh_gpu_buffer.bind (Lua - Python)
  4. gh_gpu_buffer.bind_base (Lua - Python)
  5. gh_gpu_buffer.bind_range (Lua - Python)
  6. gh_gpu_buffer.create (Lua - Python)
  7. gh_gpu_buffer.create_from_uniform_block (Lua - Python)
  8. gh_gpu_buffer.map (Lua - Python)
  9. gh_gpu_buffer.map_range (Lua - Python)
  10. gh_gpu_buffer.set_matrix4x4 (Lua - Python)
  11. gh_gpu_buffer.set_value_1ui (Lua - Python)
  12. gh_gpu_buffer.set_value_1ui64_bindless_texture (Lua - Python)
  13. gh_gpu_buffer.set_value_1f (Lua - Python)
  14. gh_gpu_buffer.set_value_2f (Lua - Python)
  15. gh_gpu_buffer.set_value_3f (Lua - Python)
  16. gh_gpu_buffer.set_value_4f (Lua - Python)
  17. gh_gpu_buffer.sub_data_read_1f (Lua - Python)
  18. gh_gpu_buffer.sub_data_read_2f (Lua - Python)
  19. gh_gpu_buffer.sub_data_read_3f (Lua - Python)
  20. gh_gpu_buffer.sub_data_read_4f (Lua - Python)
  21. gh_gpu_buffer.sub_data_read_1ui (Lua - Python)
  22. gh_gpu_buffer.sub_data_write_1ui (Lua - Python)
  23. gh_gpu_buffer.sub_data_write_1f (Lua - Python)
  24. gh_gpu_buffer.sub_data_write_2f (Lua - Python)
  25. gh_gpu_buffer.sub_data_write_3f (Lua - Python)
  26. gh_gpu_buffer.sub_data_write_4f (Lua - Python)
  27. gh_gpu_buffer.unbind (Lua - Python)
  28. gh_gpu_buffer.unmap (Lua - Python)



atomic_counter_set_value

Description

Sets the value of an atomic counter.


Syntax

gh_gpu_buffer.atomic_counter_set_value(
 gbo,
 offset,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.atomic_counter_set_value(gbo, 4, x)
            


atomic_counter_get_value

Description

Gets the value of an atomic counter.


Syntax

x = gh_gpu_buffer.atomic_counter_get_value(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x = gh_gpu_buffer.atomic_counter_get_value(gbo, 4)
            


bind

Description

Binds a GPU buffer object.


Syntax

gh_gpu_buffer.bind(
 gbo
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind(gbo)
            


bind_base

Description

Binds a GPU buffer object on a specific buffer binding point.


Syntax

gh_gpu_buffer.bind_base(
 gbo,
 binding_point_index
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
            


bind_range

Description

Binds a part of a GPU buffer object on a specific buffer binding point.


Syntax

gh_gpu_buffer.bind_range(
 gbo,
 binding_point_index,
 offset,
 size
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
binding_point_index = 1            
gh_gpu_buffer.bind_range(gbo, binding_point_index, 128, 256)
            


create

Description

Creates a GPU buffer object.


Syntax

gbo = gh_gpu_buffer.create(
 buffer_type,
 buffer_usage,
 size,
 buffer_states
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
gbo = gh_gpu_buffer.create("SHADER_STORAGE", "GL_DYNAMIC_COPY", 256, "")
            


create_from_uniform_block

Description

Creates an uniform buffer object from a shader uniform block description.


Syntax

gbo = gh_gpu_buffer.create_from_uniform_block(
 buffer_usage,
 gpu_program_id,
 uniform_block_index,
 buffer_states
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
uniform_block_index = gh_gpu_program.get_interface_block_index(gpu_prog, "UNIFORM", "CameraMatrix")
gbo = gh_gpu_buffer.create_from_uniform_block("GL_DYNAMIC_READ", gpu_prog, uniform_block_index, "")
            


map

Description

Maps a GPU buffer.


Syntax

gh_gpu_buffer.map(
 gbo,
 access_mode
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.map(gbo, "GL_WRITE_ONLY")
WriteSomething(gbo)
gh_gpu_buffer.unmap(gbo)
            


map_range

Description

Maps a range of a GPU buffer.


Syntax

gh_gpu_buffer.map_range(
 gbo,
 offset,
 size,
 access_mode
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.map_range(gbo, 0, 256, "GL_MAP_WRITE_BIT GL_MAP_INVALIDATE_RANGE_BIT")
WriteSomething(gbo)
gh_gpu_buffer.unmap(gbo)
            


set_matrix4x4

Description

Writes a 4x4 matrix value to a GPU buffer. The matrix comes from an object.


Syntax

gh_gpu_buffer.set_matrix4x4(
 gbo,
 offset,
 object_id,
 matrix_type
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_matrix4x4(gbo, offset, camera_id,  "camera_view camera_projection")
            


set_value_1ui

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_1ui(
 gbo,
 offset,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_1ui(gbo, 0, x)
            


set_value_1ui64_bindless_texture

Description

Writes a value to a GPU buffer. For bindless textures only.


Syntax

gh_gpu_buffer.set_value_1ui64_bindless_texture(
 gbo,
 offset,
 texture_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_1ui64_bindless_texture(gbo, 0, tex)
            


set_value_1f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_1f(
 gbo,
 offset,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_1f(gbo, offset, x)
            


set_value_2f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_2f(
 gbo,
 offset,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_2f(gbo, offset, x, y)
            


set_value_3f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_3f(
 gbo,
 offset,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_3f(gbo, offset, x, y, z)
            


set_value_4f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_4f(
 gbo,
 offset,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.set_value_4f(gbo, offset, x, y, z, w)
            


sub_data_read_1f

Description

Reads a value from a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_read_1f(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
x = gh_gpu_buffer.sub_data_read_1f(gbo, 128)
gh_gpu_buffer.unbind(gbo)
            


sub_data_read_2f

Description

Reads a value from a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_read_2f(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
x, y = gh_gpu_buffer.sub_data_read_2f(gbo, 128)
gh_gpu_buffer.unbind(gbo)
            


sub_data_read_3f

Description

Reads a value from a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_read_3f(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
x, y, z = gh_gpu_buffer.sub_data_read_3f(gbo, 128)
gh_gpu_buffer.unbind(gbo)
            


sub_data_read_4f

Description

Reads a value from a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_read_4f(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
x, y, z, w = gh_gpu_buffer.sub_data_read_4f(gbo, 128)
gh_gpu_buffer.unbind(gbo)
            


sub_data_read_1ui

Description

Reads a value from a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_read_1ui(
 gbo,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
x = gh_gpu_buffer.sub_data_read_1ui(gbo, 4)
gh_gpu_buffer.unbind(gbo)
            


sub_data_write_1ui

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_1ui(
 gbo,
 offset,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.sub_data_write_1ui(gbo, 4, x)
gh_gpu_buffer.unbind(gbo)
            


sub_data_write_1f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_1f(
 gbo,
 offset,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.sub_data_write_1f(gbo, 128, x)
gh_gpu_buffer.unbind(gbo)
            


sub_data_write_2f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_2f(
 gbo,
 offset,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.sub_data_write_2f(gbo, 128, x, y)
gh_gpu_buffer.unbind(gbo)
            


sub_data_write_3f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_3f(
 gbo,
 offset,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.sub_data_write_3f(gbo, 128, x, y, z)
gh_gpu_buffer.unbind(gbo)
            


sub_data_write_4f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_4f(
 gbo,
 offset,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.sub_data_write_4f(gbo, 128, x, y, z, w)
gh_gpu_buffer.unbind(gbo)
            


unbind

Description

Unbinds a GPU buffer object.


Syntax

gh_gpu_buffer.unbind(
 gbo
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.unbind(gbo)
            


unmap

Description

Unmaps a GPU buffer.


Syntax

gh_gpu_buffer.unmap(
 gbo
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.map(gbo, "GL_WRITE_ONLY")
WriteSomething(gbo)
gh_gpu_buffer.unmap(gbo)
            






GeeXLab Rootard Guide | Downloads | Contact | Newsletter