mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-05 08:20:26 +01:00
swrast: remove Get/PutRow()-related code
This commit is contained in:
parent
a4a566a610
commit
d65bbfa947
2 changed files with 8 additions and 1224 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -40,259 +40,6 @@ texture_renderbuffer(struct gl_renderbuffer *rb)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Get row of values from the renderbuffer that wraps a texture image.
|
||||
*/
|
||||
static void
|
||||
texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
|
||||
GLint x, GLint y, void *values)
|
||||
{
|
||||
struct texture_renderbuffer *trb = texture_renderbuffer(rb);
|
||||
const GLint z = trb->Zoffset;
|
||||
GLuint i;
|
||||
|
||||
ASSERT(trb->TexImage->Base.Width == rb->Width);
|
||||
ASSERT(trb->TexImage->Base.Height == rb->Height);
|
||||
|
||||
y += trb->Yoffset;
|
||||
|
||||
if (rb->DataType == CHAN_TYPE) {
|
||||
GLchan *rgbaOut = (GLchan *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat rgba[4];
|
||||
trb->Fetch(trb->TexImage, x + i, y, z, rgba);
|
||||
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_SHORT) {
|
||||
GLushort *zValues = (GLushort *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x + i, y, z, &flt);
|
||||
zValues[i] = (GLushort) (flt * 0xffff);
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
/*
|
||||
const GLdouble scale = (GLdouble) 0xffffffff;
|
||||
*/
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x + i, y, z, &flt);
|
||||
#if 0
|
||||
/* this should work, but doesn't (overflow due to low precision) */
|
||||
zValues[i] = (GLuint) (flt * scale);
|
||||
#else
|
||||
/* temporary hack */
|
||||
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x + i, y, z, &flt);
|
||||
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x + i, y, z, &flt);
|
||||
zValues[i] = (GLuint) (flt * 0xffffff);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_problem(ctx, "invalid rb->DataType in texture_get_row");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
|
||||
const GLint x[], const GLint y[], void *values)
|
||||
{
|
||||
struct texture_renderbuffer *trb = texture_renderbuffer(rb);
|
||||
const GLint z = trb->Zoffset;
|
||||
GLuint i;
|
||||
|
||||
if (rb->DataType == CHAN_TYPE) {
|
||||
GLchan *rgbaOut = (GLchan *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat rgba[4];
|
||||
trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
|
||||
z, rgba);
|
||||
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_SHORT) {
|
||||
GLushort *zValues = (GLushort *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
|
||||
z, &flt);
|
||||
zValues[i] = (GLushort) (flt * 0xffff);
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
|
||||
z, &flt);
|
||||
#if 0
|
||||
zValues[i] = (GLuint) (flt * 0xffffffff);
|
||||
#else
|
||||
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
|
||||
z, &flt);
|
||||
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
|
||||
GLuint *zValues = (GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
GLfloat flt;
|
||||
trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
|
||||
z, &flt);
|
||||
zValues[i] = (GLuint) (flt * 0xffffff);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_problem(ctx, "invalid rb->DataType in texture_get_values");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Put row of values into a renderbuffer that wraps a texture image.
|
||||
*/
|
||||
static void
|
||||
texture_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
|
||||
GLint x, GLint y, const void *values, const GLubyte *mask)
|
||||
{
|
||||
struct texture_renderbuffer *trb = texture_renderbuffer(rb);
|
||||
const GLint z = trb->Zoffset;
|
||||
GLuint i;
|
||||
|
||||
y += trb->Yoffset;
|
||||
|
||||
if (rb->DataType == CHAN_TYPE) {
|
||||
const GLchan *rgba = (const GLchan *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x + i, y, z, rgba);
|
||||
}
|
||||
rgba += 4;
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_SHORT) {
|
||||
const GLushort *zValues = (const GLushort *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x + i, y, z, zValues + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x + i, y, z, zValues + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
|
||||
trb->Store(trb->TexImage, x + i, y, z, &flt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
GLfloat flt = (GLfloat) ((zValues[i] & 0xffffff) * (1.0 / 0xffffff));
|
||||
trb->Store(trb->TexImage, x + i, y, z, &flt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_problem(ctx, "invalid rb->DataType in texture_put_row");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
texture_put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
|
||||
const GLint x[], const GLint y[], const void *values,
|
||||
const GLubyte *mask)
|
||||
{
|
||||
struct texture_renderbuffer *trb = texture_renderbuffer(rb);
|
||||
const GLint z = trb->Zoffset;
|
||||
GLuint i;
|
||||
|
||||
if (rb->DataType == CHAN_TYPE) {
|
||||
const GLchan *rgba = (const GLchan *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, rgba);
|
||||
}
|
||||
rgba += 4;
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_SHORT) {
|
||||
const GLushort *zValues = (const GLushort *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
|
||||
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) {
|
||||
const GLuint *zValues = (const GLuint *) values;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!mask || mask[i]) {
|
||||
GLfloat flt = (GLfloat) ((zValues[i] & 0xffffff) * (1.0 / 0xffffff));
|
||||
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_problem(ctx, "invalid rb->DataType in texture_put_values");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
store_nop(struct swrast_texture_image *texImage,
|
||||
|
|
@ -335,10 +82,6 @@ wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
|
|||
/* plug in our texture_renderbuffer-specific functions */
|
||||
trb->Base.Delete = delete_texture_wrapper;
|
||||
trb->Base.AllocStorage = NULL; /* illegal! */
|
||||
trb->Base.GetRow = texture_get_row;
|
||||
trb->Base.GetValues = texture_get_values;
|
||||
trb->Base.PutRow = texture_put_row;
|
||||
trb->Base.PutValues = texture_put_values;
|
||||
|
||||
/* update attachment point */
|
||||
_mesa_reference_renderbuffer(&att->Renderbuffer, &(trb->Base));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue