mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
invert Y axis
This commit is contained in:
parent
c7157065b2
commit
d2bfdae860
1 changed files with 16 additions and 19 deletions
|
|
@ -63,24 +63,28 @@ xmesa_rb(struct softpipe_surface *sps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FLIP(Y) Y = xrb->St.Base.Height - (Y) - 1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* quad reading/writing
|
* quad reading/writing
|
||||||
* These functions are just wrappers around the existing renderbuffer
|
* These functions are just wrappers around the existing renderbuffer
|
||||||
* functions.
|
* functions.
|
||||||
|
* Note that Y=0 is the top of the surface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
|
read_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
GLfloat (*rgba)[NUM_CHANNELS])
|
GLfloat (*rgba)[NUM_CHANNELS])
|
||||||
{
|
{
|
||||||
struct xmesa_surface *xms = xmesa_surf(sps);
|
|
||||||
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
||||||
GLubyte temp[16];
|
GLubyte temp[16];
|
||||||
GLfloat *dst = (GLfloat *) rgba;
|
GLfloat *dst = (GLfloat *) rgba;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
dst[i] = UBYTE_TO_FLOAT(temp[i]);
|
dst[i] = UBYTE_TO_FLOAT(temp[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -90,14 +94,14 @@ static void
|
||||||
read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
|
read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
GLfloat (*rrrr)[QUAD_SIZE])
|
GLfloat (*rrrr)[QUAD_SIZE])
|
||||||
{
|
{
|
||||||
struct xmesa_surface *xms = xmesa_surf(sps);
|
|
||||||
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
||||||
GLubyte temp[16];
|
GLubyte temp[16];
|
||||||
GLfloat *dst = (GLfloat *) rrrr;
|
GLfloat *dst = (GLfloat *) rrrr;
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]);
|
dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]);
|
||||||
|
|
@ -114,11 +118,12 @@ write_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
const GLfloat *src = (const GLfloat *) rgba;
|
const GLfloat *src = (const GLfloat *) rgba;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
UNCLAMPED_FLOAT_TO_UBYTE(temp[i], src[i]);
|
UNCLAMPED_FLOAT_TO_UBYTE(temp[i], src[i]);
|
||||||
}
|
}
|
||||||
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
|
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
|
||||||
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8, NULL);
|
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -130,13 +135,14 @@ write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
const GLfloat *src = (const GLfloat *) rrrr;
|
const GLfloat *src = (const GLfloat *) rrrr;
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + i], src[i * 4 + j]);
|
UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + i], src[i * 4 + j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
|
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
|
||||||
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8, NULL);
|
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -145,8 +151,9 @@ read_quad_ub(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
{
|
{
|
||||||
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, rgba + 2);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -155,21 +162,11 @@ write_quad_ub(struct softpipe_surface *sps, GLint x, GLint y,
|
||||||
{
|
{
|
||||||
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
FLIP(y);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
|
||||||
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, rgba + 2);
|
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
write_mono_row_ub(struct softpipe_surface *sps, GLuint count, GLint x, GLint y,
|
|
||||||
GLubyte rgba[NUM_CHANNELS])
|
|
||||||
{
|
|
||||||
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
|
||||||
xrb->St.Base.PutMonoRow(ctx, &xrb->St.Base, count, x, y, rgba, NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to create a pipe_surface for each X renderbuffer.
|
* Called to create a pipe_surface for each X renderbuffer.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue