» Back to Reference Guide Index
gh_gpu_buffer Library
DescriptionLow level GPU buffers management module: creation, destruction and update (uniform buffers, shader storage buffer, etc).
Number of functions: 25
gh_gpu_buffer.create_from_uniform_block
Description
Creates an uniform buffer object from a shader uniform block description.
LanguagesLua - Python
Parameters
buffer_usage [STRING]: usage based on OpenGL constants: 'GL_STATIC_DRAW', 'GL_DYNAMIC_READ', etc.
gpu_program_id [integer]: GPU program identifier
uniform_block_index [integer]: index of the uniform block in the shader. Use gh_gpu_program.get_interface_block_index() to get this index.
buffer_states [STRING]: reserved. Set it to ''
Return Values
gbo [INTEGER]: identifier
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, "")
gh_gpu_buffer.create
Description
Creates a GPU buffer object.
LanguagesLua - Python
Parameters
buffer_type [STRING]: type of the buffer: 'UNIFORM', 'SHADER_STORAGE', 'ATOMIC_COUNTER', etc.
buffer_usage [STRING]: usage based on OpenGL constants: GL_STATIC_DRAW, GL_DYNAMIC_READ, etc.
size [integer]: size of the buffer in bytes.
buffer_states [STRING]: reserved. Set it to ''
Return Values
gbo [INTEGER]: identifier
Code sample
gbo = gh_gpu_buffer.create("SHADER_STORAGE", "GL_DYNAMIC_COPY", 256, "")
gh_gpu_buffer.bind
Description
Binds a GPU buffer object.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.bind(gbo)
gh_gpu_buffer.unbind
Description
Unbinds a GPU buffer object.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.unbind(gbo)
gh_gpu_buffer.bind_base
Description
Binds a GPU buffer object on a specific buffer binding point.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
binding_point_index [INTEGER]: index of the binding point
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.bind_base(gbo, 0)
gh_gpu_buffer.bind_range
Description
Binds a part of a GPU buffer object on a specific buffer binding point.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
binding_point_index [INTEGER]: index of the binding point
offset [INTEGER]: offset from the start of the buffer in bytes
size [INTEGER]: size in bytes
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)
gh_gpu_buffer.sub_data_write_1ui
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x [INTEGER]: value
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)
gh_gpu_buffer.sub_data_read_1ui
Description
Reads a value from a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
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)
gh_gpu_buffer.sub_data_write_1f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x [REAL]: value
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)
gh_gpu_buffer.sub_data_read_1f
Description
Reads a value from a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
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)
gh_gpu_buffer.sub_data_write_2f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y [REAL]: value
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)
gh_gpu_buffer.sub_data_read_2f
Description
Reads a value from a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
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)
gh_gpu_buffer.sub_data_write_3f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y, z [REAL]: value
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)
gh_gpu_buffer.sub_data_read_3f
Description
Reads a value from a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
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)
gh_gpu_buffer.sub_data_write_4f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y, z, w [REAL]: value
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)
gh_gpu_buffer.sub_data_read_4f
Description
Reads a value from a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
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)
gh_gpu_buffer.map
Description
Maps a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
access_mode [STRING]: Access mode based on OpenGL constants: 'GL_READ_WRITE', 'GL_WRITE_ONLY', 'GL_READ_ONLY'
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)
gh_gpu_buffer.map_range
Description
Maps a range of a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
size [INTEGER]: size in bytes
access_mode [STRING]: Access mode based on OpenGL constants: 'GL_MAP_READ_BIT', 'GL_MAP_WRITE_BIT', 'GL_MAP_INVALIDATE_RANGE_BIT', 'GL_MAP_INVALIDATE_BUFFER_BIT', etc
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)
gh_gpu_buffer.set_value_1ui64_bindless_texture
Description
Writes a value to a GPU buffer. For bindless textures only.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
texture_id [INTEGER]: bindless texture
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_1ui64_bindless_texture(gbo, 0, tex)
gh_gpu_buffer.set_value_1ui
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x [INTEGER]: value
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_1ui(gbo, 0, x)
gh_gpu_buffer.set_value_1f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x [REAL]: value
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_1f(gbo, offset, x)
gh_gpu_buffer.set_value_2f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y [REAL]: value
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_2f(gbo, offset, x, y)
gh_gpu_buffer.set_value_3f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y, z [REAL]: value
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_3f(gbo, offset, x, y, z)
gh_gpu_buffer.set_value_4f
Description
Writes a value to a GPU buffer.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
x, y, z, w [REAL]: value
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_value_4f(gbo, offset, x, y, z, w)
gh_gpu_buffer.set_matrix4x4
Description
Writes a 4x4 matrix value to a GPU buffer. The matrix comes from an object.
LanguagesLua - Python
Parameters
gbo [INTEGER]: identifier
offset [INTEGER]: offset from the start of the buffer in bytes
object_id [INTEGER]: object identifier
matrix_type [STRING]: type of the matrix: 'camera_view_projection', 'camera_view', 'camera_projection', 'object_local_tranform', 'object_global_tranform'
Return Values
This function has no return value(s).
Code sample
gh_gpu_buffer.set_matrix4x4(gbo, offset, camera_id, "camera_view camera_projection")
2013-2015 Geeks3D. All Rights Reserved.
.:- G3D Network -:.
|