persistent buffers not 32-bit

Post your questions here and we'll all try to help.
Post Reply
dtristram
Posts: 12
Joined: Fri Dec 31, 2021 19:32

persistent buffers not 32-bit

Post by dtristram »

when buffers are marked PERSISTENT, they no longer respect the FLOAT designation, that is, they become 8-bit per component buffers even when FLOAT: true is specified.

In this patch normalized fragment coordinates are stored in a buffer. If they are stored at 32-bit floats, there is sufficient precision to use them to index image pixels. But if they are 8-bit, then when used to index an image, the image looks blocky because multiple image coordinates are rounded to particular 8-bit values.

The patch has two buffers, both designated as FLOAT. However, the second one is designated PERSISTENT and is unexpectedly limited to 8-bit. The final pass alternately uses the two buffers to index the input image.

Code: Select all



/*{
    "CREDIT": "dtristram",
    "DESCRIPTION": "demonstrates bug where persistent buffers do not respect FLOAT designation, note that when reading from persistent buffer, texture coordinates do not have sufficient precision to address image resolution",
    "CATEGORIES": [ "generator" ],
    "INPUTS": [
        {
            "TYPE": "image",
            "NAME": "inputImage",
            "LABEL": "Image",
        }
    ],
    "PASSES": [
        {
	    "TARGET": "store1",
	    "FLOAT": true,
	    "PERSISTENT": false,
	},
        {
	    "TARGET": "store2",
	    "FLOAT": true,
	    "PERSISTENT": true,
	},
	{
	}
    ]
}*/

float delay = 1;

void main() {
  vec2 uv = isf_FragNormCoord.xy;
  vec4 c = vec4(0,0,1,1);
  
  switch (PASSINDEX) {

  case 0:
  case 1:
    c = vec4(uv, 0, 1);
    break;

  case 2:
    if (fract(TIME/(2*delay)) < 0.5) {
      uv = IMG_THIS_PIXEL(store1).xy;
    } else {
      uv = IMG_THIS_PIXEL(store2).xy;
    }
    
    c = IMG_NORM_PIXEL(inputImage, uv.xy);
    break;
  }
  
  gl_FragColor = c;
}

Attachments
PersistentBufferDepthBug.wire
(4.66 KiB) Downloaded 119 times

Zoltán
Team Resolume
Posts: 7534
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Re: persistent buffers not 32-bit

Post by Zoltán »

Thanks for letting us know, made a ticket.
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

dtristram
Posts: 12
Joined: Fri Dec 31, 2021 19:32

Re: persistent buffers not 32-bit

Post by dtristram »

This would be great to get fixed.

Because of viewtopic.php?p=103010 I do not have a workaround. This second problem makes it impossible to use more than one persistent buffer in multiple passes. I found a nice trick for saving high precision floats in a four component int buffer, but with only one buffer that doesn't get me very far.

Can you tell me whether this bug is near the top of the backlog?

Thanks,
David

Post Reply