mesa: Add renderbuffer accessors for MESA_FORMAT_R_FLOAT32, RG_FLOAT32.
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
@@ -1109,6 +1109,78 @@ get_values_rg1616(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Functions for MESA_FORMAT_R_FLOAT32.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
get_row_r_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||||
|
GLuint count, GLint x, GLint y, void *values)
|
||||||
|
{
|
||||||
|
const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
|
||||||
|
GLfloat *dst = values;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
dst[i * 4 + RCOMP] = src[i];
|
||||||
|
dst[i * 4 + GCOMP] = 0.0;
|
||||||
|
dst[i * 4 + BCOMP] = 0.0;
|
||||||
|
dst[i * 4 + ACOMP] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_values_r_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||||
|
GLuint count, const GLint x[], const GLint y[],
|
||||||
|
void *values)
|
||||||
|
{
|
||||||
|
GLfloat *dst = values;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
|
||||||
|
dst[i * 4 + RCOMP] = src[0];
|
||||||
|
dst[i * 4 + GCOMP] = 0.0;
|
||||||
|
dst[i * 4 + BCOMP] = 0.0;
|
||||||
|
dst[i * 4 + ACOMP] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Functions for MESA_FORMAT_RG_FLOAT32.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
get_row_rg_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||||
|
GLuint count, GLint x, GLint y, void *values)
|
||||||
|
{
|
||||||
|
const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
|
||||||
|
GLfloat *dst = values;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
dst[i * 4 + RCOMP] = src[i * 2 + 0];
|
||||||
|
dst[i * 4 + GCOMP] = src[i * 2 + 1];
|
||||||
|
dst[i * 4 + BCOMP] = 0.0;
|
||||||
|
dst[i * 4 + ACOMP] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_values_rg_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||||
|
GLuint count, const GLint x[], const GLint y[],
|
||||||
|
void *values)
|
||||||
|
{
|
||||||
|
GLfloat *dst = values;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
|
||||||
|
dst[i * 4 + RCOMP] = src[0];
|
||||||
|
dst[i * 4 + GCOMP] = src[1];
|
||||||
|
dst[i * 4 + BCOMP] = 0.0;
|
||||||
|
dst[i * 4 + ACOMP] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default software fallback for gl_renderbuffer's span
|
* This is the default software fallback for gl_renderbuffer's span
|
||||||
* access functions.
|
* access functions.
|
||||||
@@ -1265,6 +1337,26 @@ _mesa_set_renderbuffer_accessors(struct gl_renderbuffer *rb)
|
|||||||
rb->PutMonoValues = put_mono_values_generic;
|
rb->PutMonoValues = put_mono_values_generic;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MESA_FORMAT_RG_FLOAT32:
|
||||||
|
rb->GetRow = get_row_rg_float32;
|
||||||
|
rb->GetValues = get_values_rg_float32;
|
||||||
|
rb->PutRow = put_row_generic;
|
||||||
|
rb->PutRowRGB = NULL;
|
||||||
|
rb->PutMonoRow = put_mono_row_generic;
|
||||||
|
rb->PutValues = put_values_generic;
|
||||||
|
rb->PutMonoValues = put_mono_values_generic;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MESA_FORMAT_R_FLOAT32:
|
||||||
|
rb->GetRow = get_row_r_float32;
|
||||||
|
rb->GetValues = get_values_r_float32;
|
||||||
|
rb->PutRow = put_row_generic;
|
||||||
|
rb->PutRowRGB = NULL;
|
||||||
|
rb->PutMonoRow = put_mono_row_generic;
|
||||||
|
rb->PutValues = put_values_generic;
|
||||||
|
rb->PutMonoValues = put_mono_values_generic;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user