MSAA for UWP flatscreen
@@ -18,6 +18,7 @@ namespace sk {
HWND uwp_window = nullptr;
skg_swapchain_t uwp_swapchain = {};
+tex_t uwp_target = {};
system_t *uwp_render_sys = nullptr;
bool uwp_mouse_set;
@@ -485,6 +486,10 @@ bool uwp_start_flat() {
uwp_swapchain = skg_swapchain_create(uwp_window, color_fmt, depth_fmt, sk_settings.flatscreen_width, sk_settings.flatscreen_height);
sk_info.display_width = uwp_swapchain.width;
sk_info.display_height = uwp_swapchain.height;
+ uwp_target = tex_create(tex_type_rendertarget, tex_format_rgba32);
+ tex_set_color_arr(uwp_target, sk_info.display_width, sk_info.display_height, nullptr, 1, nullptr, 8);
+ tex_add_zbuffer (uwp_target, (tex_format_)depth_fmt);
+
log_diagf("Created swapchain: %dx%d color:%s depth:%s", uwp_swapchain.width, uwp_swapchain.height, render_fmt_name((tex_format_)color_fmt), render_fmt_name((tex_format_)depth_fmt));
flatscreen_input_init();
@@ -510,7 +515,7 @@ void uwp_step_end_flat() {
// Wipe our swapchain color and depth target clean, and then set them up for rendering!
color128 color = render_get_clear_color();
- skg_swapchain_bind(&uwp_swapchain);
+ skg_tex_target_bind(&uwp_target->tex);
skg_target_clear(true, &color.r);
input_update_predicted();
@@ -521,6 +526,10 @@ void uwp_step_end_flat() {
render_draw_matrix(&view, &proj, 1, render_get_filter());
render_clear();
+ // This copies the color data over to the swapchain, and resolves any
+ // multisampling on the primary target texture.
+ skg_tex_copy_to_swapchain(&uwp_target->tex, &uwp_swapchain);
+
uwp_render_sys->profile_frame_duration = stm_since(uwp_render_sys->profile_frame_start);
skg_swapchain_present(&uwp_swapchain);
}
@@ -531,6 +540,7 @@ void uwp_stop_flat() {
flatscreen_input_shutdown();
winrt::Windows::ApplicationModel::Core::CoreApplication::Exit();
+ tex_release (uwp_target);
skg_swapchain_destroy(&uwp_swapchain);
}
