[render] Fail gracefully on unsupported render targets

Ideally, this won't be the case, but it currently is for Vulkan and SDL.
This commit is contained in:
Bill Currie 2021-03-30 18:29:18 +09:00
parent e93cff124c
commit ae78c81b3a
5 changed files with 15 additions and 0 deletions

View file

@ -143,6 +143,9 @@ gl_vid_render_create_context (void)
static void
gl_vid_render_init (void)
{
if (!vr_data.vid->vid_internal->sw_context) {
Sys_Error ("Sorry, OpenGL not supported by this program.");
}
gl_ctx = vr_data.vid->vid_internal->gl_context ();
gl_ctx->init_gl = GL_Init_Common;
gl_ctx->load_gl ();

View file

@ -143,6 +143,9 @@ glsl_vid_render_create_context (void)
static void
glsl_vid_render_init (void)
{
if (!vr_data.vid->vid_internal->sw_context) {
Sys_Error ("Sorry, OpenGL (GLSL) not supported by this program.");
}
glsl_ctx = vr_data.vid->vid_internal->gl_context ();
glsl_ctx->init_gl = GLSL_Init_Common;
glsl_ctx->load_gl ();

View file

@ -136,6 +136,9 @@ sw_vid_render_create_context (void)
static void
sw_vid_render_init (void)
{
if (!vr_data.vid->vid_internal->sw_context) {
Sys_Error ("Sorry, software rendering not supported by this program.");
}
sw_ctx = vr_data.vid->vid_internal->sw_context ();
vr_data.vid->vid_internal->set_palette = sw_ctx->set_palette;

View file

@ -141,6 +141,9 @@ sw32_vid_render_create_context (void)
static void
sw32_vid_render_init (void)
{
if (!vr_data.vid->vid_internal->sw_context) {
Sys_Error ("Sorry, software rendering not supported by this program.");
}
sw32_ctx = vr_data.vid->vid_internal->sw_context ();
vr_data.vid->vid_internal->set_palette = sw32_ctx->set_palette;

View file

@ -636,6 +636,9 @@ vulkan_vid_render_create_context (void)
static void
vulkan_vid_render_init (void)
{
if (!vr_data.vid->vid_internal->vulkan_context) {
Sys_Error ("Sorry, Vulkan not supported by this program.");
}
vulkan_ctx = vr_data.vid->vid_internal->vulkan_context ();
vulkan_ctx->load_vulkan (vulkan_ctx);