mirror of
https://github.com/holub/mame
synced 2025-05-21 13:18:56 +03:00
More changes in order to create task groups
This commit is contained in:
parent
abd2ff0506
commit
fbbdb817d7
@ -36,14 +36,13 @@ struct dso_wavelog_context
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static DISCRETE_START( dso_task )
|
static void task_check(discrete_task *task, discrete_task *dest_task)
|
||||||
{
|
{
|
||||||
discrete_task *task = (discrete_task *) node->context;
|
|
||||||
int inputnum;
|
int inputnum;
|
||||||
const linked_list_entry *node_entry;
|
const linked_list_entry *node_entry;
|
||||||
const linked_list_entry *step_entry;
|
const linked_list_entry *step_entry;
|
||||||
|
|
||||||
/* Determine, which nodes in the task are referenced in the main task
|
/* Determine, which nodes in the task are referenced by nodes in dest_task
|
||||||
* and add them to the list of nodes to be buffered for further processing
|
* and add them to the list of nodes to be buffered for further processing
|
||||||
*/
|
*/
|
||||||
for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next)
|
for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next)
|
||||||
@ -51,14 +50,14 @@ static DISCRETE_START( dso_task )
|
|||||||
node_description *task_node = (node_description *) node_entry->ptr;
|
node_description *task_node = (node_description *) node_entry->ptr;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
for (step_entry = task_node->info->main_list; step_entry != NULL; step_entry = step_entry->next)
|
for (step_entry = dest_task->list; step_entry != NULL; step_entry = step_entry->next)
|
||||||
{
|
{
|
||||||
node_description *main_node = (node_description *) step_entry->ptr;
|
node_description *dest_node = (node_description *) step_entry->ptr;
|
||||||
|
|
||||||
/* loop over all active inputs */
|
/* loop over all active inputs */
|
||||||
for (inputnum = 0; inputnum < main_node->active_inputs; inputnum++)
|
for (inputnum = 0; inputnum < dest_node->active_inputs; inputnum++)
|
||||||
{
|
{
|
||||||
int inputnode = main_node->block->input_node[inputnum];
|
int inputnode = dest_node->block->input_node[inputnum];
|
||||||
if IS_VALUE_A_NODE(inputnode)
|
if IS_VALUE_A_NODE(inputnode)
|
||||||
{
|
{
|
||||||
if (NODE_DEFAULT_NODE(task_node->block->node) == NODE_DEFAULT_NODE(inputnode))
|
if (NODE_DEFAULT_NODE(task_node->block->node) == NODE_DEFAULT_NODE(inputnode))
|
||||||
@ -75,20 +74,21 @@ static DISCRETE_START( dso_task )
|
|||||||
if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
|
if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
|
||||||
fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
|
fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
|
||||||
|
|
||||||
discrete_log(task_node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_BLOCKINDEX(main_node));
|
discrete_log(task_node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_BLOCKINDEX(dest_node));
|
||||||
task->node_buf[task->numbuffered] = auto_alloc_array(task_node->info->device->machine, double, 2048);
|
task->node_buf[task->numbuffered] = auto_alloc_array(task_node->info->device->machine, double, 2048);
|
||||||
task->source[task->numbuffered] = (double *) main_node->input[inputnum];
|
task->source[task->numbuffered] = (double *) dest_node->input[inputnum];
|
||||||
task->nodes[task->numbuffered] = discrete_find_node(task_node->info, inputnode);
|
task->nodes[task->numbuffered] = discrete_find_node(task_node->info, inputnode);
|
||||||
|
|
||||||
/* register into source list */
|
/* register into source list */
|
||||||
source = auto_alloc(task_node->info->device->machine, discrete_source_node);
|
source = auto_alloc(dest_node->info->device->machine, discrete_source_node);
|
||||||
linked_list_add(task_node->info,
|
linked_list_add(dest_node->info,
|
||||||
(linked_list_entry **) &task_node->info->source_list,
|
(linked_list_entry **) &dest_task->source_list,
|
||||||
source);
|
source);
|
||||||
source->task = task;
|
source->task = task;
|
||||||
source->output_node = task->numbuffered;
|
source->output_node = task->numbuffered;
|
||||||
|
|
||||||
/* point the input to a buffered location */
|
/* point the input to a buffered location */
|
||||||
main_node->input[inputnum] = &source->buffer;
|
dest_node->input[inputnum] = &source->buffer;
|
||||||
|
|
||||||
task->numbuffered++;
|
task->numbuffered++;
|
||||||
}
|
}
|
||||||
@ -99,6 +99,27 @@ static DISCRETE_START( dso_task )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DISCRETE_START( dso_task )
|
||||||
|
{
|
||||||
|
discrete_task *task = (discrete_task *) node->context;
|
||||||
|
const linked_list_entry *task_entry;
|
||||||
|
/* dummy task for main */
|
||||||
|
discrete_task main_task;
|
||||||
|
|
||||||
|
for (task_entry = node->info->task_list; task_entry != NULL; task_entry = task_entry->next)
|
||||||
|
{
|
||||||
|
discrete_task *dest_task = (discrete_task *) task_entry->ptr;
|
||||||
|
|
||||||
|
if (task->task_group < dest_task->task_group)
|
||||||
|
task_check(task, dest_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
main_task.list = node->info->main_list;
|
||||||
|
main_task.source_list = node->info->main_source_list;
|
||||||
|
task_check(task, &main_task);
|
||||||
|
*((linked_list_entry **) &node->info->main_source_list) = main_task.source_list;
|
||||||
|
}
|
||||||
|
|
||||||
static DISCRETE_STEP( dso_task )
|
static DISCRETE_STEP( dso_task )
|
||||||
{
|
{
|
||||||
discrete_task *task = (discrete_task *) node->context;
|
discrete_task *task = (discrete_task *) node->context;
|
||||||
|
@ -506,7 +506,7 @@ static DEVICE_START( discrete )
|
|||||||
info->main_list = NULL;
|
info->main_list = NULL;
|
||||||
info->output_list = NULL;
|
info->output_list = NULL;
|
||||||
info->input_list = NULL;
|
info->input_list = NULL;
|
||||||
info->source_list = NULL;
|
info->main_source_list = NULL;
|
||||||
|
|
||||||
/* allocate memory to hold pointers to nodes by index */
|
/* allocate memory to hold pointers to nodes by index */
|
||||||
info->indexed_node = auto_alloc_array_clear(device->machine, node_description *, DISCRETE_MAX_NODES);
|
info->indexed_node = auto_alloc_array_clear(device->machine, node_description *, DISCRETE_MAX_NODES);
|
||||||
@ -666,15 +666,31 @@ static DEVICE_RESET( discrete )
|
|||||||
static void *task_callback(void *param, int threadid)
|
static void *task_callback(void *param, int threadid)
|
||||||
{
|
{
|
||||||
task_info *ti = (task_info *) param;
|
task_info *ti = (task_info *) param;
|
||||||
|
linked_list_entry *entry;
|
||||||
int samples, i;
|
int samples, i;
|
||||||
|
|
||||||
/* set up task buffers */
|
/* set up task buffers */
|
||||||
for (i = 0; i < ti->task->numbuffered; i++)
|
for (i = 0; i < ti->task->numbuffered; i++)
|
||||||
ti->task->ptr[i] = ti->task->node_buf[i];
|
ti->task->ptr[i] = ti->task->node_buf[i];
|
||||||
|
|
||||||
|
/* initialize sources */
|
||||||
|
for (entry = ti->task->source_list; entry != 0; entry = entry->next)
|
||||||
|
{
|
||||||
|
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
||||||
|
sn->ptr = sn->task->node_buf[sn->output_node];
|
||||||
|
}
|
||||||
|
|
||||||
samples = ti->samples;
|
samples = ti->samples;
|
||||||
while (samples-- > 0)
|
while (samples-- > 0)
|
||||||
{
|
{
|
||||||
|
/* update source node buffer */
|
||||||
|
for (entry = ti->task->source_list; entry != 0; entry = entry->next)
|
||||||
|
{
|
||||||
|
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
||||||
|
sn->buffer = *sn->ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* step */
|
||||||
step_nodes_in_list(ti->task->list);
|
step_nodes_in_list(ti->task->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,19 +703,16 @@ INLINE void update_main_nodes(discrete_info *info, int samples)
|
|||||||
linked_list_entry *entry;
|
linked_list_entry *entry;
|
||||||
|
|
||||||
/* initialize sources */
|
/* initialize sources */
|
||||||
for (entry = info->source_list; entry != 0; entry = entry->next)
|
for (entry = info->main_source_list; entry != 0; entry = entry->next)
|
||||||
{
|
{
|
||||||
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
||||||
sn->ptr = sn->task->node_buf[sn->output_node];
|
sn->ptr = sn->task->node_buf[sn->output_node];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DISCRETE_PROFILING)
|
|
||||||
info->total_samples += samples;
|
|
||||||
|
|
||||||
while (samples-- > 0)
|
while (samples-- > 0)
|
||||||
{
|
{
|
||||||
/* update source node buffer */
|
/* update source node buffer */
|
||||||
for (entry = info->source_list; entry != 0; entry = entry->next)
|
for (entry = info->main_source_list; entry != 0; entry = entry->next)
|
||||||
{
|
{
|
||||||
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
discrete_source_node *sn = (discrete_source_node *) entry->ptr;
|
||||||
sn->buffer = *sn->ptr++;
|
sn->buffer = *sn->ptr++;
|
||||||
@ -764,7 +777,10 @@ static STREAM_UPDATE( discrete_stream_update )
|
|||||||
update_main_nodes(info, samples);
|
update_main_nodes(info, samples);
|
||||||
|
|
||||||
if (DISCRETE_PROFILING)
|
if (DISCRETE_PROFILING)
|
||||||
|
{
|
||||||
|
info->total_samples += samples;
|
||||||
info->total_stream_updates++;
|
info->total_stream_updates++;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,6 +874,8 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
|||||||
task = auto_alloc_clear(info->device->machine, discrete_task);
|
task = auto_alloc_clear(info->device->machine, discrete_task);
|
||||||
task->numbuffered = 0;
|
task->numbuffered = 0;
|
||||||
task->list = task_node_list;
|
task->list = task_node_list;
|
||||||
|
task->task_group = 99; /* will be set later */
|
||||||
|
task->source_list = NULL;
|
||||||
linked_list_tail_add(info, &task_list_ptr, task);
|
linked_list_tail_add(info, &task_list_ptr, task);
|
||||||
node->context = task;
|
node->context = task;
|
||||||
task = NULL;
|
task = NULL;
|
||||||
|
@ -3740,12 +3740,15 @@ struct _discrete_task
|
|||||||
{
|
{
|
||||||
const linked_list_entry *list;
|
const linked_list_entry *list;
|
||||||
|
|
||||||
|
int task_group;
|
||||||
int numbuffered;
|
int numbuffered;
|
||||||
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
|
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
node_description *nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
node_description *nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
double *source[DISCRETE_MAX_TASK_OUTPUTS];
|
double *source[DISCRETE_MAX_TASK_OUTPUTS];
|
||||||
|
|
||||||
|
/* list of source nodes */
|
||||||
|
linked_list_entry *source_list; /* discrete_source_node */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _discrete_source_node discrete_source_node;
|
typedef struct _discrete_source_node discrete_source_node;
|
||||||
@ -3777,7 +3780,7 @@ struct _discrete_info
|
|||||||
|
|
||||||
/* list of main source nodes */
|
/* list of main source nodes */
|
||||||
|
|
||||||
linked_list_entry *source_list; /* discrete_source_node */
|
linked_list_entry *main_source_list; /* discrete_source_node */
|
||||||
|
|
||||||
/* list of discrete blocks after prescan (IMPORT, DELETE, REPLACE) */
|
/* list of discrete blocks after prescan (IMPORT, DELETE, REPLACE) */
|
||||||
linked_list_entry *block_list; /* discrete_sound_block * */
|
linked_list_entry *block_list; /* discrete_sound_block * */
|
||||||
|
Loading…
Reference in New Issue
Block a user