JIT.GL.PIX with @adapt 0 reduced the output texture dimension to 512 x 512

soundyi's icon

Hi there,
I stumbled upon a mighty issue (aka bug) where the output dimension of a texture is reduced to 512 x 512, using the @adapt 0 attribute in the patcher box of a JIT.GL.PIX.

The reason why I want to use adapt 0 : I use a second texture as a parameter for a JIT.GL.PIX patch, in this case a color - hence the dimensions of the second texture is 1x1 ... and an adaption would be a waste of memory.

The attached patcher demonstrates this - drag and drop the Shapes.png file on the dropfile object "target area" and you will notice that jit.fpsgui states "dim = 512x512", but it should be 1920x1080 (if you use the attached shapes.png file, which has this resolution - its shapes are white and the background is transparent, so don' let the "all white" preview fool you ;-) ... where 512x512 seems to be the default size for an empty texture.

Using @apdapt 0 with JIT.GEN I experienced no reduction of the matrices dimensions ... does the adapt attribute work differently in the matrix (CPU) & texture (GPU) domain?

cheers
soundyi

Pix adapt issue.maxpat
Max Patch
@adapt 0 reduces the dimension to 512 x 512

just an example PNG file

LSka's icon

well... it's not a bug. The @adapt 0 attribute lets jit.gl.pix ignore the input dimensions, no matter what inlet you use. So if you don't specify the @dim attribute directly in the jit.gl.pix object, it will resize every texture to 512x512.
Otherwise, if you use @adapt 1, it will adapt to the leftmost inlet resolution, but it will still resize all other textures.
If you want to set a color without using a texture, you could set a param (see patch below)

Max Patch
Copy patch and select New From Clipboard in Max.


soundyi's icon

Hi LSKA,

thanks for your info and the elegant solution for the "memory saving" ... using a parameter for a color instead of 1x1 texture is for sure the better solution.

And with your input I found out what fooled me ... names are just names and even if they are identical they may refer to different concepts ;-)

And for others who may stumble upon this :

In the case of jit.gl.pix, adapt is "native object" attribute : https://docs.cycling74.com/max8/refpages/jit.gl.pix#adapt.

In the case of jit.gen, adpat is (common) "MOP" attribute : https://docs.cycling74.com/max8/refpages/jit.gen#Matrix_Operator

So, techniques that worked out for matrices really have to be revisted for textures ... got it ;-).

And by the way there is also a hint in the Gen docs "In jit.gl.pix , inputs can have different sizes." - so there is no need to use a "MOP adapt alike attribute" for jit.gl.pix in the first place, if one really needs to use another texture with different dimensions than the "primary / left most" texture.

See https://docs.cycling74.com/max8/vignettes/gen_overview at the bottom of the page - in the last paragraph.