Skip to content

Commit

Permalink
renderer: add option "no_compute"
Browse files Browse the repository at this point in the history
to forcibly disable the use of compute shaders
  • Loading branch information
ruihe774 committed May 17, 2024
1 parent bf1855c commit 0a20e8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/include/libplacebo/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ struct pl_render_params {
// user, but it should be set to false once those values are "dialed in".
bool dynamic_constants;

// Disables the use of compute shaders.
// Can improve power saving and (even) performance on certain GPUs.
bool no_compute;

// This callback is invoked for every pass successfully executed in the
// process of rendering a frame. Optional.
//
Expand Down
1 change: 1 addition & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ const struct pl_opt_t pl_option_list[] = {
OPT_BOOL("disable_fbos", "Disable FBOs", params.disable_fbos),
OPT_BOOL("force_low_bit_depth_fbos", "Force 8-bit FBOs", params.force_low_bit_depth_fbos),
OPT_BOOL("dynamic_constants", "Dynamic constants", params.dynamic_constants),
OPT_BOOL("no_compute", "Disable compute shaders", params.no_compute),
{0},
};

Expand Down
4 changes: 4 additions & 0 deletions src/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ static void dispatch_sampler(struct pass_state *pass, pl_shader sh,
fparams.no_compute = !(pass->fbofmt[4]->caps & PL_FMT_CAP_STORABLE);
}

if (params->no_compute) {
fparams.no_compute = true;
}

bool ok;
if (info.config->polar) {
// Polar samplers are always a single function call
Expand Down

0 comments on commit 0a20e8e

Please sign in to comment.