Exemplo n.º 1
0
sge::d3d9::optional_display_mode
sge::d3d9::systemfuncs::enum_adapter_modes(
	IDirect3D9 &_d3d9,
	sge::d3d9::device_index const _adapter,
	D3DFORMAT const _format,
	UINT const _mode
)
{
	D3DDISPLAYMODE result;

	switch(
		_d3d9.EnumAdapterModes(
			_adapter.get(),
			_format,
			_mode,
			&result
		)
	)
	{
	case D3D_OK:
		return
			sge::d3d9::optional_display_mode(
				result
			);
	case D3DERR_NOTAVAILABLE:
		return
			sge::d3d9::optional_display_mode();
	default:
		throw
			sge::renderer::exception(
				FCPPT_TEXT("EnumAdapterModes failed")
			);
	}
}
Exemplo n.º 2
0
sge::renderer::caps::device
sge::d3d9::get_device_caps(
	IDirect3D9 &_system,
	sge::d3d9::device_index const _index
)
{
	D3DCAPS9 const caps(
		sge::d3d9::systemfuncs::get_caps(
			_system,
			_index
		)
	);

	D3DADAPTER_IDENTIFIER9 identifier;

	if(
		_system.GetAdapterIdentifier(
			_index.get(),
			0,
			&identifier
		)
		!= D3D_OK
	)
		throw sge::renderer::exception(
			FCPPT_TEXT("GetAdapterIdentifier failed")
		);

	return
		sge::renderer::caps::device(
			sge::renderer::caps::driver_name(
				fcppt::from_std_string(
					identifier.Driver
				)
			),
			sge::renderer::caps::description(
				fcppt::from_std_string(
					identifier.Description
				)
			),
			sge::renderer::caps::normalized_cvv(
				false
			),
			sge::renderer::caps::max_texture_size(
				sge::renderer::dim2(
					caps.MaxTextureWidth,
					caps.MaxTextureHeight
				)
			),
			sge::renderer::caps::max_volume_texture_extent(
				caps.MaxVolumeExtent
			),
			sge::renderer::caps::non_power_of_2_textures(
				!(
					caps.TextureCaps
					&
					(
						D3DPTEXTURECAPS_NONPOW2CONDITIONAL
						|
						D3DPTEXTURECAPS_POW2
					)
				)
			),
			sge::renderer::caps::max_anisotropy(
				caps.MaxAnisotropy
			),
			sge::renderer::caps::render_target_supported(
				true
			),
			sge::renderer::caps::render_target_inverted(
				false
			),
			sge::renderer::caps::clip_plane_indices(
				caps.MaxUserClipPlanes
			),
			sge::renderer::caps::light_indices(
				caps.MaxActiveLights
			),
			sge::renderer::caps::texture_stages(
				caps.MaxTextureBlendStages
			),
			sge::renderer::caps::target_surface_indices(
				caps.NumSimultaneousRTs
			),
			sge::renderer::caps::srgb_framebuffer(
				(
					caps.Caps3
					&
					D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION
				)
				!=
				0u
			)
		);
}