mirror of https://github.com/mpv-player/mpv
hwdec_cuda: reduce nesting in check functions
This simplifies the code and makes it easier to read.
This commit is contained in:
parent
58f50c8e49
commit
1759d73c83
|
@ -106,16 +106,14 @@ static void cuda_ext_gl_uninit(const struct ra_hwdec_mapper *mapper, int n)
|
|||
#define CHECK_CU(x) check_cu(hw, (x), #x)
|
||||
|
||||
static bool cuda_gl_check(const struct ra_hwdec *hw) {
|
||||
if (ra_is_gl(hw->ra_ctx->ra)) {
|
||||
if (!ra_is_gl(hw->ra_ctx->ra))
|
||||
return false; // This is not an OpenGL RA.
|
||||
|
||||
GL *gl = ra_gl_get(hw->ra_ctx->ra);
|
||||
if (gl->version < 210 && gl->es < 300) {
|
||||
MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// This is not an OpenGL RA.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -273,7 +273,9 @@ static bool cuda_ext_vk_signal(const struct ra_hwdec_mapper *mapper, int n)
|
|||
|
||||
static bool cuda_vk_check(const struct ra_hwdec *hw) {
|
||||
pl_gpu gpu = ra_pl_get(hw->ra_ctx->ra);
|
||||
if (gpu != NULL) {
|
||||
if (gpu == NULL)
|
||||
return false; // This is not a Vulkan RA.
|
||||
|
||||
if (!(gpu->export_caps.tex & HANDLE_TYPE)) {
|
||||
MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable texture memory of type 0x%X.\n",
|
||||
HANDLE_TYPE);
|
||||
|
@ -283,10 +285,6 @@ static bool cuda_vk_check(const struct ra_hwdec *hw) {
|
|||
HANDLE_TYPE);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// This is not a Vulkan RA.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue