< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_gpu_program library

Description

gh_gpu_program is the module that manages GPU programs based on the GLSL language: creation, destruction, binding, uniforms settings.


Number of functions: 48

  1. gh_gpu_program.bind (Lua - Python)
  2. gh_gpu_program.create (Lua - Python)
  3. gh_gpu_program.create_from_file (Lua - Python)
  4. gh_gpu_program.create_from_file_v3 (Lua - Python)
  5. gh_gpu_program.create_from_shader_files (Lua - Python)
  6. gh_gpu_program.create_from_zip_file (Lua - Python)
  7. gh_gpu_program.create_empty (Lua - Python)
  8. gh_gpu_program.add_shader_from_buffer (Lua - Python)
  9. gh_gpu_program.create_v2 (Lua - Python)
  10. gh_gpu_program.get_interface_block_index (Lua - Python)
  11. gh_gpu_program.get_uniform_block_size (Lua - Python)
  12. gh_gpu_program.get_uniform_size_and_offset (Lua - Python)
  13. gh_gpu_program.get_uniform_array_stride (Lua - Python)
  14. gh_gpu_program.get_vertex_attrib_name (Lua - Python)
  15. gh_gpu_program.run_compute (Lua - Python)
  16. gh_gpu_program.run_compute_group_size (Lua - Python)
  17. gh_gpu_program.set_livecoding_state (Lua - Python)
  18. gh_gpu_program.set_shader_storage_block_binding (Lua - Python)
  19. gh_gpu_program.set_uniform_block_binding (Lua - Python)
  20. gh_gpu_program.set_vertex_attrib_name (Lua - Python)
  21. gh_gpu_program.uniform_camera_matrices (Lua - Python)
  22. gh_gpu_program.uniform_camera_matrices_v2 (Lua - Python)
  23. gh_gpu_program.uniform_object_matrix (Lua - Python)
  24. gh_gpu_program.uniform_modelviewproj_matrices (Lua - Python)
  25. gh_gpu_program.uniform_4x4f (Lua - Python)
  26. gh_gpu_program.uniform1d (Lua - Python)
  27. gh_gpu_program.uniform2d (Lua - Python)
  28. gh_gpu_program.uniform3d (Lua - Python)
  29. gh_gpu_program.uniform4d (Lua - Python)
  30. gh_gpu_program.uniform1i (Lua - Python)
  31. gh_gpu_program.uniform2i (Lua - Python)
  32. gh_gpu_program.uniform3i (Lua - Python)
  33. gh_gpu_program.uniform4i (Lua - Python)
  34. gh_gpu_program.uniform1f (Lua - Python)
  35. gh_gpu_program.uniform2f (Lua - Python)
  36. gh_gpu_program.uniform3f (Lua - Python)
  37. gh_gpu_program.uniform4f (Lua - Python)
  38. gh_gpu_program.uniform1fv (Lua)
  39. gh_gpu_program.uniform2fv (Lua)
  40. gh_gpu_program.uniform3fv (Lua)
  41. gh_gpu_program.uniform4fv (Lua)
  42. gh_gpu_program.uniform1iv (Lua)
  43. gh_gpu_program.uniform1ui64 (Lua - Python)
  44. gh_gpu_program.uniform1ui64v (Lua)
  45. gh_gpu_program.uniform4i_array (Lua - Python)
  46. gh_gpu_program.uniform4f_array (Lua - Python)
  47. gh_gpu_program.uniform_subroutine (Lua - Python)
  48. gh_gpu_program.vk_create_from_spirv_module_file (Lua - Python)



bind

Description

Binds (makes it active) the GPU program to the renderer. To unbind a GPU program, just pass 0 as gpu program identifier.


Syntax

gh_gpu_program.bind(
 gpu_program
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog) -- Binding
...
gh_gpu_program.bind(0) -- Unbinding
            


create

Description

Creates a GLSL program from vertex (vs), pixel (ps), geometry (gs), tessellation control and evaluation (tcs and tes) or compute (cs) shaders.


Syntax

gpu_program = gh_gpu_program.create(
 vs,
 ps,
 gs,
 tcs,
 tes,
 cs
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
vs = "......"            
ps = "......"            
gpu_prog = gh_gpu_program.create(vs, ps, "", "", "", "")
            


create_from_file

Description

Loads a GLSL source code from file (the file contains all shaders) and creates a new GPU program node.


Syntax

gpu_program = gh_gpu_program.create_from_file(
 filename,
 absolute_path
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
abs_path = 0 -- relative path
gpu_prog = gh_gpu_program.create_from_file("data/shader.glsl", abs_path)
            


create_from_file_v3

Description

Loads a GLSL source code from file (the file contains all shaders) and creates a new GPU program node.


Syntax

gpu_program = gh_gpu_program.create_from_file_v3(
 program_name,
 filename
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
local demo_dir = gh_utils.get_demo_dir()                
gpu_prog = gh_gpu_program.create_from_file_v3("LightingProg", demo_dir .. "./data/lighting_prog.glsl")
            


create_from_shader_files

Description

Creates a GLSL program from separate shader files.


Syntax

gpu_program = gh_gpu_program.create_from_shader_files(
 program_name,
 vs_filename,
 ps_filename,
 gs_filename,
 tcs_filename,
 tes_filename,
 cs_filename
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
local demo_dir = gh_utils.get_demo_dir()                
vs = demo_dir .. "./shaders/vs.txt"            
ps = demo_dir .. "./shaders/ps.txt"            
gpu_prog = gh_gpu_program.create_from_shader_files("LightingProg", vs, ps, "", "", "", "")
            


create_from_zip_file

Description

Creates a GLSL program from separate shader files stored in a zip file.


Syntax

gpu_program = gh_gpu_program.create_from_zip_file(
 zip_filename,
 program_name,
 vs_filename,
 ps_filename,
 gs_filename,
 tcs_filename,
 tes_filename,
 cs_filename
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
local demo_dir = gh_utils.get_demo_dir()                
local zip_filename = demo_dir .. "demo.zip"
vs = "shaders/vs.txt"            
ps = "shaders/ps.txt"            
gpu_prog = gh_gpu_program.create_from_zip_file(zip_filename, "LightingProg", vs, ps, "", "", "", "")
            


create_empty

Description

Creates an empty GPU program.


Syntax

gpu_program = gh_gpu_program.create_empty(
 program_name
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
gpu_prog = gh_gpu_program.create_empty("GPUProg01")
            


add_shader_from_buffer

Description

Adds a shader, specified by a memory buffer, to an existing GPU program, created by create_empty().


Syntax

ret = gh_gpu_program.add_shader_from_buffer(
 gpu_program,
 buffer_ptr,
 buffer_size,
 shader_type
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
gpu_prog = gh_gpu_program.create_empty("GPUProg01")

-- shader types:
GPU_SHADER_VERTEX = 0
GPU_SHADER_PIXEL = 1
GPU_SHADER_GEOMETRY = 2
GPU_SHADER_TESS_CONTROL = 3
GPU_SHADER_TESS_EVAL = 4 
GPU_SHADER_COMPUTE = 5


filename = demo_dir .. "assets/vertex_shader.txt"
buffer, buffer_size = gh_utils.file_buffer_create(filename)
gh_gpu_program.add_shader_from_buffer(gpu_prog, buffer, buffer_size, GPU_SHADER_VERTEX)
gh_utils.file_buffer_kill(buffer)

filename = demo_dir .. "assets/pixel_shader.txt"
buffer, buffer_size = gh_utils.file_buffer_create(filename)
gh_gpu_program.add_shader_from_buffer(gpu_prog, buffer, buffer_size, GPU_SHADER_PIXEL)
gh_utils.file_buffer_kill(buffer)
            


create_v2

Description

Creates a GLSL program from vertex (vs), pixel (ps), geometry (gs), tessellation control (tcs), evaluation (tes) or compute (cs) shaders. All these shaders are memory buffers.


Syntax

gpu_program = gh_gpu_program.create_v2(
 program_name,
 vs,
 ps,
 gs,
 tcs,
 tes,
 cs
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
vs = "......"            
ps = "......"            
gpu_prog = gh_gpu_program.create_v2("LightingProg", vs, ps, "", "", "", "")
            


get_interface_block_index

Description

Gets the index of an interface block.


Syntax

block_index = gh_gpu_program.get_interface_block_index(
 gpu_program,
 block_type,
 block_name
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
index = gh_gpu_program.get_interface_block_index(gpu_prog, "UNIFORM", "CameraMatrix")
            


get_uniform_block_size

Description

Gets the size in bytes of an uniform block.


Syntax

block_size = gh_gpu_program.get_uniform_block_size(
 gpu_program,
 block_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
index = gh_gpu_program.get_interface_block_index(gpu_prog, "UNIFORM", "CameraMatrix")
size = gh_gpu_program.get_uniform_block_size(gpu_prog, index)
            


get_uniform_size_and_offset

Description

Gets the size and offset in bytes of a variable inside an uniform block.


Syntax

size, offset = gh_gpu_program.get_uniform_size_and_offset(
 gpu_program,
 variable_name
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
size, offset = gh_gpu_program.get_uniform_size_and_offset(gpu_prog, "positions")
            


get_uniform_array_stride

Description

Gets the stride in bytes of an array inside an uniform block.


Syntax

stride = gh_gpu_program.get_uniform_array_stride(
 gpu_program,
 variable_name
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
stride = gh_gpu_program.get_uniform_array_stride(gpu_prog, "positions")
            


get_vertex_attrib_name

Description

Gets the name of a vertex attribute.


Syntax

name = gh_gpu_program.get_vertex_attrib_name(
 gpu_program,
 vertex_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
gh_gpu_program.bind(gpu_prog)
name = gh_gpu_program.get_vertex_attrib_name(gpu_prog, 0)
            


run_compute

Description

Runs a compute program (OpenGL 4.3+ feature). See also: OpenGL 4.3: Compute Shaders Details (GL_ARB_compute_shader)


Syntax

gh_gpu_program.run_compute(
 gpu_program,
 num_groups_x, num_groups_y, num_groups_z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.run_compute(gpu_prog, 16, 16, 16)
            


run_compute_group_size

Description

Runs a compute program (OpenGL 4.3+ feature) and allows the specification of group size.


Syntax

gh_gpu_program.run_compute_group_size(
 gpu_program,
 num_groups_x, num_groups_y, num_groups_z,
 work_group_size_x, work_group_size_y, work_group_size_z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.run_compute_group_size(gpu_prog, num_groups_x, num_groups_y, num_groups_z, work_group_size_x, work_group_size_y, work_group_size_z)
            


set_livecoding_state

Description

Sets the live coding from file state. If state is 1, you can edit the shader in any text editor and instantly see the effects in GeeXLab.


Syntax

gh_gpu_program.set_livecoding_state(
 gpu_program,
 shader_type,
 state
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
GPU_SHADER_VERTEX = 0
GPU_SHADER_PIXEL = 1
GPU_SHADER_GEOMETRY = 2
GPU_SHADER_TESS_CONTROL = 3
GPU_SHADER_TESS_EVAL = 4
GPU_SHADER_COMPUTE = 5
shader_type = GPU_SHADER_PIXEL
state = 1
gh_gpu_program.set_livecoding_state(gpu_prog, shader_type, state)
            


set_shader_storage_block_binding

Description

Sets the buffer binding point of a shader storage block.


Syntax

gh_gpu_program.set_shader_storage_block_binding(
 gpu_program,
 block_index,
 binding_point_index
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.set_shader_storage_block_binding(gpu_prog, index, 3)
            


set_uniform_block_binding

Description

Sets the buffer binding point of an uniform block.


Syntax

gh_gpu_program.set_uniform_block_binding(
 gpu_program,
 block_index,
 binding_point_index
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.set_uniform_block_binding(gpu_prog, index, 2)
            


set_vertex_attrib_name

Description

Sets the name of a vertex attribute.


Syntax

gh_gpu_program.set_vertex_attrib_name(
 gpu_program,
 vertex_index,
 name
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.set_vertex_attrib_name(gpu_prog, 0, "gxl3d_Position")
            


uniform_camera_matrices

Description

Sets the matrices of a camera as uniforms.


Syntax

gh_gpu_program.uniform_camera_matrices(
 gpu_program,
 camera,
 uniform_name_view_mat,
 uniform_name_proj_mat
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

 
gh_gpu_program.uniform_camera_matrices(gpu_prog, camera, "ViewMat", "ProjMat")
            


uniform_camera_matrices_v2

Description

Sets the matrices of a camera as uniforms.


Syntax

gh_gpu_program.uniform_camera_matrices_v2(
 gpu_program,
 camera,
 uniform_name_view_mat,
 uniform_name_proj_mat,
 uniform_name_viewproj_mat
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

 
gh_gpu_program.uniform_camera_matrices_v2(gpu_prog, camera, "ViewMat", "ProjMat", "ViewProjMat")
            


uniform_object_matrix

Description

Sets the local matrix of an object as uniform.


Syntax

gh_gpu_program.uniform_object_matrix(
 gpu_program,
 object,
 uniform_name_mat
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

 
gh_gpu_program.uniform_object_matrix(gpu_prog, object, "ModelMat")
            


uniform_modelviewproj_matrices

Description

Sets the ModelViewProjection and ModelView matrices from a camera and an object.


Syntax

gh_gpu_program.uniform_modelviewproj_matrices(
 gpu_program,
 camera,
 object,
 uniform_name_modelviewproj_mat,
 uniform_name_modelview_mat
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

 
gh_gpu_program.uniform_modelviewproj_matrices(gpu_prog, camera, mesh,  "ModelViewProj", "ModelView")
            


uniform_4x4f

Description

Sets a 4x4 matrix uniform.


Syntax

gh_gpu_program.uniform_4x4f(
 gpu_program,
 uniform_name,
 m00 ... m15
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.uniform_4x4f(gpu_prog, "myMatrix", m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15)
            


uniform1d

Description

Sets the value of an FP64 uniform variable.


Syntax

gh_gpu_program.uniform1d(
 gpu_program,
 uniform_name,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1d(gpu_prog, "r", 0.25)
            


uniform2d

Description

Sets the value of an FP64 uniform variable.


Syntax

gh_gpu_program.uniform2d(
 gpu_program,
 uniform_name,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform2d(gpu_prog, "rg", 0.25, 0.22)
            


uniform3d

Description

Sets the value of an FP64 uniform variable.


Syntax

gh_gpu_program.uniform3d(
 gpu_program,
 uniform_name,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform3d(gpu_prog, "rgb", 0.25, 0.25, 0.45)
            


uniform4d

Description

Sets the value of an FP64 uniform variable.


Syntax

gh_gpu_program.uniform4d(
 gpu_program,
 uniform_name,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4d(gpu_prog, "rgba", 0.25, 0.25, 0.45, 1.0)
            


uniform1i

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform1i(
 gpu_program,
 uniform_name,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1i(gpu_prog, "index", 2)
            


uniform2i

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform2i(
 gpu_program,
 uniform_name,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform2i(gpu_prog, "rg", 250, 25)
            


uniform3i

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform3i(
 gpu_program,
 uniform_name,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform3i(gpu_prog, "rgb", 250, 25, 45)
            


uniform4i

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform4i(
 gpu_program,
 uniform_name,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4i(gpu_prog, "rgba", 250, 25, 45, 100)
            


uniform1f

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform1f(
 gpu_program,
 uniform_name,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
elapsed_time = gh_utils.get_elapsed_time()            
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1f(gpu_prog, "time", elapsed_time)
            


uniform2f

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform2f(
 gpu_program,
 uniform_name,
 x, y
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform2f(gpu_prog, "uv", 0.1, 1.0)
            


uniform3f

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform3f(
 gpu_program,
 uniform_name,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform3f(gpu_prog, "rgb", 0.25, 0.25, 0.45)
            


uniform4f

Description

Sets the value of an uniform variable.


Syntax

gh_gpu_program.uniform4f(
 gpu_program,
 uniform_name,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4f(gpu_prog, "rgba", 0.25, 0.25, 0.45, 1.0)
            


uniform1fv

Description

Sets the value of an uniform array.


Syntax

gh_gpu_program.uniform1fv(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
temperatures = {}
InitTemperatures(temperatures)
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1fv(gpu_prog, "temperatures", 10, temperatures)
            


uniform2fv

Description

Sets the value of an uniform array.


Syntax

gh_gpu_program.uniform2fv(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
uv = {} -- array element: {x=0, y=0}
InitUV(uv)
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform2fv(gpu_prog, "uv", 10, uv)
            


uniform3fv

Description

Sets the value of an uniform array.


Syntax

gh_gpu_program.uniform3fv(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
xyz = {}  -- array element: {x=0, y=0, z=0}
InitXYZ(xyz)
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform3fv(gpu_prog, "xyz", 10, xyz)
            


uniform4fv

Description

Sets the value of an uniform array.


Syntax

gh_gpu_program.uniform4fv(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
xyzw = {} -- array element: {x=0, y=0, z=0, w=0}
InitXYZW(xyzw)
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4fv(gpu_prog, "xyzw", 10, xyzw)
            


uniform1iv

Description

Sets the value of an uniform array.


Syntax

gh_gpu_program.uniform1iv(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
material_ids = {}
InitMaterialIDs(material_ids)
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1iv(gpu_prog, "material_ids", material_ids, 10)
            


uniform1ui64

Description

Sets the value of an uniform variable. Useful with bindless texture (OpenGL 4.4)


Syntax

gh_gpu_program.uniform1ui64(
 gpu_program,
 uniform_name,
 x
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1ui64(gpu_prog, "tex", bindless_texture_handle)
            


uniform1ui64v

Description

Sets the value of an uniform array. Useful with bindless texture (OpenGL 4.4)


Syntax

gh_gpu_program.uniform1ui64v(
 gpu_program,
 uniform_name,
 array_count,
 array
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
all_texture_handles = {}
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform1ui64v(gpu_prog, "all_textures", 32, all_texture_handles)
            


uniform4i_array

Description

Sets the value of an uniform array of vec4i. Currently limited to one vec4i.


Syntax

gh_gpu_program.uniform4i_array(
 gpu_program,
 uniform_name,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4i_array(gpu_prog, "all_textures", 0, 1, 2, 3)
            


uniform4f_array

Description

Sets the value of an uniform array of vec4. Currently limited to one vec4.


Syntax

gh_gpu_program.uniform4f_array(
 gpu_program,
 uniform_name,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_prog)
gh_gpu_program.uniform4f_array(gpu_prog, "all_params", 0.2, 10.4, 0.003, 0.001)
            


uniform_subroutine

Description

Sets the matrices of a camera as uniforms.


Syntax

gh_gpu_program.uniform_subroutine(
 gpu_program,
 shader_type,
 subroutine_uniform_name,
 subroutine_name
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

 
GPU_SHADER_VERTEX = 0
GPU_SHADER_PIXEL = 1
GPU_SHADER_GEOMETRY = 2
GPU_SHADER_TESS_CONTROL = 3
GPU_SHADER_TESS_EVAL = 4
GPU_SHADER_COMPUTE = 5
gh_gpu_program.uniform_subroutine(gpu_prog, GPU_SHADER_PIXEL, "Color", "ColorBlue")
            


vk_create_from_spirv_module_file

Description

Creates a Vulkan GPU program from SPIR-V modules.


Syntax

gpu_program = gh_gpu_program.vk_create_from_spirv_module_file(
 program_name,
 vs_filename,
 vs_entry_point,
 ps_filename,
 ps_entry_point,
 gs_filename,
 gs_entry_point,
 tcs_filename,
 tcs_entry_point,
 tes_filename,
 tes_entry_point,
 cs_filename,
 cs_entry_point
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
local demo_dir = gh_utils.get_demo_dir()                
vs = demo_dir .. "./shaders/vs.spv"            
ps = demo_dir .. "./shaders/ps.spv"            
gpu_prog = gh_gpu_program.vk_create_from_spirv_module_file("LightingProg", vs,"main",   ps,"main",   "","",   "","",   "","",   "","",)
            






GeeXLab Rootard Guide | Downloads | Contact | Newsletter