Gets an index for a constant in a <Program>. The result can then be used to set the value of the constant, which will be set in the <Program> before the <Program> is executed.
int32 GetProgramConstantIndex( uint64 p_iHandle, string p_sConstantName )
Parameter Type | Parameter Name | Documentation |
---|---|---|
uint64 | p_iHandle | A handle to the program to get a constant index for, or 0 to use the current program activated in the rendering device. |
string | p_sConstantName | The name of the constant to get the index for. |
// Scenome Scripting Language Code
Render3D a_oAccel = Application.GetAccelerate3D();
auto RenderInfo a_oRenderInfo = new RenderInfo( a_oAccel );
auto Program a_oProgram;
a_oProgram.SetComputeFile( "C:\\MyProject\\MyComputeShader.glsl" );
int a_nBindShader = a_oProgram.Select( a_oRenderInfo );
int a_nConstantIndex = a_oAccel.GetProgramConstantIndex( a_oProgram.GetHandle(), "my_uniform_pi" );
double a_fPi = 3.14159265359;
a_oAccel.SetProgramConstantFloat32(
a_oProgram.GetHandle(), a_nConstantIndex, a_fPi );
// Corresponding Compute Shader Code
#version 460 core
layout( local_size_x = 32, local_size_y = 32, local_size_z = 1 ) in;
uniform float my_uniform_pi;
void main(void)
{
// Do some compute...
}