Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libplacebo for openSUSE:Factory 
checked in at 2023-10-19 22:47:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libplacebo (Old)
 and      /work/SRC/openSUSE:Factory/.libplacebo.new.1945 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libplacebo"

Thu Oct 19 22:47:02 2023 rev:29 rq:1118324 version:6.338.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/libplacebo/libplacebo.changes    2023-09-28 
00:37:15.342185298 +0200
+++ /work/SRC/openSUSE:Factory/.libplacebo.new.1945/libplacebo.changes  
2023-10-19 22:49:27.287078866 +0200
@@ -1,0 +2,6 @@
+Tue Oct 17 13:20:06 UTC 2023 - llyyr <[email protected]>
+
+- Update libplacebo to version 6.338.1. See details in:
+    https://code.videolan.org/videolan/libplacebo/-/tags/v6.338.1
+
+-------------------------------------------------------------------

Old:
----
  libplacebo-v6.338.0.tar.bz2

New:
----
  libplacebo-v6.338.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libplacebo.spec ++++++
--- /var/tmp/diff_new_pack.e5nEWs/_old  2023-10-19 22:49:28.007104981 +0200
+++ /var/tmp/diff_new_pack.e5nEWs/_new  2023-10-19 22:49:28.007104981 +0200
@@ -18,7 +18,7 @@
 
 %define sover   338
 Name:           libplacebo
-Version:        6.338.0
+Version:        6.338.1
 Release:        0
 Summary:        Library for GPU-accelerated video/image rendering primitives
 License:        LGPL-2.1-or-later

++++++ libplacebo-v6.338.0.tar.bz2 -> libplacebo-v6.338.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/demos/multigpu-bench.c 
new/libplacebo-v6.338.1/demos/multigpu-bench.c
--- old/libplacebo-v6.338.0/demos/multigpu-bench.c      2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/demos/multigpu-bench.c      2023-10-17 
14:24:39.000000000 +0200
@@ -26,7 +26,7 @@
     COMPS   = 1,
 
     // Queue configuration
-    NUM_QUEUES = 16,
+    NUM_QUEUES = NUM_TEX,
     ASYNC_TX   = 1,
     ASYNC_COMP = 1,
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/demos/plplay.c 
new/libplacebo-v6.338.1/demos/plplay.c
--- old/libplacebo-v6.338.0/demos/plplay.c      2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/demos/plplay.c      2023-10-17 14:24:39.000000000 
+0200
@@ -383,7 +383,7 @@
 
         // Update ICC profile parameters dynamically
         float target_luma = 0.0f;
-        if (p->use_icc_luma) {
+        if (!p->use_icc_luma) {
             pl_color_space_nominal_luma_ex(pl_nominal_luma_params(
                 .metadata = PL_HDR_METADATA_HDR10, // use only static HDR nits
                 .scaling  = PL_HDR_NITS,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/meson.build 
new/libplacebo-v6.338.1/meson.build
--- old/libplacebo-v6.338.0/meson.build 2023-09-26 00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/meson.build 2023-10-17 14:24:39.000000000 +0200
@@ -353,7 +353,7 @@
       '1': '',
     }.keys().length(),
     # Fix version
-    0)
+    1)
 )
 
 ### Version number and configuration
@@ -388,8 +388,8 @@
 cxx = meson.get_compiler('cpp')
 
 c_opts = [
-  '-D_ISOC99_SOURCE', '-D_ISOC11_SOURCE', '-D_GNU_SOURCE', 
'-D_XOPEN_SOURCE=700',
-  '-U__STRICT_ANSI__', '-Wmissing-prototypes',
+  '-D_ISOC99_SOURCE', '-D_ISOC11_SOURCE', '-D_GNU_SOURCE', '-U__STRICT_ANSI__',
+  '-Wmissing-prototypes',
 
   # Warnings to ignore
   '-Wno-sign-compare', '-Wno-unused-parameter',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/colorspace.c 
new/libplacebo-v6.338.1/src/colorspace.c
--- old/libplacebo-v6.338.0/src/colorspace.c    2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/colorspace.c    2023-10-17 14:24:39.000000000 
+0200
@@ -955,16 +955,15 @@
     pl_matrix3x3 out = {{{0}}};
     float S[3], X[4], Z[4];
 
-    // Convert from CIE xyY to XYZ. Note that Y=1 holds true for all primaries
-    X[0] = prim->red.x   / prim->red.y;
-    X[1] = prim->green.x / prim->green.y;
-    X[2] = prim->blue.x  / prim->blue.y;
-    X[3] = prim->white.x / prim->white.y;
+    X[0] = pl_cie_X(prim->red);
+    X[1] = pl_cie_X(prim->green);
+    X[2] = pl_cie_X(prim->blue);
+    X[3] = pl_cie_X(prim->white);
 
-    Z[0] = (1 - prim->red.x   - prim->red.y)   / prim->red.y;
-    Z[1] = (1 - prim->green.x - prim->green.y) / prim->green.y;
-    Z[2] = (1 - prim->blue.x  - prim->blue.y)  / prim->blue.y;
-    Z[3] = (1 - prim->white.x - prim->white.y) / prim->white.y;
+    Z[0] = pl_cie_Z(prim->red);
+    Z[1] = pl_cie_Z(prim->green);
+    Z[2] = pl_cie_Z(prim->blue);
+    Z[3] = pl_cie_Z(prim->white);
 
     // S = XYZ^-1 * W
     for (int i = 0; i < 3; i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/gpu/utils.c 
new/libplacebo-v6.338.1/src/gpu/utils.c
--- old/libplacebo-v6.338.0/src/gpu/utils.c     2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/gpu/utils.c     2023-10-17 14:24:39.000000000 
+0200
@@ -497,6 +497,7 @@
         for (int y = 0; y < pl_rect_h(params->rc); y += slice_h) {
             for (int x = 0; x < pl_rect_w(params->rc); x += slice_w) {
                 struct pl_tex_transfer_params slice = *params;
+                slice.callback = NULL;
                 slice.rc.x0 = params->rc.x0 + x;
                 slice.rc.y0 = params->rc.y0 + y;
                 slice.rc.z0 = params->rc.z0 + z;
@@ -527,12 +528,14 @@
     if (params->buf)
         return pl_tex_upload(gpu, params);
 
-    pl_buf buf = NULL;
     struct pl_buf_params bufparams = {
         .size = pl_tex_transfer_size(params),
         .debug_tag = PL_DEBUG_TAG,
     };
 
+    struct pl_tex_transfer_params fixed = *params;
+    fixed.ptr = NULL;
+
     // If we can import host pointers directly, and the function is being used
     // asynchronously, then we can use host pointer import to skip a memcpy. In
     // the synchronous case, we still force a host memcpy to avoid stalling the
@@ -552,28 +555,24 @@
         // Suppress errors for this test because it may fail, in which case we
         // want to silently fall back.
         pl_log_level_cap(gpu->log, PL_LOG_DEBUG);
-        buf = pl_buf_create(gpu, &bufparams);
+        fixed.buf = pl_buf_create(gpu, &bufparams);
         pl_log_level_cap(gpu->log, PL_LOG_NONE);
     }
 
-    if (!buf) {
+    if (!fixed.buf) {
         bufparams.import_handle = 0;
         bufparams.host_writable = true;
-        buf = pl_buf_create(gpu, &bufparams);
+        fixed.buf = pl_buf_create(gpu, &bufparams);
+        if (!fixed.buf)
+            return false;
+        pl_buf_write(gpu, fixed.buf, 0, params->ptr, bufparams.size);
+        if (params->callback)
+            params->callback(params->priv);
+        fixed.callback = NULL;
     }
 
-    if (!buf)
-        return false;
-
-    if (!bufparams.import_handle)
-        pl_buf_write(gpu, buf, 0, params->ptr, buf->params.size);
-
-    struct pl_tex_transfer_params newparams = *params;
-    newparams.buf = buf;
-    newparams.ptr = NULL;
-
-    bool ok = pl_tex_upload(gpu, &newparams);
-    pl_buf_destroy(gpu, &buf);
+    bool ok = pl_tex_upload(gpu, &fixed);
+    pl_buf_destroy(gpu, &fixed.buf);
     return ok;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/include/libplacebo/gpu.h 
new/libplacebo-v6.338.1/src/include/libplacebo/gpu.h
--- old/libplacebo-v6.338.0/src/include/libplacebo/gpu.h        2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/src/include/libplacebo/gpu.h        2023-10-17 
14:24:39.000000000 +0200
@@ -1256,9 +1256,6 @@
 // Compile a shader and create a render pass. This is a rare/expensive
 // operation and may take a significant amount of time, even if a cached
 // program is used. Returns NULL on failure.
-//
-// The resulting pl_pass->params.cached_program will be initialized by
-// this function to point to a new, valid cached program (if any).
 PL_API pl_pass pl_pass_create(pl_gpu gpu, const struct pl_pass_params *params);
 PL_API void pl_pass_destroy(pl_gpu gpu, pl_pass *pass);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/include/libplacebo/options.h 
new/libplacebo-v6.338.1/src/include/libplacebo/options.h
--- old/libplacebo-v6.338.0/src/include/libplacebo/options.h    2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/src/include/libplacebo/options.h    2023-10-17 
14:24:39.000000000 +0200
@@ -58,13 +58,21 @@
 } *pl_options;
 
 // Allocate a new set of render params, with internally backed storage for
-// all parameters. Defaults to an empty config (PL_RENDER_DEFAULTS).
+// all parameters. Initialized to an "empty" config (PL_RENDER_DEFAULTS),
+// equivalent to `&pl_render_fast_params`. To initialize the struct instead to
+// the recommended default parameters, use `pl_options_reset` with
+// `pl_render_default_params`.
 //
 // If `log` is provided, errors related to parsing etc. will be logged there.
 PL_API pl_options pl_options_alloc(pl_log log);
 PL_API void pl_options_free(pl_options *opts);
 
-// Resets all options to their default values from a given struct. (Optional)
+// Resets all options to their default values from a given struct. If `preset`
+// is NULL, `opts` is instead reset back to the initial "empty" configuration,
+// with all options disabled, as if it was freshly allocated.
+//
+// Note: This function will also reset structs which were not included in
+// `preset`, such as any custom upscalers.
 PL_API void pl_options_reset(pl_options opts, const struct pl_render_params 
*preset);
 
 typedef const struct pl_opt_data_t {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/renderer.c 
new/libplacebo-v6.338.1/src/renderer.c
--- old/libplacebo-v6.338.0/src/renderer.c      2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/renderer.c      2023-10-17 14:24:39.000000000 
+0200
@@ -3309,7 +3309,7 @@
         for (int i = 1; i < images->num_frames; i++) {
             if (images->timestamps[i] >= 0.0 && images->timestamps[i - 1] < 0) 
{
                 float frame_dur = images->timestamps[i] - images->timestamps[i 
- 1];
-                if (!params->skip_anti_aliasing)
+                if (images->vsync_duration > frame_dur && 
!params->skip_anti_aliasing)
                     mixer.blur *= images->vsync_duration / frame_dur;
                 break;
             }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/shaders/colorspace.c 
new/libplacebo-v6.338.1/src/shaders/colorspace.c
--- old/libplacebo-v6.338.0/src/shaders/colorspace.c    2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/src/shaders/colorspace.c    2023-10-17 
14:24:39.000000000 +0200
@@ -1320,6 +1320,7 @@
          "luma = pow(clamp(luma, 0.0, 1.0), %f);        \n"
          "luma = (%f + %f * luma) / (1.0 + %f * luma);  \n"
          "luma = pow(luma, %f);                         \n"
+         "luma *= smoothstep(0.0, 1e-2, luma);          \n"
          "uint y_pq = uint(%d.0 * luma);                \n",
          sh_luma_coeffs(sh, &csp),
          PL_COLOR_SDR_WHITE / 10000.0,
@@ -1979,8 +1980,12 @@
             GLSL("ipt.x = tone_map(ipt.x); \n");
         }
 
-        // Avoid raising saturation excessively when changing brightness
-        GLSL("ipt.yz *= min(i_orig / ipt.x, ipt.x / i_orig); \n");
+        // Avoid raising saturation excessively when raising brightness, and
+        // also desaturate when reducing brightness greatly to account for the
+        // reduction in gamut volume.
+        GLSL("vec2 hull = vec2(i_orig, ipt.x);                  \n"
+             "hull = ((hull - 6.0) * hull + 9.0) * hull;        \n"
+             "ipt.yz *= min(i_orig / ipt.x, hull.y / hull.x);   \n");
     }
 
     if (need_gamut_map) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/shaders/film_grain_h274.c 
new/libplacebo-v6.338.1/src/shaders/film_grain_h274.c
--- old/libplacebo-v6.338.0/src/shaders/film_grain_h274.c       2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/src/shaders/film_grain_h274.c       2023-10-17 
14:24:39.000000000 +0200
@@ -26,7 +26,7 @@
 {
     // Primitive polynomial x^31 + x^3 + 1 (modulo 2)
     uint32_t x = *state;
-    uint8_t feedback = (x >> 2) ^ (x >> 30);
+    uint8_t feedback = 1u ^ (x >> 2) ^ (x >> 30);
     *state = (x << 1) | (feedback & 1u);
 }
 
@@ -290,8 +290,10 @@
              "float scale = "$" * float(int(val >> 16));    \n"
              // Add randomness
              "uint rand = pcg[%d];                          \n"
-             "offset.y += (rand >> 16u) %% 52u;             \n"
-             "offset.x += (rand & 0xFFFFu) %% 56u;          \n"
+             "offset.x += (rand >> 16u) %% 52u;             \n"
+             "offset.y += (rand & 0xFFFFu) %% 56u;          \n"
+             "offset.x &= 0xFFFCu;                          \n"
+             "offset.y &= 0xFFF8u;                          \n"
              "if ((rand & 1u) == 1u) scale = -scale;        \n"
              // Add local offset and compute grain
              "offset += 8u * (gl_WorkGroupID.xy %% 2u);     \n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/shaders/lut.c 
new/libplacebo-v6.338.1/src/shaders/lut.c
--- old/libplacebo-v6.338.0/src/shaders/lut.c   2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/shaders/lut.c   2023-10-17 14:24:39.000000000 
+0200
@@ -509,7 +509,7 @@
                 .sampleable     = true,
                 .host_writable  = params->dynamic,
                 .initial_data   = params->dynamic ? NULL : obj.data,
-                .debug_tag      = PL_DEBUG_TAG,
+                .debug_tag      = params->debug_tag,
             };
 
             bool ok;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/shaders/sampling.c 
new/libplacebo-v6.338.1/src/shaders/sampling.c
--- old/libplacebo-v6.338.0/src/shaders/sampling.c      2023-09-26 
00:14:49.000000000 +0200
+++ new/libplacebo-v6.338.1/src/shaders/sampling.c      2023-10-17 
14:24:39.000000000 +0200
@@ -1034,17 +1034,18 @@
     float denom = PL_MAX(1, width - 1); // avoid division by zero
     bool use_ar = cfg.antiring > 0 && ratio[pass] > 1.0;
     bool use_linear = obj->filter->radius == obj->filter->radius_zero;
+    use_ar &= !use_linear; // filter has no negative weights
 
 #pragma GLSL /* pl_shader_sample_ortho */                                      
 \
     vec4 color = vec4(0.0, 0.0, 0.0, 1.0);                                     
 \
     {                                                                          
 \
     vec2 pos = $pos, pt = $pt;                                                 
 \
     vec2 size = vec2(textureSize($src_tex, 0));                                
 \
-    vec2 dir = vec2(${const float:dir[pass][0]}, ${const float:dir[pass][1]}); 
 \
+    vec2 dir = vec2(${const float:dir[pass][0]}, ${const float: 
dir[pass][1]}); \
     pt *= dir;                                                                 
 \
     vec2 fcoord2 = fract(pos * size - vec2(0.5));                              
 \
     float fcoord = dot(fcoord2, dir);                                          
 \
-    vec2 base = pos - fcoord * pt - pt * vec2(${const float:N / 2 - 1});       
 \
+    vec2 base = pos - fcoord * pt - pt * vec2(${const float: N / 2 - 1});      
 \
     vec4 ws;                                                                   
 \
     float off;                                                                 
 \
     ${vecType: comps} c, ca = ${vecType: comps}(0.0);                          
 \
@@ -1054,7 +1055,7 @@
     @}                                                                         
 \
     @for (n < N) {                                                             
 \
         @if @(n % 4 == 0)                                                      
 \
-            ws = $lut(vec2(float(@n / 4) / ${const float:denom}, fcoord));     
 \
+            ws = $lut(vec2(float(@n / 4) / ${const float: denom}, fcoord));    
 \
         @if @(vars.use_ar && (n == vars.n / 2 - 1 || n == vars.n / 2)) {       
 \
             c = textureLod($src_tex, base + pt * @n.0, 0.0).${swizzle: comps}; 
 \
             ca += ws[@n % 4] * c;                                              
 \
@@ -1068,15 +1069,14 @@
                                                   0.0).${swizzle: comps};      
 \
                 @}                                                             
 \
             @} else {                                                          
 \
-                ca += ws[@n % 4] * textureLod($src_tex,                        
 \
-                                              base + pt * vec2(@n.0),          
 \
+                ca += ws[@n % 4] * textureLod($src_tex, base + pt * @n.0,      
 \
                                               0.0).${swizzle: comps};          
 \
             @}                                                                 
 \
         @}                                                                     
 \
     @}                                                                         
 \
     @if (use_ar)                                                               
 \
-        ca = mix(ca, clamp(ca, lo, hi), ${const float:cfg.antiring});          
 \
-    color.${swizzle: comps} = ${const float:scale} * ca;                       
 \
+        ca = mix(ca, clamp(ca, lo, hi), ${float: cfg.antiring});               
 \
+    color.${swizzle: comps} = ${float: scale} * ca;                            
 \
     }
 
     return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/shaders.h 
new/libplacebo-v6.338.1/src/shaders.h
--- old/libplacebo-v6.338.0/src/shaders.h       2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/shaders.h       2023-10-17 14:24:39.000000000 
+0200
@@ -339,9 +339,15 @@
     // Note: Interpretation of `data` is according to `type` and `fmt`.
     void (*fill)(void *data, const struct sh_lut_params *params);
     void *priv;
+
+    // Debug tag to track LUT source
+    pl_debug_tag debug_tag;
 };
 
-#define sh_lut_params(...) (&(struct sh_lut_params) { __VA_ARGS__ })
+#define sh_lut_params(...) (&(struct sh_lut_params) {   \
+        .debug_tag = PL_DEBUG_TAG,                      \
+        __VA_ARGS__                                     \
+    })
 
 // Makes a table of values available as a shader variable, using an a given
 // method (falling back if needed). The resulting identifier can be sampled
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/tests/bench.c 
new/libplacebo-v6.338.1/src/tests/bench.c
--- old/libplacebo-v6.338.0/src/tests/bench.c   2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/tests/bench.c   2023-10-17 14:24:39.000000000 
+0200
@@ -6,44 +6,55 @@
 #include <libplacebo/shaders/deinterlacing.h>
 #include <libplacebo/shaders/sampling.h>
 
-#define TEX_SIZE 2048
-#define CUBE_SIZE 64
-#define NUM_FBOS 16
-#define BENCH_DUR 1.0
+enum {
+    // Image configuration
+    NUM_TEX     = 16,
+    WIDTH       = 2048,
+    HEIGHT      = 2048,
+    DEPTH       = 16,
+    COMPS       = 4,
+
+    // Queue configuration
+    NUM_QUEUES  = NUM_TEX,
+    ASYNC_TX    = 1,
+    ASYNC_COMP  = 1,
+
+    // Test configuration
+    TEST_MS     = 1000,
+    WARMUP_MS   = 500,
+};
 
 static pl_tex create_test_img(pl_gpu gpu)
 {
-    pl_fmt fmt = pl_find_fmt(gpu, PL_FMT_FLOAT, 4, 16, 32, PL_FMT_CAP_LINEAR);
+    pl_fmt fmt = pl_find_fmt(gpu, PL_FMT_FLOAT, COMPS, DEPTH, 32, 
PL_FMT_CAP_LINEAR);
     REQUIRE(fmt);
 
-    int cube_stride = TEX_SIZE / CUBE_SIZE;
-    int cube_count  = cube_stride * cube_stride;
-
-    assert(cube_count * CUBE_SIZE * CUBE_SIZE == TEX_SIZE * TEX_SIZE);
-    float *data = malloc(TEX_SIZE * TEX_SIZE * sizeof(float[4]));
-    REQUIRE(data);
-    for (int n = 0; n < cube_count; n++) {
-        int xbase = (n % cube_stride) * CUBE_SIZE;
-        int ybase = (n / cube_stride) * CUBE_SIZE;
-        for (int g = 0; g < CUBE_SIZE; g++) {
-            for (int r = 0; r < CUBE_SIZE; r++) {
-                int xpos = xbase + r;
-                int ypos = ybase + g;
-                assert(xpos < TEX_SIZE && ypos < TEX_SIZE);
-
-                float *color = &data[(ypos * TEX_SIZE + xpos) * 4];
-                color[0] = (float) r / CUBE_SIZE;
-                color[1] = (float) g / CUBE_SIZE;
-                color[2] = (float) n / cube_count;
-                color[3] = 1.0;
+    const float xc = (WIDTH  - 1) / 2.0f;
+    const float yc = (HEIGHT - 1) / 2.0f;
+    const float kf = 0.5f / sqrtf(xc * xc + yc * yc);
+    const float invphi = 0.61803398874989;
+    const float freqR = kf * M_PI * 0.2f;
+    const float freqG = freqR * invphi;
+    const float freqB = freqG * invphi;
+    float *data = malloc(WIDTH * HEIGHT * COMPS * sizeof(float));
+    for (int y = 0; y < HEIGHT; y++) {
+        for (int x = 0; x < WIDTH; x++) {
+            float *color = &data[(y * WIDTH + x) * COMPS];
+            float xx = x - xc, yy = y - yc;
+            float r2 = xx * xx + yy * yy;
+            switch (COMPS) {
+            case 4: color[3] = 1.0;
+            case 3: color[2] = 0.5f * sinf(freqB * r2) + 0.5f;;
+            case 2: color[1] = 0.5f * sinf(freqG * r2) + 0.5f;;
+            case 1: color[0] = 0.5f * sinf(freqR * r2) + 0.5f;;
             }
         }
     }
 
     pl_tex tex = pl_tex_create(gpu, pl_tex_params(
         .format         = fmt,
-        .w              = TEX_SIZE,
-        .h              = TEX_SIZE,
+        .w              = WIDTH,
+        .h              = HEIGHT,
         .sampleable     = true,
         .initial_data   = data,
     ));
@@ -90,16 +101,16 @@
     pl_tex src = create_test_img(gpu);
 
     // Create the FBOs
-    pl_fmt fmt = pl_find_fmt(gpu, PL_FMT_FLOAT, 4, 16, 32,
+    pl_fmt fmt = pl_find_fmt(gpu, PL_FMT_FLOAT, COMPS, DEPTH, 32,
                              PL_FMT_CAP_RENDERABLE | PL_FMT_CAP_BLITTABLE);
     REQUIRE(fmt);
 
-    pl_tex fbos[NUM_FBOS] = {0};
-    for (int i = 0; i < NUM_FBOS; i++) {
+    pl_tex fbos[NUM_TEX] = {0};
+    for (int i = 0; i < NUM_TEX; i++) {
         fbos[i] = pl_tex_create(gpu, pl_tex_params(
             .format         = fmt,
-            .w              = TEX_SIZE,
-            .h              = TEX_SIZE,
+            .w              = WIDTH,
+            .h              = HEIGHT,
             .renderable     = true,
             .blit_dst       = true,
             .host_writable  = true,
@@ -116,40 +127,51 @@
     pl_gpu_finish(gpu);
 
     // Perform the actual benchmark
-    pl_clock_t start = 0, stop = 0;
-    unsigned long frames = 0;
-    int index = 0;
+    pl_clock_t start_warmup = 0, start_test = 0;
+    unsigned long frames = 0, frames_warmup = 0;
 
     pl_timer timer = pl_timer_create(gpu);
     uint64_t gputime_total = 0;
     unsigned long gputime_count = 0;
     uint64_t gputime;
 
-    start = pl_clock_now();
+    start_warmup = pl_clock_now();
     do {
-        while (pl_tex_poll(gpu, fbos[index], UINT64_MAX))
+        const int idx = frames % NUM_TEX;
+        while (pl_tex_poll(gpu, fbos[idx], UINT64_MAX))
             ; // do nothing
-        frames++;
-        run_bench(gpu, dp, &state, src, fbos[index], timer, bench);
+        run_bench(gpu, dp, &state, src, fbos[idx], start_test ? timer : NULL, 
bench);
         pl_gpu_flush(gpu);
-        index = (index + 1) % NUM_FBOS;
-        stop = pl_clock_now();
-        while ((gputime = pl_timer_query(gpu, timer))) {
-            gputime_total += gputime;
-            gputime_count++;
+        frames++;
+
+        if (start_test) {
+            while ((gputime = pl_timer_query(gpu, timer))) {
+                gputime_total += gputime;
+                gputime_count++;
+            }
+        }
+
+        pl_clock_t now = pl_clock_now();
+        if (start_test) {
+            if (pl_clock_diff(now, start_test) > TEST_MS * 1e-3)
+                break;
+        } else if (pl_clock_diff(now, start_warmup) > WARMUP_MS * 1e-3) {
+            start_test = now;
+            frames_warmup = frames;
         }
-    } while (pl_clock_diff(stop, start) < BENCH_DUR);
+    } while (true);
 
     // Force the GPU to finish execution and re-measure the final stop time
     pl_gpu_finish(gpu);
 
-    stop = pl_clock_now();
+    pl_clock_t stop = pl_clock_now();
     while ((gputime = pl_timer_query(gpu, timer))) {
         gputime_total += gputime;
         gputime_count++;
     }
 
-    double secs = pl_clock_diff(stop, start);
+    frames -= frames_warmup;
+    double secs = pl_clock_diff(stop, start_test);
     printf("'%s':\t%4lu frames in %1.6f seconds => %2.6f ms/frame (%5.2f FPS)",
           name, frames, secs, 1000 * secs / frames, frames / secs);
     if (gputime_count)
@@ -160,7 +182,7 @@
     pl_shader_obj_destroy(&state);
     pl_dispatch_destroy(&dp);
     pl_tex_destroy(gpu, &src);
-    for (int i = 0; i < NUM_FBOS; i++)
+    for (int i = 0; i < NUM_TEX; i++)
         pl_tex_destroy(gpu, &fbos[i]);
 }
 
@@ -417,7 +439,7 @@
     pl_shader_dovi_reshape(sh, &dovi_meta); // this includes MMR
 }
 
-static float data[TEX_SIZE * TEX_SIZE * 4 + 8192];
+static float data[WIDTH * HEIGHT * COMPS + 8192];
 
 static void bench_download(pl_gpu gpu, pl_tex tex)
 {
@@ -467,14 +489,15 @@
 
     pl_vulkan vk = pl_vulkan_create(log, pl_vulkan_params(
         .allow_software = true,
-        .async_transfer = false,
-        .queue_count = NUM_FBOS,
+        .async_transfer = ASYNC_TX,
+        .async_compute  = ASYNC_COMP,
+        .queue_count    = NUM_QUEUES,
     ));
 
     if (!vk)
         return SKIP;
 
-#define BENCH_SH(fn) &(struct bench) { .run_sh = fn }
+#define BENCH_SH(fn)  &(struct bench) { .run_sh = fn }
 #define BENCH_TEX(fn) &(struct bench) { .run_tex = fn }
 
     printf("= Running benchmarks =\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libplacebo-v6.338.0/src/tests/cache.c 
new/libplacebo-v6.338.1/src/tests/cache.c
--- old/libplacebo-v6.338.0/src/tests/cache.c   2023-09-26 00:14:49.000000000 
+0200
+++ new/libplacebo-v6.338.1/src/tests/cache.c   2023-10-17 14:24:39.000000000 
+0200
@@ -54,35 +54,49 @@
     REQUIRE_CMP(pl_cache_size(test), ==, 7, "zu");
     REQUIRE_CMP(pl_cache_objects(test), ==, 2, "d");
 
-    static const uint8_t ref[] = {
-        'p', 'l', '_', 'c',         // cache magic
-        'a', 'c', 'h', 'e',
-        0x1, 0, 0, 0,               // cache version
-        0x2, 0, 0, 0,               // number of objects
-        // object 3
-        0x3, 0, 0, 0, 0, 0, 0, 0,   // key
-        0x4, 0, 0, 0, 0, 0, 0, 0,   // size
+    uint8_t ref[72];
+    memset(ref, 0xbe, sizeof(ref));
+    uint8_t *refp = ref;
+
+#define PAD_ALIGN(x) PL_ALIGN2(x, sizeof(uint32_t))
+#define W(type, ...)                                    \
+    do {                                                \
+        size_t sz = sizeof((type){__VA_ARGS__});        \
+        pl_assert(ref + sizeof(ref) - refp >= sz);      \
+        memcpy(refp, &(type){__VA_ARGS__}, sz);         \
+        refp += sz;                                     \
+        size_t pad_sz = PAD_ALIGN(sz) - sz;             \
+        pl_assert(ref + sizeof(ref) - refp >= pad_sz);  \
+        memcpy(refp, &(char[PAD_ALIGN(1)]){0}, pad_sz); \
+        refp += pad_sz;                                 \
+    } while (0)
+
+    W(char[], 'p', 'l', '_', 'c', 'a', 'c', 'h', 'e');  // cache magic
+    W(uint32_t, 1);                                     // cache version
+    W(uint32_t, 2);                                     // number of objects
+
+    // object 3
+    W(uint64_t, 3);                   // key
+    W(uint64_t, 4);                   // size
 #ifdef PL_HAVE_XXHASH
-        0xbe, 0xe8, 0xbe, 0x3f,     // checksum
-        0xef, 0x12, 0x36, 0xd4,
+    W(uint64_t, 0xd43612ef3fbee8be);  // hash
 #else
-        0x17, 0x11, 0x47, 0x5e,
-        0x4e, 0x88, 0x18, 0xec,
+    W(uint64_t, 0xec18884e5e471117);  // hash
 #endif
-        'x', 'y', 'z', 'w',         // data
-        // object 1
-        0x1, 0, 0, 0, 0, 0, 0, 0,   // key
-        0x3, 0, 0, 0, 0, 0, 0, 0,   // size
+    W(char[], 'x', 'y', 'z', 'w');    // data
+
+    // object 1
+    W(uint64_t, 1);                   // key
+    W(uint64_t, 3);                   // size
 #ifdef PL_HAVE_XXHASH
-        0x50, 0x39, 0x2f, 0x89,     // checksum
-        0x94, 0x5f, 0xaf, 0x78,
+    W(uint64_t, 0x78af5f94892f3950);  // hash
 #else
-        0x77, 0x2d, 0x2e, 0x8a,
-        0x40, 0x4d, 0x20, 0x3a,
+    W(uint64_t, 0x3a204d408a2e2d77);  // hash
 #endif
-        'a', 'b', 'c',              // data
-        0,                          // padding
-    };
+    W(char[], 'a', 'b', 'c');         // data
+
+#undef W
+#undef PAD_ALIGN
 
     uint8_t data[100];
     pl_static_assert(sizeof(data) >= sizeof(ref));

Reply via email to