Skip to content
Snippets Groups Projects
  1. Jan 24, 2022
  2. Jan 23, 2022
  3. Jan 22, 2022
  4. Jan 21, 2022
    • Niklas Haas's avatar
      tests/colorspace: improve color decoding test · 7d0652ba
      Niklas Haas authored
      Test on a synthetic combination of 8-bit color values and 10-bit sample
      depth, and also split the decoding into a separate normalize step to
      more closely mimic what happens in the actual renderer.
      7d0652ba
    • Niklas Haas's avatar
      colorspace: fix color repr normalization · 953dcdb3
      Niklas Haas authored
      When e.g. normalizing 10-bits-in-16 color values, the resulting color
      values are as they would be for a 16-bit sample, not for a 10-bit
      sample. So we need to set the color depth to the sample depth, not the
      other way around.
      
      Otherwise, this breaks YCbCr decoding later on, resulting in a green
      shift (among other issues).
      
      Should fix https://github.com/mpv-player/mpv/issues/9403
      953dcdb3
  5. Jan 19, 2022
    • Niklas Haas's avatar
      tests: fix error in caps check · f95f7aa2
      Niklas Haas authored
      The caps check was wrong, since both caps are needed.
      v4.192.0
      f95f7aa2
    • Niklas Haas's avatar
      opengl: work around MSAN issues · b9a1d513
      Niklas Haas authored
      b9a1d513
    • James Ross-Gowan's avatar
      d3d11/pass: allocate HLSL registers based on SPIR-V reflection · b438d2bd
      James Ross-Gowan authored
      Previously, HLSL registers were allocated based on `pass->descriptors`,
      however it's simpler if resource allocation, and hence the arrays saved
      with the cached program, only depend on the shader code. This changes
      register allocation to use only information provided by SPIRV-Cross'
      reflection API instead of `pass->descriptors`.
      
      As a side effect of this change, a few aspects of shader compilation
      have been improved and simplified. There is no longer a separate
      function to compile GLSL to SPIR-V and SPIR-V to HLSL, since there's no
      longer any reason not to do one step right after the other. Also, during
      compilation, the resource arrays are now a list of binding numbers
      instead of descriptor indexes, which means that the shader cache no
      longer depends on the order of the `pass->descriptors` array.
      
      Note that this includes code to support uniform samplerBuffers, however
      it's untested since `PL_DESC_BUF_TEXEL_UNIFORM` is only used in
      `pl_tex_upload_texel`, which isn't used by d3d11 (yet.)
      b438d2bd
  6. Jan 18, 2022
  7. Jan 16, 2022
  8. Jan 15, 2022
  9. Jan 14, 2022
  10. Jan 12, 2022
    • Niklas Haas's avatar
      vulkan: simplify pass caching · 164fc6dd
      Niklas Haas authored
      Rather than storing the compiler version and name explicitly, just merge
      them into the (pre-existing) signature hash. Also, offload the hashing
      to the spirv compiler itself.
      164fc6dd
    • Niklas Haas's avatar
      dispatch: static_assert before pl_mem_hash · 0159e7ae
      Niklas Haas authored
      Make sure struct changes don't suddenly break this pl_mem_hash call.
      0159e7ae
    • Niklas Haas's avatar
      Revert "string: introduce pl_hash_merge_struct" · 084bfdd1
      Niklas Haas authored
      This reverts commit a3271f80.
      
      This fix was ineffective and, in practice, MSAN already catches the use
      of `pl_mem_hash` on unpadded structs for me, e.g.:
      
      ==105503==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x509c6c in finalize_pass /home/nand/dev/placebo/build.msan/../src/dispatch.c:867:13
          #1 0x51c2e5 in pl_dispatch_vertex /home/nand/dev/placebo/build.msan/../src/dispatch.c:1492:25
          #2 0x64ecc6 in draw_overlays /home/nand/dev/placebo/build.msan/../src/renderer.c:833:19
          #3 0x61530a in pass_scale_main /home/nand/dev/placebo/build.msan/../src/renderer.c:1749:5
          #4 0x5fa090 in pl_render_image /home/nand/dev/placebo/build.msan/../src/renderer.c:2550:10
          #5 0x4acb0f in pl_render_tests /home/nand/dev/placebo/build.msan/../src/tests/gpu_tests.h:1095:5
          #6 0x4897af in gpu_shader_tests /home/nand/dev/placebo/build.msan/../src/tests/gpu_tests.h:1447:5
          #7 0x487be3 in main /home/nand/dev/placebo/build.msan/../src/tests/vulkan.c:194:9
      
      (At least the one in dispatch.c. It doesn't catch the ones in renderer.c
      for some reason, but I'm also less worried about those because they
      don't have any relevance outside the renderer's internal state invalidation,
      where a false positive doesn't cause real harm)
      084bfdd1
    • Niklas Haas's avatar
      shaders/colorspace: fix multi-component dovi reshaping · 8fd47aa7
      Niklas Haas authored
      If the source has multiple pivots for more than one component, the
      current code fails compiling, with a macro redefinition error.
      8fd47aa7
    • Niklas Haas's avatar
      string: introduce pl_hash_merge_struct · a3271f80
      Niklas Haas authored
      This is a safer way to hash structs than calling pl_mem_hash on them,
      since it avoids hashing indeterminate values from padding bytes.
      
      Combined into `pl_hash_merge` due to shortcomings of the C macro system
      (cannot make this an expression).
      a3271f80
  11. Jan 11, 2022
    • Niklas Haas's avatar
      opengl/formats: fix gles bgra format name · 784de11b
      Niklas Haas authored
      This should be bgra8, for consistency with desktop GL. The actual format
      is non-opaque and represented using 8 bits. Allows users to use
      pl_find_name_fmt(gpu, "bgra8") across all platforms.
      784de11b
    • Niklas Haas's avatar
      shaders/colorspace: avoid dovi pivot recompilation · 81077716
      Niklas Haas authored
      Rather than having a separate shader per number of pivots, simply
      subdivide into the two cases "no pivots" and "N pivots". The "no pivots"
      optimization still covers the (very common) case of there being no
      pivots for chroma MMR.
      
      Change the N pivots case from a loop to a tree-style branching select,
      which is faster anyways. This helps recover the lost performance (and
      then some).
      
      Significantly reduces mid-stream shader recompilation overhead.
      81077716
  12. Jan 10, 2022
  13. Jan 09, 2022
    • Niklas Haas's avatar
      alloc: switch PL_ARRAY to size_t length · c80ba5d2
      Niklas Haas authored
      Not that I anticipate us ever having arrays even remotely close to this
      in size, but it's the more correct type to use in principle.
      c80ba5d2
    • Niklas Haas's avatar
      global: fix pointer signedness confusion · 8e9836d4
      Niklas Haas authored
      In meson.build we had -Wno-pointer-sign, mostly to work around the
      otherwise constant warnings about char * vs uint8_t * in string APIs.
      However, this obscured a few legitimate bugs, mostly involving int vs
      uint32_t in the Vulkan API.
      
      Remove the warning and suppress each usage using explicit casts instead.
      8e9836d4
    • Niklas Haas's avatar
      opengl/swapchain: update start_frame/submit_frame · 12a1f656
      Niklas Haas authored
      To conform to the precedent set forth by the vulkan implementation,
      which is to assert explicitly on mis-use and also hold the lock for the
      duration of the call.
      12a1f656
    • Niklas Haas's avatar
      vulkan/swapchain: use atomics for frames_in_flight · d262aa8e
      Niklas Haas authored
      Good style, since it's decremented from a callback which could be from a
      different thread.
      d262aa8e
    • Niklas Haas's avatar
      vulkan/swapchain: make start_frame/submit_frame more robust · af7d0dfb
      Niklas Haas authored
      These always have to be submitted in lockstep, and doing something like
      e.g. resizing the swapchain in the meantime leads to undefined behavior.
      Safeguard this with a combination of changes:
      
      1. Hold on to a lock for the duration of the call, thus preventing the
         fbo state from getting invalidated while being rendered to.
      2. Make `last_imgidx` contain -1 while not rendering a frame, so we can
         assert on it being set to something valid.
      
      Note that this also fixes a subtle bug where we accidentally passed the
      address of `p->last_imgidx` (an int) to pImageIndices (uint32_t *).
      af7d0dfb
    • Niklas Haas's avatar
      demos/plplay: also detect DoVi files as HDR · d766bda9
      Niklas Haas authored
      d766bda9
    • James Ross-Gowan's avatar
      d3d11/swapchain: acquire/release the backbuffer in start/submit_frame · 40f031af
      James Ross-Gowan authored and Niklas Haas's avatar Niklas Haas committed
      There's no need to hold onto the backbuffer unnecessarily, and it
      prevents external code from calling IDXGISwapChain::ResizeBuffers, which
      we'd otherwise support just fine.
      40f031af
    • Niklas Haas's avatar
      shaders/colorspace: clamp luma in PL_GAMUT_DESATURATE · a2251287
      Niklas Haas authored
      The assumption that gamut mapping will always be the output of
      appropriately tone-mapped content is false. The most obvious
      counter-example is when mixing SDR overlays onto HDR content that has
      already been tone-mapped. If the overlay has any sort of ringing (e.g.
      as a result of scaling), it will contain out-of-range luma values.
      a2251287
Loading