# Execute Callback Reference

        RTSHADER_API bool (*RTS_Shader3_Execute)
        {
            IRTSExecutionState          *in_pExecState,
            void                        *in_pParams,
            XSI_RTS_Primitive           *in_pPrimitive,
            void                        *in_pAttributes,
            XSI_RTS_Attribute_Size      *in_pAttributesSize,
            void                        **io_pShaderInstanceData
        }

Once the shader has responded to GetAttributeList with its list of attributes, Softimage will package the values for these attributes and will pass them to the `Execute` function along with an array describing each attribute's size and format. Note that if an attribute was not found or was not defined on the mesh or point cloud, Softimage will pass a null pointer.

Note:
  This callback is mandatory

Parameters:

  | in_pExecState | The execution state interface
  | in_pParams | The shader property page parameters
  | in_pPrimitive | The geometry information
  | in_pAttributes | The Softimage RTS Attribute data
  | in_pAttributesSize | The sizes of the attributes
  | io_pShaderInstanceData | Pointer to This shader instance user data

Returns:
  Success/failure

Example:
  This example builds on the one on the GetAttributeList page. Here's what the Execute function might look like for the example shader described:

          RTSHADER_API bool MyShader_Execute
          (
              IRTSExecutionState      *in_pExecState,
              void                    *in_pParams,
              XSI_RTS_Primitive       *in_pPrimitive,
              void                    *in_pAttributes,
              eXSI_Attribute_Size     *in_pAttributesSize,
              void                    **io_pInstanceData
          )
          {
              ShaderPPG* options = (ShaderPPG*)in_pParams;

              if (options->useColor)
              {
                  float* pfPositions  = ((float**)in_pAttributes)[0];
                  float* pfNormals    = ((float**)in_pAttributes)[1];
                  float* pfColors0    = ((float**)in_pAttributes)[2];
                  float* pfColors1    = ((float**)in_pAttributes)[3];
                  float* pfFoobars    = ((float**)in_pAttributes)[4];
                  ...
              } else {
                  float* pfPositions  = ((float**)in_pAttributes)[0];
                  float* pfNormals    = ((float**)in_pAttributes)[1];
                  float* pfFoobars    = ((float**)in_pAttributes)[2];
                  ...
              }

              ...
          }

See also:
  IRTSExecutionState, Realtime Shader Callbacks, Geometry Data, Execution Flow