< 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: 29

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



atomic_counter_get_value

Description

Gets the value of an atomic counter.


Syntax

x = gh_gpu_buffer.atomic_counter_get_value(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


x = gh_gpu_buffer.atomic_counter_get_value(gpubuff_id, 4)
			


atomic_counter_set_value

Description

Sets the value of an atomic counter.


Syntax

gh_gpu_buffer.atomic_counter_set_value(
 gpubuff_id,
 offset,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.atomic_counter_set_value(gpubuff_id, 4, x)
			


bind

Description

Binds a GPU buffer object.


Syntax

gh_gpu_buffer.bind(
 gpubuff_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind(gpubuff_id)
			


bind_base

Description

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


Syntax

gh_gpu_buffer.bind_base(
 gpubuff_id,
 binding_point_index
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)
			


bind_range

Description

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


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


create

Description

Creates a GPU buffer object.


Syntax

gpubuff_id = gh_gpu_buffer.create(
 buff_type,
 buff_usage,
 buff_size,
 buff_states
)

Languages


Parameters


Return Values


Code sample


gpubuff_id = 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

gpubuff_id = gh_gpu_buffer.create_from_uniform_block(
 buff_usage,
 gpuprog_id,
 uniform_block_index,
 buff_states
)

Languages


Parameters


Return Values


Code sample


uniform_block_index = gh_gpu_program.get_interface_block_index(gpuprog_id, "UNIFORM", "CameraMatrix")

gpubuff_id = gh_gpu_buffer.create_from_uniform_block("GL_DYNAMIC_READ", gpuprog_id, uniform_block_index, "")
			


map

Description

Maps a GPU buffer.


Syntax

buffer, buff_size = gh_gpu_buffer.map(
 gpubuff_id,
 access_mode
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

buffer, buffer_size = gh_gpu_buffer.map(gpubuff_id, "GL_WRITE_ONLY")
... WriteSomething(buffer, buffer_size)
gh_gpu_buffer.unmap(gpubuff_id)
			


map_range

Description

Maps a range of a GPU buffer.


Syntax

buffer, buff_size = gh_gpu_buffer.map_range(
 gpubuff_id,
 offset,
 size,
 access_mode
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

buffer, buffer_size = gh_gpu_buffer.map_range(gpubuff_id, 0, 256, "GL_MAP_WRITE_BIT GL_MAP_INVALIDATE_RANGE_BIT")
... WriteSomething(buffer, buffer_size)
gh_gpu_buffer.unmap(gpubuff_id)
			


set_matrix4x4

Description

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


Syntax

gh_gpu_buffer.set_matrix4x4(
 gpubuff_id,
 offset,
 obj_id,
 matrix_type
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.set_matrix4x4(gpubuff_id, offset, cam_id, "camera_view camera_projection")
			


set_value_1f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_1f(
 gpubuff_id,
 offset,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.set_value_1f(gpubuff_id, offset, x)
			


set_value_1ui

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_1ui(
 gpubuff_id,
 offset,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.set_value_1ui(gpubuff_id, 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(
 gpubuff_id,
 offset,
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.set_value_1ui64_bindless_texture(gpubuff_id, 0, tex_id)
			


set_value_2f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_3f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_value_4f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


sub_data_read_1f

Description

Reads a value from a GPU buffer.


Syntax

x = gh_gpu_buffer.sub_data_read_1f(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

x = gh_gpu_buffer.sub_data_read_1f(gpubuff_id, 128)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_read_1ui

Description

Reads a value from a GPU buffer.


Syntax

x = gh_gpu_buffer.sub_data_read_1ui(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

x = gh_gpu_buffer.sub_data_read_1ui(gpubuff_id, 4)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_read_2f

Description

Reads a value from a GPU buffer.


Syntax

x, y = gh_gpu_buffer.sub_data_read_2f(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

x, y = gh_gpu_buffer.sub_data_read_2f(gpubuff_id, 128)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_read_3f

Description

Reads a value from a GPU buffer.


Syntax

x, y, z = gh_gpu_buffer.sub_data_read_3f(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

x, y, z = gh_gpu_buffer.sub_data_read_3f(gpubuff_id, 128)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_read_4f

Description

Reads a value from a GPU buffer.


Syntax

x, y, z, w = gh_gpu_buffer.sub_data_read_4f(
 gpubuff_id,
 offset
)

Languages


Parameters


Return Values


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

x, y, z, w = gh_gpu_buffer.sub_data_read_4f(gpubuff_id, 128)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_write_1f

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_1f(
 gpubuff_id,
 offset,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.sub_data_write_1f(gpubuff_id, 128, x)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_write_1ui

Description

Writes a value to a GPU buffer.


Syntax

gh_gpu_buffer.sub_data_write_1ui(
 gpubuff_id,
 offset,
 x
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.sub_data_write_1ui(gpubuff_id, 4, x)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_write_2f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.sub_data_write_2f(gpubuff_id, 128, x, y)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_write_3f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.sub_data_write_3f(gpubuff_id, 128, x, y, z)

gh_gpu_buffer.unbind(gpubuff_id)
			


sub_data_write_4f

Description

Writes a value to a GPU buffer.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.sub_data_write_4f(gpubuff_id, 128, x, y, z, w)

gh_gpu_buffer.unbind(gpubuff_id)
			


unbind

Description

Unbinds a GPU buffer object.


Syntax

gh_gpu_buffer.unbind(
 gpubuff_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.unbind(gpubuff_id)
			


unmap

Description

Unmaps a GPU buffer.


Syntax

gh_gpu_buffer.unmap(
 gpubuff_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.bind_base(gpubuff_id, 0)

gh_gpu_buffer.map(gpubuff_id, "GL_WRITE_ONLY")
... WriteSomething(gpubuff_id)
gh_gpu_buffer.unmap(gpubuff_id)
			


set_value_4x4f

Description

Writes a value (a 4x4 matrix) to a GPU buffer.


Syntax

gh_gpu_buffer.set_value_4x4f(
 gpubuff_id,
 offset,
 m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_buffer.set_value_4x4f(gpubuff_id, offset, m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15)
			






GeeXLab Rootard Guide | Downloads | Contact | Newsletter