Binds symbol names to registers.
For symbol_name, specify any symbol name. For start_index and end_index, specify the starting position and ending position of the register being bound.
For the register being bound, you can specify an input register, a floating-point constant register, an integer register, or a Boolean register.
If you do not specify a value for end_index and define this as #pragma bind_symbol(symbol_name, start_index), the starting position and ending position of the register being bound will take the values of the register specified by start_index.
When the application loads the executable file of a shader assembler in which bind_symbol is defined, the input register can be set by using defined symbol names for arguments of functions such as glGetAttribLocation and glBindAttribLocation. In the same way, floating-point constant registers, integer registers, and Boolean registers can be set by using defined symbol names for the arguments of functions such as glGetUniformLocation.
When configuring the settings of a floating-point constant register you can specify the components.
Specify the components as follows: [symbol_name].[one or more components].
Specify consecutive components in the order of xyzw. (Consecutive components, such as xy, yzw and zw are allowed, but not xz, yw, or xyw.)
In the settings for input registers, you cannot set multiple symbol names for the same input register. In addition, start_index and end_index must not be the same value.
The settings configured for an input register determine which vertex attributes will be input to the graphics pipeline.
In other words, an input register that has not been bound to a symbol by these settings will not be recognized as a vertex attribute for input, and as a result some indefinite value will be stored.
If components have been specified for an input register, the number of components specified will affect the type obtained by the glGetActiveAttrib function but otherwise will have no effect. If the value specified for size in the glVertexAttribPointer function is 1, 2, or 3, the corresponding input register will load the vertex attribute data to x, xy, or xyz, respectively. The default value will be loaded to any component to which vertex attribute data has not been loaded. The default values for y, z, and w are respectively 0, 0, and 1.
The register specified by bind_symbol cannot define a constant with the def, defb or defi instruction inside the same shader assembler or inside any object that is referenced at link time. You can use up to 16 input registers. However, when rendering using the vertex buffer, you cannot load vertex attribute data into more than 12 input registers. Do not use the vertex buffer if your shader assembler has bind_symbol defined for 13 or more input registers.
The hardware will not operate correctly if the vertex shader cannot read input registers at all. As long as at least one component of some input register can be read in each vertex process, you will not violate this restriction. To meet this restriction, the contents of this input register can be indeterminate, but they must be read.
// Assembler source code
#pragma bind_symbol ( ModelViewMatrix , c0 , c3 )
#pragma bind_symbol ( Position , v0 )
#pragma bind_symbol ( LoopCounter0 , i1 , i1 )
#pragma bind_symbol ( bFirst , b2 , b2 )
#pragma bind_symbol ( Scalar.x , c4, c4 ) // The Scalar symbol is assigned to c4.x
// Application source code
glBindAttribLocation ( program , 0 , "Position" );
glEnableVertexAttribArray(0);
uniform_location = glGetUniformLocation ( program , "ModelViewMatrix" );
GLfloat matrix[4][4];
glUniform4fv ( uniform_location , 4 , matrix );
GLfloat scalar_value;
uniform_location = glGetUniformLocation ( program , "Scalar" );
glUniform1f ( uniform_location , scalar_value );
uniform_location = glGetUniformLocation ( program , "bFirst" );
glUniform1i ( uniform_location , GL_TRUE );
GLint loop_setting[3] = { 4 , 0 , 1 } ; // loop_count-1 , init , step
uniform_location = glGetUniformLocation ( program , "LoopCounter0" );
glUniform3iv ( uniform_location , loop_setting );
CONFIDENTIAL