Skip to content

Commit

Permalink
vo_gpu: placebo: update for upstream API changes
Browse files Browse the repository at this point in the history
The concept of sample/address modes was moved from `pl_tex` to
`pl_desc_binding`.

The `pl_tex_blit()` function also underwent an API change.
  • Loading branch information
haasn committed Dec 4, 2020
1 parent 84d0930 commit 7c4465c
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions video/out/placebo/ra_pl.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,14 @@ bool mppl_wrap_tex(struct ra *ra, const struct pl_tex *pltex,
.blit_dst = pltex->params.blit_dst,
.host_mutable = pltex->params.host_writable,
.downloadable = pltex->params.host_readable,
#if PL_API_VER >= 103
// These don't exist upstream, so just pick something reasonable
.src_linear = pltex->params.format->caps & PL_FMT_CAP_LINEAR,
.src_repeat = false,
#else
.src_linear = pltex->params.sample_mode == PL_TEX_SAMPLE_LINEAR,
.src_repeat = pltex->params.address_mode == PL_TEX_ADDRESS_REPEAT,
#endif
},
.priv = (void *) pltex,
};
Expand Down Expand Up @@ -195,10 +201,12 @@ static struct ra_tex *tex_create_pl(struct ra *ra,
.blit_dst = params->blit_dst || params->render_dst,
.host_writable = params->host_mutable,
.host_readable = params->downloadable,
#if PL_API_VER < 103
.sample_mode = params->src_linear ? PL_TEX_SAMPLE_LINEAR
: PL_TEX_SAMPLE_NEAREST,
.address_mode = params->src_repeat ? PL_TEX_ADDRESS_REPEAT
: PL_TEX_ADDRESS_CLAMP,
#endif
.initial_data = params->initial_data,
});

Expand Down Expand Up @@ -399,7 +407,18 @@ static void blit_pl(struct ra *ra, struct ra_tex *dst, struct ra_tex *src,
pldst.y1 = MPMIN(MPMAX(dst_rc->y1, 0), dst->params.h);
}

#if PL_API_VER >= 103
pl_tex_blit(get_gpu(ra), &(struct pl_tex_blit_params) {
.src = src->priv,
.dst = dst->priv,
.src_rc = plsrc,
.dst_rc = pldst,
.sample_mode = src->params.src_linear ? PL_TEX_SAMPLE_LINEAR
: PL_TEX_SAMPLE_NEAREST,
});
#else
pl_tex_blit(get_gpu(ra), dst->priv, src->priv, pldst, plsrc);
#endif
}

static const enum pl_var_type var_type[RA_VARTYPE_COUNT] = {
Expand Down Expand Up @@ -627,9 +646,17 @@ static void renderpass_run_pl(struct ra *ra,
struct pl_desc_binding bind;
switch (inp->type) {
case RA_VARTYPE_TEX:
case RA_VARTYPE_IMG_W:
bind.object = (* (struct ra_tex **) val->data)->priv;
case RA_VARTYPE_IMG_W: {
struct ra_tex *tex = *((struct ra_tex **) val->data);
bind.object = tex->priv;
#if PL_API_VER >= 103
bind.sample_mode = tex->params.src_linear ? PL_TEX_SAMPLE_LINEAR
: PL_TEX_SAMPLE_NEAREST;
bind.address_mode = tex->params.src_repeat ? PL_TEX_ADDRESS_REPEAT
: PL_TEX_ADDRESS_CLAMP;
#endif
break;
}
case RA_VARTYPE_BUF_RO:
case RA_VARTYPE_BUF_RW:
bind.object = (* (struct ra_buf **) val->data)->priv;
Expand Down

2 comments on commit 7c4465c

@Daibhidh-1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Apologies, but I am largely ignorant on the use and protocols of GitHub). I build mpv from source in order to get the configuration options, I wish for. Previously. I always built it from the mpv stable release tarball, and never got a compilation error - until last week. The change here, dated Dec. 4th. 2020, is not in mpv 0.33.1 released on April 5th, 2021, but is necessary in order to compile against the version of libplacebo provided with Fedora 34, which was released at the end of April 2021. So, my question is - and I apologise for what probably sounds silly, but - why has this vital change not been incorporated in the mpv stable release tarball yet?

@Akemi
Copy link
Member

@Akemi Akemi commented on 7c4465c May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because 0.33.1 was just a critical bug fix release where only one cherry picked commit got picked. a new release 0.34, with everything containing up to a point after today, will come eventually.

v0.33.0...v0.33.1

Please sign in to comment.