vo: convert some final low-hanging things to nanoseconds

This commit is contained in:
Dudemanguy 2023-10-11 15:04:47 -05:00
parent 92976b1e8c
commit 39b9635305
2 changed files with 11 additions and 11 deletions

View File

@ -786,7 +786,7 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
// Wait until a new frame with the new size was rendered. For some reason,
// Cocoa requires this to be done before drawRect() returns.
struct timespec e = mp_time_us_to_realtime(mp_time_us_add(mp_time_us(), 0.1));
struct timespec e = mp_time_ns_to_realtime(mp_time_ns_add(mp_time_ns(), 0.1));
while (s->frame_w != width && s->frame_h != height && s->vo_ready) {
if (pthread_cond_timedwait(&s->wakeup, &s->lock, &e))
break;

View File

@ -1322,13 +1322,13 @@ static bool compile_glsl(struct ra *ra, enum glsl_shader type,
sc_shader_model = 40;
}
int64_t start_us = mp_time_us();
int64_t start_ns = mp_time_ns();
bstr spv_module;
if (!spirv->fns->compile_glsl(spirv, ta_ctx, type, glsl, &spv_module))
goto done;
int64_t shaderc_us = mp_time_us();
int64_t shaderc_ns = mp_time_ns();
sc_res = spvc_context_create(&sc_ctx);
if (sc_res != SPVC_SUCCESS)
@ -1367,7 +1367,7 @@ static bool compile_glsl(struct ra *ra, enum glsl_shader type,
if (sc_res != SPVC_SUCCESS)
goto done;
int64_t cross_us = mp_time_us();
int64_t cross_ns = mp_time_ns();
hr = p->D3DCompile(hlsl, strlen(hlsl), NULL, NULL, NULL, "main",
get_shader_target(ra, type), D3DCOMPILE_OPTIMIZATION_LEVEL3, 0, out,
@ -1379,14 +1379,14 @@ static bool compile_glsl(struct ra *ra, enum glsl_shader type,
goto done;
}
int64_t d3dcompile_us = mp_time_us();
int64_t d3dcompile_ns = mp_time_ns();
MP_VERBOSE(ra, "Compiled a %s shader in %lldus\n", shader_type_name(type),
d3dcompile_us - start_us);
MP_VERBOSE(ra, "shaderc: %lldus, SPIRV-Cross: %lldus, D3DCompile: %lldus\n",
shaderc_us - start_us,
cross_us - shaderc_us,
d3dcompile_us - cross_us);
MP_VERBOSE(ra, "Compiled a %s shader in %lldns\n", shader_type_name(type),
d3dcompile_ns - start_ns);
MP_VERBOSE(ra, "shaderc: %lldns, SPIRV-Cross: %lldns, D3DCompile: %lldns\n",
shaderc_ns - start_ns,
cross_ns - shaderc_ns,
d3dcompile_ns - cross_ns);
success = true;
done: