model2.cpp: state-ized frame_start / geo_parse (nw)

This commit is contained in:
angelosa 2018-02-10 15:38:12 +01:00
parent 167f5f18b0
commit c5cf2f7d97
2 changed files with 12 additions and 10 deletions

View File

@ -249,6 +249,8 @@ public:
uint32_t copro_fifoout_pop(address_space &space, uint32_t offset, uint32_t mem_mask); uint32_t copro_fifoout_pop(address_space &space, uint32_t offset, uint32_t mem_mask);
void copro_fifoout_push(device_t *device, uint32_t data,uint32_t offset,uint32_t mem_mask); void copro_fifoout_push(device_t *device, uint32_t data,uint32_t offset,uint32_t mem_mask);
void model2_3d_frame_start( void );
void geo_parse( void );
void model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect ); void model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect );
void model2_timers(machine_config &config); void model2_timers(machine_config &config);

View File

@ -884,9 +884,9 @@ static void model2_3d_project( triangle *tri )
} }
/* 3D Rasterizer frame start: Resets frame variables */ /* 3D Rasterizer frame start: Resets frame variables */
static void model2_3d_frame_start( model2_state *state ) void model2_state::model2_3d_frame_start( void )
{ {
raster_state *raster = state->m_raster; raster_state *raster = m_raster;
/* reset the triangle list index */ /* reset the triangle list index */
raster->tri_list_index = 0; raster->tri_list_index = 0;
@ -2550,13 +2550,13 @@ static uint32_t * geo_process_command( geo_state *geo, uint32_t opcode, uint32_t
return input; return input;
} }
static void geo_parse( model2_state *state ) void model2_state::geo_parse( void )
{ {
uint32_t address = (state->m_geo_read_start_address/4); uint32_t address = (m_geo_read_start_address & 0x7ffff)/4;
uint32_t *input = &state->m_bufferram[address]; uint32_t *input = &m_bufferram[address];
uint32_t opcode; uint32_t opcode;
while( input != nullptr && (input - state->m_bufferram) < 0x20000 ) while( input != nullptr && (input - m_bufferram) < 0x20000 )
{ {
/* read in the opcode */ /* read in the opcode */
opcode = *input++; opcode = *input++;
@ -2568,14 +2568,14 @@ static void geo_parse( model2_state *state )
address = (opcode & 0x7FFFF) / 4; address = (opcode & 0x7FFFF) / 4;
/* update our pointer */ /* update our pointer */
input = &state->m_bufferram[address]; input = &m_bufferram[address];
/* go again */ /* go again */
continue; continue;
} }
/* process it */ /* process it */
input = geo_process_command( state->m_geo, opcode, input ); input = geo_process_command( m_geo, opcode, input );
} }
} }
@ -2620,10 +2620,10 @@ uint32_t model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32
copybitmap_trans(bitmap, m_sys24_bitmap, 0, 0, 0, 0, cliprect, 0); copybitmap_trans(bitmap, m_sys24_bitmap, 0, 0, 0, 0, cliprect, 0);
/* tell the rasterizer we're starting a frame */ /* tell the rasterizer we're starting a frame */
model2_3d_frame_start(this); model2_3d_frame_start();
/* let the geometry engine do it's thing */ /* TODO: don't do it here! */ /* let the geometry engine do it's thing */ /* TODO: don't do it here! */
geo_parse(this); geo_parse();
/* have the rasterizer output the frame */ /* have the rasterizer output the frame */
model2_3d_frame_end( bitmap, cliprect ); model2_3d_frame_end( bitmap, cliprect );