mpv-libplacebo-3.104.0-api-change.patch 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. From 7c4465cefb27d4e0d07535d368febdf77b579566 Mon Sep 17 00:00:00 2001
  2. From: Niklas Haas <git@haasn.xyz>
  3. Date: Thu, 3 Dec 2020 08:25:23 +0100
  4. Subject: [PATCH] vo_gpu: placebo: update for upstream API changes
  5. The concept of sample/address modes was moved from `pl_tex` to
  6. `pl_desc_binding`.
  7. The `pl_tex_blit()` function also underwent an API change.
  8. ---
  9. video/out/placebo/ra_pl.c | 31 +++++++++++++++++++++++++++++--
  10. 1 file changed, 29 insertions(+), 2 deletions(-)
  11. diff --git a/video/out/placebo/ra_pl.c b/video/out/placebo/ra_pl.c
  12. index f8df590511..8244acff26 100644
  13. --- a/video/out/placebo/ra_pl.c
  14. +++ b/video/out/placebo/ra_pl.c
  15. @@ -144,8 +144,14 @@ bool mppl_wrap_tex(struct ra *ra, const struct pl_tex *pltex,
  16. .blit_dst = pltex->params.blit_dst,
  17. .host_mutable = pltex->params.host_writable,
  18. .downloadable = pltex->params.host_readable,
  19. +#if PL_API_VER >= 103
  20. + // These don't exist upstream, so just pick something reasonable
  21. + .src_linear = pltex->params.format->caps & PL_FMT_CAP_LINEAR,
  22. + .src_repeat = false,
  23. +#else
  24. .src_linear = pltex->params.sample_mode == PL_TEX_SAMPLE_LINEAR,
  25. .src_repeat = pltex->params.address_mode == PL_TEX_ADDRESS_REPEAT,
  26. +#endif
  27. },
  28. .priv = (void *) pltex,
  29. };
  30. @@ -195,10 +201,12 @@ static struct ra_tex *tex_create_pl(struct ra *ra,
  31. .blit_dst = params->blit_dst || params->render_dst,
  32. .host_writable = params->host_mutable,
  33. .host_readable = params->downloadable,
  34. +#if PL_API_VER < 103
  35. .sample_mode = params->src_linear ? PL_TEX_SAMPLE_LINEAR
  36. : PL_TEX_SAMPLE_NEAREST,
  37. .address_mode = params->src_repeat ? PL_TEX_ADDRESS_REPEAT
  38. : PL_TEX_ADDRESS_CLAMP,
  39. +#endif
  40. .initial_data = params->initial_data,
  41. });
  42. @@ -399,7 +407,18 @@ static void blit_pl(struct ra *ra, struct ra_tex *dst, struct ra_tex *src,
  43. pldst.y1 = MPMIN(MPMAX(dst_rc->y1, 0), dst->params.h);
  44. }
  45. +#if PL_API_VER >= 103
  46. + pl_tex_blit(get_gpu(ra), &(struct pl_tex_blit_params) {
  47. + .src = src->priv,
  48. + .dst = dst->priv,
  49. + .src_rc = plsrc,
  50. + .dst_rc = pldst,
  51. + .sample_mode = src->params.src_linear ? PL_TEX_SAMPLE_LINEAR
  52. + : PL_TEX_SAMPLE_NEAREST,
  53. + });
  54. +#else
  55. pl_tex_blit(get_gpu(ra), dst->priv, src->priv, pldst, plsrc);
  56. +#endif
  57. }
  58. static const enum pl_var_type var_type[RA_VARTYPE_COUNT] = {
  59. @@ -627,9 +646,17 @@ static void renderpass_run_pl(struct ra *ra,
  60. struct pl_desc_binding bind;
  61. switch (inp->type) {
  62. case RA_VARTYPE_TEX:
  63. - case RA_VARTYPE_IMG_W:
  64. - bind.object = (* (struct ra_tex **) val->data)->priv;
  65. + case RA_VARTYPE_IMG_W: {
  66. + struct ra_tex *tex = *((struct ra_tex **) val->data);
  67. + bind.object = tex->priv;
  68. +#if PL_API_VER >= 103
  69. + bind.sample_mode = tex->params.src_linear ? PL_TEX_SAMPLE_LINEAR
  70. + : PL_TEX_SAMPLE_NEAREST;
  71. + bind.address_mode = tex->params.src_repeat ? PL_TEX_ADDRESS_REPEAT
  72. + : PL_TEX_ADDRESS_CLAMP;
  73. +#endif
  74. break;
  75. + }
  76. case RA_VARTYPE_BUF_RO:
  77. case RA_VARTYPE_BUF_RW:
  78. bind.object = (* (struct ra_buf **) val->data)->priv;