From dc16d853797d514744998462e3aaa57a6ff7248d Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 29 Apr 2018 03:13:31 +0300 Subject: gpu/video: make HDR peak computing work without work group count Define a hard-coded value for gl_NumWorkGroups if it is not available. This adds an additional requirement of needing a shader recompile for all window size changes. This was considered a worthwhile compromise as currently f.ex. d3d11 completely lacked any peak computation - this is a major quality of life upgrade. --- video/out/gpu/video.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index be36f30e57..f3cc6ae315 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -1153,6 +1153,9 @@ static void dispatch_compute(struct gl_video *p, int w, int h, int num_x = info.block_w > 0 ? (w + info.block_w - 1) / info.block_w : 1, num_y = info.block_h > 0 ? (h + info.block_h - 1) / info.block_h : 1; + if (!(p->ra->caps & RA_CAP_NUM_GROUPS)) + PRELUDE("#define gl_NumWorkGroups uvec3(%d, %d, 1)\n", num_x, num_y); + pass_record(p, gl_sc_dispatch_compute(p->sc, num_x, num_y, 1)); cleanup_binds(p); } @@ -3515,7 +3518,6 @@ static void check_gl_features(struct gl_video *p) bool have_compute = ra->caps & RA_CAP_COMPUTE; bool have_ssbo = ra->caps & RA_CAP_BUF_RW; bool have_fragcoord = ra->caps & RA_CAP_FRAGCOORD; - bool have_numgroups = ra->caps & RA_CAP_NUM_GROUPS; const char *auto_fbo_fmts[] = {"rgba16", "rgba16f", "rgba16hf", "rgb10_a2", "rgba8", 0}; @@ -3549,13 +3551,12 @@ static void check_gl_features(struct gl_video *p) MP_VERBOSE(p, "Disabling alpha checkerboard (no gl_FragCoord).\n"); } - bool have_compute_peak = have_compute && have_ssbo && have_numgroups; + bool have_compute_peak = have_compute && have_ssbo; if (!have_compute_peak && p->opts.compute_hdr_peak >= 0) { int msgl = p->opts.compute_hdr_peak == 1 ? MSGL_WARN : MSGL_V; MP_MSG(p, msgl, "Disabling HDR peak computation (one or more of the " "following is not supported: compute shaders=%d, " - "SSBO=%d, multiple work groups=%d).\n", - have_compute, have_ssbo, have_numgroups); + "SSBO=%d).\n", have_compute, have_ssbo); p->opts.compute_hdr_peak = -1; } -- cgit v1.2.3