Nvidia Windows openGL drivers doesn't account for GL_UNPACK_ALIGNMENT parameter
when glTexSubImage2D function is called with format GL_ALPHA. Looks like, for some
reason, GL_ALPHA format data always treated by NVIDIA driver as 1-byte aligned.
This commit works around this problem.
Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
}
}
+ /*
+ * Nvidia Windows openGL drivers doesn't account for GL_UNPACK_ALIGNMENT
+ * parameter when glTexSubImage2D function is called with format GL_ALPHA.
+ * Work around this by manually setting line stride.
+ */
+ if (format == GL_ALPHA) {
+ ctx->driver_ps->PixelStorei(ctx->driver_ps,
+ GL_UNPACK_ROW_LENGTH,
+ stride);
+ }
+
ctx->driver_ps->TexSubImage2D(ctx->driver_ps,
target,
level,
type,
pixels);
+ if (format == GL_ALPHA) {
+ ctx->driver_ps->PixelStorei(ctx->driver_ps,
+ GL_UNPACK_ROW_LENGTH,
+ 0);
+ }
+
out:
return res;
}