1. 29 Sep, 2018 2 commits
  2. 20 May, 2018 1 commit
    • Niklas Haas's avatar
      vulkan: correctly align texture transfer buffer offsets · 94e0ba67
      Niklas Haas authored
      These need to be aligned to the texel size as well, rather than just
      being a multiple of 4. Document and assert this fact for the user-facing
      field.
      
      We also need to make sure to align PL_BUF_TEX_TRANSFER buffers' memory
      offsets ahead of time, so just use the LCM of all supported texture
      formats in order to ensure we always get a valid allocation.
      
      In addition to this, I also realized that PL_ALIGN cannot be used to
      combine multiple non-PoT alignment requirements. So just define and use
      `pl_lcm` (which we need anyway) to be on the safe side.
      94e0ba67
  3. 26 Feb, 2018 2 commits
    • Niklas Haas's avatar
      vulkan: make sure texel buffers are large enough for emulation · 0a100205
      Niklas Haas authored
      Otherwise, emulated format upload results in an error (fortunately, the
      libplacebo assert catches it).
      
      This partially addresses #31, but it should be understood as an
      immediate-term work-around. The longer-term solution is to use multiple
      texel buffers.
      
      It's worth noting that e.g. on my hardware, this prevents format
      emulation from working, since the maximum 2D texture size is about twice
      that of the maximum texel buffer size.
      0a100205
    • Niklas Haas's avatar
      gpu: be more explicit about GPU limit types · e3f1813d
      Niklas Haas authored
      Give them explicit size information and make them unsigned where it
      matters. This solves an issue where platforms setting one or more of
      these limits as UINT32_MAX would end up overflowing to (-1) due to the
      representation as `int`.
      
      Now the valid value range is a more explicit part of the API semantics,
      with GPU implementations being required to convert and clamp as needed.
      
      As an aside, also log the missing field max_buffer_texels.
      e3f1813d
  4. 02 Feb, 2018 1 commit
    • Niklas Haas's avatar
      ra: rename ra to pl_gpu, change ra_ to pl_ · 3e881060
      Niklas Haas authored
      This is a very major rewrite operation, but all of the actual logic is
      unaffected. The change is completely cosmetic.
      
      The idea behind this is to avoid clashing the mpv ra_ namespace when
      libplacebo eventually makes its way back into mpv, allowing it to
      coexist with vo_gpu peacefully (at least for the transition period).
      
      It's also sort of weirdly inconsistent with the rest of libplacebo
      anyway.
      3e881060
  5. 25 Jan, 2018 1 commit
    • Niklas Haas's avatar
      osdep: nuke printf.h · 403bd7a5
      Niklas Haas authored
      Instead of using shitty platform-specific hacks to get a
      locale-invariant printf, we can just use our own printf routines for the
      purposes of shader generation. This required making one slight
      adjustment to one of the shaders in order to avoid the (now unsupported)
      %%lu.
      
      We now use the regular platform-provided snprintf for log messages and
      other user-facing stuff, which should be fine. (We also technically use
      it in a couple of places for snprintf with %d, but that should hopefully
      not explode)
      403bd7a5
  6. 22 Jan, 2018 1 commit
    • Niklas Haas's avatar
      renderer: check and infer pl_image fields from defaults · f5542273
      Niklas Haas authored
      This also includes logic to prefer flipping in the dst_rect rather than
      the src_rect, because this will avoid running into issues when using
      compute shaders for upscale.
      
      (It's still possible that we need to mediate the dst_rect via an
      indirect pass at the end of the rendering chain, but that's a separate
      concern)
      
      As an aside, fix PL_SWAP to actually generate valid code
      f5542273
  7. 18 Jan, 2018 1 commit
    • Niklas Haas's avatar
      utils: add helper for uploading plane data more easily · 19a7b652
      Niklas Haas authored
      This family of helpers will hopefully make it much easier for users to
      pick suitable image formats and upload arbitrary data to the GPU.
      
      In future, I want it to also support on-CPU conversions where necessary
      (using e.g. zimg), but this is not implemented yet.
      19a7b652
  8. 16 Jan, 2018 1 commit
    • Niklas Haas's avatar
      swapchain: add new swapchain abstraction · 0fcccbbe
      Niklas Haas authored
      Largely inspired by mpv's, with some changes (mostly relating to
      metadata - which we attach to each framebuffer, and also generalize to
      open up the ballpark for e.g. native HDR output support).
      0fcccbbe
  9. 25 Dec, 2017 1 commit
    • Niklas Haas's avatar
      shaders: add high quality dithering · aa04f95b
      Niklas Haas authored
      The algorithm is ported from mpv; with some minor modifications (AVLFG
      -> rand()). Blue noise is internally preferred wherever possiblle, with
      ordered LUT being an alternative - and falling back to fixed function
      ordered and finally white noise when LUTs are not available.
      
      Also contains some minor other modifications (maximum shader literal LUT
      size, maximum dither depth)
      aa04f95b
  10. 10 Nov, 2017 1 commit
    • Niklas Haas's avatar
      renderer: add initial rough draft · 1668a0bb
      Niklas Haas authored
      This is mostly there to give us an idea of what the API will look like,
      and also adds some skeleton code to begin targetting it. Many features
      missing, only bilinear scaling supported, etc.
      
      For testing, we move the RA-agnostic tests over to ra_tests instead,
      since it's getting unscaleable to lump these all in with vulkan.c
      1668a0bb
  11. 03 Nov, 2017 1 commit
    • Niklas Haas's avatar
      libplacebo: use explicit checks instead of assert() · 59cb23b9
      Niklas Haas authored
      Since assert() can be compiled out, and users will vehemently argue for
      their right to do so, just explicitly check everything we absolutely
      100% want to crash on instead of blindly continuing.
      
      For convenience, a helper function is introduced for this (pl_assert),
      which is defined as assert in the common case (debugging builds), but
      otherwise gets compiled to an if () abort();
      
      This should prevent all serious cases of undefined behavior from
      occurring without requiring users to build debugging builds.
      59cb23b9
  12. 27 Oct, 2017 1 commit
    • Niklas Haas's avatar
      osdep: add locale-invariant printf wrappers · 0e67eec2
      Niklas Haas authored
      Since nobody can agree on adding `printf_l` to the standard, we have to
      do this using OS-dependent mechanisms. On glibc, the best hack-around is
      to use `uselocale` to set the thread-specific locale. This requires some
      roundabout locale initialization, but works.
      
      For other platforms (e.g. BSD and Win32), there are saner methods of
      accomplishing this, which is why it's inside osdep/.
      0e67eec2
  13. 25 Oct, 2017 1 commit
    • Niklas Haas's avatar
      meson: correctly install the headers · 31e59b95
      Niklas Haas authored
      Using install_headers with subdirectories like that breaks completely.
      Solve it by just using subdir, which also liberates us from having to
      manually list all of the headers.
      
      Due to a weird limitation of subdir(), we're forced to rename our
      public include dir to `libplacebo`. So take this opportunity to also
      move it to `include/libplacebo`. This has the pretty significant
      advantage that you can just use -I to test directly from a local
      libplacebo tree, which is a net gain overall.
      31e59b95
  14. 23 Oct, 2017 1 commit
    • Niklas Haas's avatar
      ra: add helpers for sorting and printing the formats · 4259df89
      Niklas Haas authored
      For sorting, we try a few heuristics but ultimately maintain the
      guarantee that formats with "more" capabilities (popcount) are sorted
      higher. This is probably what the user wants.
      
      Printing the flags as a hex literal is sort of a cheap way out, but I
      can't be bothered doing incremental buffer incrementation for the time
      being. This is still better than the status quo.
      4259df89
  15. 16 Oct, 2017 1 commit
  16. 15 Oct, 2017 1 commit
    • Niklas Haas's avatar
      shaders: split up into components · ca6dbb55
      Niklas Haas authored
      Move shaders helpers to an internal shaders.h, and split up the public
      shaders API based on the type of rendering that's being done. The
      overall idea here is to limit public/shaders.h to the "low-level" shader
      access stuff, which is normally taken care of by pl_dispatch.
      ca6dbb55
  17. 14 Oct, 2017 1 commit
    • Niklas Haas's avatar
      colorspace: refactor color representation · dd172eab
      Niklas Haas authored
      Make the bits struct more complicated. Also, since it's sufficiently
      non-trivial, make the various color representation changing function
      mutate the representation to represent the change that was being made.
      (And give them better names)
      
      Also, I needed to update the test cases to make `feq` not fail on the
      large values (65535), since that + the epsilon of 1e-6 exceeded the
      floating point precision. And apparently we never actually linked the
      test cases against libm etc.
      dd172eab
  18. 11 Oct, 2017 1 commit
    • Niklas Haas's avatar
      vulkan: add public API · 57cadef6
      Niklas Haas authored
      It should now actually be possible to start using the ra_vk stuff; and
      also to have it interact with an external context. No support yet for
      swapchains / presenting or anything of that nature, but it's a start.
      57cadef6
  19. 10 Oct, 2017 1 commit
  20. 09 Oct, 2017 1 commit
    • Niklas Haas's avatar
      ra: refactor ra_var_layout · f3455890
      Niklas Haas authored
      1. This is made more flexible, by also allowing the code to access the
         current offset of the buffer. (Required for ra_d3d11)
      2. I changed my mind about the matrix order again, simply because doing
         it any other way is just absurd.
      f3455890
  21. 07 Oct, 2017 1 commit
    • Niklas Haas's avatar
      libplacebo: initial commit · bc39890e
      Niklas Haas authored
      Code shamelessly stolen from mpv, except without all the awful parts.
      (Just kidding, I still love mpv)
      bc39890e