Projective Texture Coordinates and GPU_SetScanoutWarping

I’m trying to create a perspective warp using NvAPI_GPU_SetScanoutWarping. Four vertices, one for each corner, are specified in the warping data structure. Each vertex contains a 2D coordinate defined in viewport space, as well as a 4D texture coordinate defined in desktop space. My primitive type is a triangle strip.

For each corner vertex, I calculate the proper w-coordinate for the texture, to facilitate perspective warping. I assume the texture coordinate is internally interpolated using “rgb = textureProj( tex, coordinate.xyzw )”, which is equivalent to “rgb = texture( tex, coordinate.xy / coordinate.w )”.

The warp is correct for displays where desktop coordinates run from (0,0). However, results are wrong for subsequent displays, e.g. with a desktop area of topleft (1920,0), bottomright (3840,1080).

Can you confirm that:
a) texture coordinates for all warps on all displays should be specified in desktop coordinates, where these coordinates are obtained using NvAPI_GPU_GetScanoutConfiguration.
b) texture coordinates, when used in the call NvAPI_GPU_SetScanoutWarping, are internally interpolated using projective texturing

If not, tell me what I should do to fix my perspective warps.

-Paul

For anyone’s information:

turns out coordinates are different for Mosaic setups and non-Mosaic setups.

Two full-HD displays positioned horizontally next to each other in a non-Mosaic setup will yield:
Desktop 1: [0,0]-[1920,1080]
Source 1: [0,0]-[1920,1080]
Desktop 2: [1920,0]-[3840,1080]
Source 2: [1920,0]-[3840,1080]

Texture coordinate top left:
x = desktop.left;
y = desktop.top;
z = 0;
w = perspective factor;
Texture coordinate bottom right:
x = desktop.left + desktop.width * perspective factor;
y = desktop.top + desktop.height * perspective factor;
z = 0;
w = perspective factor;

Two full-HD displays positioned horizontally next to each other in a Mosaic setup will yield:
Desktop 1: [0,0]-[1920,1080]
Source 1: [0,0]-[3840,1080]
Desktop 2: [1920,0]-[3840,1080]
Source 2: [0,0]-[3840,1080]

Texture coordinate top left:
x = desktop.left * perspective factor;
y = desktop.top * perspective factor;
z = 0;
w = perspective factor;
Texture coordinate bottom right:
x = desktop.right * perspective factor;
y = desktop.bottom * perspective factor;
z = 0;
w = perspective factor;