internal void Apply()
        {
            // Checking dirty state
            if (!isDirty)
            {
                return;
            }

            if (data == null)
            {
                return;
            }

            // Compute correct register size
            int size = Math.Min(RegisterCount, data.Length);

            // Transmit to device
            for (int index = 0; index < size; index++)
            {
                if (VertexShaderRegisterIndex >= 0)
                {
                    device.SetVertexShaderConstantFloat4(VertexShaderRegisterIndex + index, ref data[index]);
                }
                if (PixelShaderRegisterIndex >= 0)
                {
                    device.SetPixelShaderConstantFloat4(PixelShaderRegisterIndex + index, ref data[index]);
                }
            }

            isDirty = false;
        }