float x0, x1, y0, y1, z;
float dz;
float x_range, y_range;
- float tri_x, tri_y;
blit->mode = nv50_blit_select_mode(info);
blit->color_mask = nv50_blit_derive_color_mask(info);
x_range = (float)info->src.box.width / (float)info->dst.box.width;
y_range = (float)info->src.box.height / (float)info->dst.box.height;
- tri_x = 16384 << nv50_miptree(dst)->ms_x;
- tri_y = 16384 << nv50_miptree(dst)->ms_y;
-
x0 = (float)info->src.box.x - x_range * (float)info->dst.box.x;
y0 = (float)info->src.box.y - y_range * (float)info->dst.box.y;
- x1 = x0 + tri_x * x_range;
- y1 = y0 + tri_y * y_range;
+ x1 = x0 + 16384.0f * x_range;
+ y1 = y0 + 16384.0f * y_range;
x0 *= (float)(1 << nv50_miptree(src)->ms_x);
x1 *= (float)(1 << nv50_miptree(src)->ms_x);
PUSH_DATAf(push, y0);
PUSH_DATAf(push, z);
BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2);
- PUSH_DATAf(push, tri_x);
+ PUSH_DATAf(push, 16384.0f);
PUSH_DATAf(push, 0.0f);
BEGIN_NV04(push, NV50_3D(VTX_ATTR_3F_X(1)), 3);
PUSH_DATAf(push, x0);
PUSH_DATAf(push, z);
BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2);
PUSH_DATAf(push, 0.0f);
- PUSH_DATAf(push, tri_y);
+ PUSH_DATAf(push, 16384.0f);
BEGIN_NV04(push, NV50_3D(VERTEX_END_GL), 1);
PUSH_DATA (push, 0);
}
* render target, with scissors defining the destination region.
* The vertex is supplied with non-normalized texture coordinates
* arranged in a way to yield the desired offset and scale.
+ *
+ * Note that while the source texture is presented to the sampler as
+ * non-MSAA (even if it is), the destination texture is treated as MSAA for
+ * rendering. This means that
+ * - destination coordinates shouldn't be scaled
+ * - without per-sample rendering, the target will be a solid-fill for all
+ * of the samples
+ *
+ * The last point implies that this process is very bad for 1:1 blits, as
+ * well as scaled blits between MSAA surfaces. This works fine for
+ * upscaling and downscaling though. The 1:1 blits should ideally be
+ * handled by the 2d engine, which can do it perfectly.
*/
minx = info->dst.box.x;
*(vbuf++) = fui(y0);
*(vbuf++) = fui(z);
- *(vbuf++) = fui(32768 << nv50_miptree(dst)->ms_x);
+ *(vbuf++) = fui(32768.0f);
*(vbuf++) = fui(0.0f);
*(vbuf++) = fui(x1);
*(vbuf++) = fui(y0);
*(vbuf++) = fui(z);
*(vbuf++) = fui(0.0f);
- *(vbuf++) = fui(32768 << nv50_miptree(dst)->ms_y);
+ *(vbuf++) = fui(32768.0f);
*(vbuf++) = fui(x0);
*(vbuf++) = fui(y1);
*(vbuf++) = fui(z);