Skip to content
Snippets Groups Projects
  1. Jan 30, 2022
    • James Ross-Gowan's avatar
      d3d11/context: fix device creation retries and log error code on failure · ca975750
      James Ross-Gowan authored
      Older versions of the Direct3D 11 runtime return an error code from
      D3D11CreateDevice when they don't recognise one of the requested feature
      levels. Previously, we'd try to work around those errors by retrying
      device creation with a smaller set of feature levels, but since we did
      that regardless of the error code, when device creation failed for
      reasons other than invalid feature levels, we'd still try creating the
      device up to 6 times, and we'd never actually log the error code until
      the last attempt, which might have failed for a different reason.
      
      These unnecessary retries could also be especially annoying under Wine,
      which can log debug messages for every failed attempt.
      
      When D3D11CreateDevice fails due to unrecognised feature levels, it
      returns E_INVALIDARG, so only adjust the feature levels on E_INVALIDARG.
      When falling back to the WARP driver, log the error code. That way we
      always know the error code when device creation fails, and we eliminate
      some unnecessary retries.
      ca975750
    • James Ross-Gowan's avatar
      d3d11/formats: don't query formats unsupported by the runtime · bfd5b3a1
      James Ross-Gowan authored
      The Direct3D 11.0 debug layer in the June 2010 DirectX SDK will
      segfault if ID3D11Device::CheckFormatSupport is called on Direct3D 11.1
      formats.
      bfd5b3a1
    • James Ross-Gowan's avatar
      d3d11/context: check for debug layer presence before enabling it · 3b6dc586
      James Ross-Gowan authored
      Previously, we used the DXGI_ERROR_SDK_COMPONENT_MISSING status code to
      determine the if the debug layer failed to load, however that didn't
      work with Direct3D 11.0, because it returns E_FAIL instead. A more
      reliable method, which is used in Microsoft sample code, is to determine
      the presence of the debug layer before the actual device creation by
      attempting to create a device with the NULL driver and the debug layer
      enabled.
      
      This change also raises the log level of the message printed when the
      debug layer is missing, since it should be easy to tell if a lack of
      debug messages is because the debug flag was disabled or the debug layer
      was not installed correctly.
      3b6dc586
  2. Jan 25, 2022
    • Jan Ekström's avatar
      d3d11/gpu_tex: silence a signed/unsigned type mismatch warning · 1062725f
      Jan Ekström authored
      ClearUnorderedAccessView is only available in float and unsigned
      int formats, so when emulating signed int formats one has to
      cast across the sign.
      
      Technically possibly evil, but as the same data type is utilized
      (int32_t pointer <-> uint32_t pointer) one would hopefully expect
      this to work.
      1062725f
  3. Jan 24, 2022
  4. Jan 23, 2022
    • Niklas Haas's avatar
      meson: add test for atomics · 724d9998
      Niklas Haas authored
      And fall back to linking against -latomic otherwise, which seems to be
      annoyingly needed on some platforms.
      
      Fixes #181
      724d9998
    • Niklas Haas's avatar
      common: drop refcounts to 32-bit · e99e5bb8
      Niklas Haas authored
      64-bit is way overkill here and requires the presence of 8-byte atomic
      operations, which may even have to be emulated on some platforms.
      
      Arguably even 32-bit is overkill, but should be on the safe side.
      e99e5bb8
  5. Jan 22, 2022
  6. 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
  7. 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
  8. Jan 18, 2022
  9. Jan 16, 2022
  10. Jan 15, 2022
  11. Jan 14, 2022
  12. 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
  13. 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
  14. Jan 10, 2022
  15. Jan 09, 2022
Loading