コード例 #1
0
ファイル: RSXThread.cpp プロジェクト: scu-wangsj/rpcs3
	void thread::capture_frame(const std::string &name)
	{
		frame_capture_data::draw_state draw_state = {};

		int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
		int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
		rsx::surface_info surface = {};
		surface.unpack(rsx::method_registers[NV4097_SET_SURFACE_FORMAT]);
		draw_state.width = clip_w;
		draw_state.height = clip_h;
		draw_state.color_format = surface.color_format;
		draw_state.color_buffer = std::move(copy_render_targets_to_memory());
		draw_state.depth_format = surface.depth_format;
		draw_state.depth_stencil = std::move(copy_depth_stencil_buffer_to_memory());

		if (draw_command == rsx::draw_command::indexed)
		{
			draw_state.vertex_count = 0;
			for (const auto &range : first_count_commands)
			{
				draw_state.vertex_count += range.second;
			}
			draw_state.index_type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);

			if (draw_state.index_type == rsx::index_array_type::u16)
			{
				draw_state.index.resize(2 * draw_state.vertex_count);
			}
			if (draw_state.index_type == rsx::index_array_type::u32)
			{
				draw_state.index.resize(4 * draw_state.vertex_count);
			}
			gsl::span<gsl::byte> dst = { (gsl::byte*)draw_state.index.data(), gsl::narrow<int>(draw_state.index.size()) };
			write_index_array_data_to_buffer(dst, draw_state.index_type, draw_mode, first_count_commands);
		}
コード例 #2
0
ファイル: RSXThread.cpp プロジェクト: cocoddy/rpcs3
	void thread::capture_frame(const std::string &name)
	{
		frame_capture_data::draw_state draw_state = {};

		int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
		int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
		size_t pitch = clip_w * 4;
		std::vector<size_t> color_index_to_record;
		switch (method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
		{
		case CELL_GCM_SURFACE_TARGET_0:
			color_index_to_record = { 0 };
			break;
		case CELL_GCM_SURFACE_TARGET_1:
			color_index_to_record = { 1 };
			break;
		case CELL_GCM_SURFACE_TARGET_MRT1:
			color_index_to_record = { 0, 1 };
			break;
		case CELL_GCM_SURFACE_TARGET_MRT2:
			color_index_to_record = { 0, 1, 2 };
			break;
		case CELL_GCM_SURFACE_TARGET_MRT3:
			color_index_to_record = { 0, 1, 2, 3 };
			break;
		}
		for (size_t i : color_index_to_record)
		{
			draw_state.color_buffer[i].width = clip_w;
			draw_state.color_buffer[i].height = clip_h;
			draw_state.color_buffer[i].data.resize(pitch * clip_h);
			copy_render_targets_to_memory(draw_state.color_buffer[i].data.data(), i);
		}
		if (get_address(method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], method_registers[NV4097_SET_CONTEXT_DMA_ZETA]))
		{
			draw_state.depth.width = clip_w;
			draw_state.depth.height = clip_h;
			draw_state.depth.data.resize(clip_w * clip_h * 4);
			copy_depth_buffer_to_memory(draw_state.depth.data.data());
			draw_state.stencil.width = clip_w;
			draw_state.stencil.height = clip_h;
			draw_state.stencil.data.resize(clip_w * clip_h * 4);
			copy_stencil_buffer_to_memory(draw_state.stencil.data.data());
		}
		draw_state.programs = get_programs();
		draw_state.name = name;
		frame_debug.draw_calls.push_back(draw_state);
	}
コード例 #3
0
ファイル: RSXThread.cpp プロジェクト: BARBAZ/rpcs3
	void thread::capture_frame(const std::string &name)
	{
		frame_capture_data::draw_state draw_state = {};

		int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
		int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
		rsx::surface_info surface = {};
		surface.unpack(rsx::method_registers[NV4097_SET_SURFACE_FORMAT]);
		draw_state.width = clip_w;
		draw_state.height = clip_h;
		draw_state.color_format = surface.color_format;
		draw_state.color_buffer = std::move(copy_render_targets_to_memory());
		draw_state.depth_format = surface.depth_format;
		draw_state.depth_stencil = std::move(copy_depth_stencil_buffer_to_memory());
		draw_state.programs = get_programs();
		draw_state.name = name;
		frame_debug.draw_calls.push_back(draw_state);
	}
コード例 #4
0
ファイル: RSXThread.cpp プロジェクト: McBeengs/rpcs3
	void thread::capture_frame(const std::string &name)
	{
		frame_capture_data::draw_state draw_state = {};

		int clip_w = rsx::method_registers.surface_clip_width();
		int clip_h = rsx::method_registers.surface_clip_height();
		draw_state.width = clip_w;
		draw_state.height = clip_h;
		draw_state.color_format = rsx::method_registers.surface_color();
		draw_state.color_buffer = std::move(copy_render_targets_to_memory());
		draw_state.depth_format = rsx::method_registers.surface_depth_fmt();
		draw_state.depth_stencil = std::move(copy_depth_stencil_buffer_to_memory());

		if (draw_command == rsx::draw_command::indexed)
		{
			draw_state.vertex_count = 0;
			for (const auto &range : first_count_commands)
			{
				draw_state.vertex_count += range.second;
			}
			draw_state.index_type = rsx::method_registers.index_type();

			if (draw_state.index_type == rsx::index_array_type::u16)
			{
				draw_state.index.resize(2 * draw_state.vertex_count);
			}
			if (draw_state.index_type == rsx::index_array_type::u32)
			{
				draw_state.index.resize(4 * draw_state.vertex_count);
			}
			gsl::span<gsl::byte> dst = { (gsl::byte*)draw_state.index.data(), gsl::narrow<int>(draw_state.index.size()) };
			write_index_array_data_to_buffer(dst, draw_state.index_type, draw_mode, first_count_commands);
		}

		draw_state.programs = get_programs();
		draw_state.name = name;
		frame_debug.draw_calls.push_back(draw_state);
	}