コード例 #1
0
/**
 * Call at the close of each level (mission)
 */
void shockwave_level_close()
{
	if ( !Shockwave_inited )
		return;

	shockwave_delete_all();
	
	size_t i;

	// unload default shockwave, and erase all others
	for (i = 0; i < Shockwave_info.size(); i++) {
		if ( !i ) {
			if (Shockwave_info[i].bitmap_id >= 0)
				bm_unload( Shockwave_info[i].bitmap_id );
			else if (Shockwave_info[i].model_id >= 0)
				model_page_out_textures( Shockwave_info[i].model_id );

			continue;
		}

		if (Shockwave_info[i].bitmap_id >= 0)
			bm_release( Shockwave_info[i].bitmap_id );

		if (Shockwave_info[i].model_id >= 0)
			model_unload( Shockwave_info[i].model_id );

		Shockwave_info.erase( Shockwave_info.begin() + i );
	}

	Shockwave_inited = 0;
}
コード例 #2
0
static void process_pending_data() {
    while (!pending_frame_data.empty()) {
        auto& frame_data = pending_frame_data.front();

        bool finished;
        if (!do_gpu_queries) {
            finished = true;
        } else {
            // Determine if all queries have passed already
            finished = true;
            for (auto& trace_data : frame_data.data) {
                if (trace_data.gpu_query == -1) {
                    // Event has been processed before
                    continue;
                }

                if (gr_query_value_available(trace_data.gpu_query)) {
                    trace_data.gpu_time = gr_get_query_value(trace_data.gpu_query);
                    free_query_object(trace_data.gpu_query);
                    trace_data.gpu_query = -1;
                } else {
                    // If we are here then a query hasn't finished yet. Try again next time...
                    finished = false;
                    break;
                }
            }
        }

        if (finished) {
            std::thread writer_thread(std::bind(write_json_data, frame_data));
            writer_thread.detach();

            pending_frame_data.erase(pending_frame_data.begin());
        } else {
            // GPU queries always finish in sequence so the later queries can't be finished yet
            break;
        }
    }
}