diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r600/r600_context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/texrender.c | 97 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 5 |
3 files changed, 86 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 3d6802e735b..134e97e7c33 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -140,6 +140,7 @@ static const struct dri_extension card_extensions[] = { {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, {"GL_SGIS_generate_mipmap", NULL}, + {"GL_ARB_pixel_buffer_object", NULL}, {NULL, NULL} /* *INDENT-ON* */ }; diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 5a528535c04..d29af5a5b2f 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -84,6 +84,14 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, 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->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt); + zValues[i] = (GLuint) (flt * 0xffffff); + } + } else { _mesa_problem(ctx, "invalid rb->DataType in texture_get_row"); } @@ -139,6 +147,15 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, 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->TexImage->FetchTexelf(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"); } @@ -193,6 +210,15 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, } } } + 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"); } @@ -246,6 +272,15 @@ texture_put_row_rgb(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, } } } + 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"); } @@ -296,6 +331,15 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, } } } + else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) { + const GLuint zValue = *((const GLuint *) value); + const GLfloat flt = (GLfloat) ((zValue & 0xffffff) * (1.0 / 0xffffff)); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x + i, y, z, &flt); + } + } + } else { _mesa_problem(ctx, "invalid rb->DataType in texture_put_mono_row"); } @@ -346,6 +390,15 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, } } } + 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"); } @@ -395,6 +448,15 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, } } } + else if (rb->DataType == GL_UNSIGNED_INT_8_24_REV_MESA) { + const GLuint zValue = *((const GLuint *) value); + const GLfloat flt = (GLfloat) ((zValue & 0xffffff) * (1.0 / 0xffffff)); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt); + } + } + } else { _mesa_problem(ctx, "invalid rb->DataType in texture_put_mono_values"); } @@ -491,24 +553,35 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->InternalFormat; + trb->Base.Format = trb->TexImage->TexFormat; + /* XXX may need more special cases here */ - if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) { - trb->Base.Format = MESA_FORMAT_Z24_S8; + switch (trb->TexImage->TexFormat) { + case MESA_FORMAT_Z24_S8: trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; trb->Base._BaseFormat = GL_DEPTH_STENCIL; - } - else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) { - trb->Base.Format = MESA_FORMAT_Z16; - trb->Base.DataType = GL_UNSIGNED_SHORT; + break; + case MESA_FORMAT_S8_Z24: + trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA; trb->Base._BaseFormat = GL_DEPTH_STENCIL; - } - else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) { - trb->Base.Format = MESA_FORMAT_Z32; + break; + case MESA_FORMAT_Z24_X8: + trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; + trb->Base._BaseFormat = GL_DEPTH_COMPONENT; + break; + case MESA_FORMAT_X8_Z24: + trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA; + trb->Base._BaseFormat = GL_DEPTH_COMPONENT; + break; + case MESA_FORMAT_Z16: + trb->Base.DataType = GL_UNSIGNED_SHORT; + trb->Base._BaseFormat = GL_DEPTH_COMPONENT; + break; + case MESA_FORMAT_Z32: trb->Base.DataType = GL_UNSIGNED_INT; trb->Base._BaseFormat = GL_DEPTH_COMPONENT; - } - else { - trb->Base.Format = trb->TexImage->TexFormat; + break; + default: trb->Base.DataType = CHAN_TYPE; trb->Base._BaseFormat = GL_RGBA; } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 8fded0c69fc..00e9d1dccbd 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -410,17 +410,12 @@ st_finish_render_texture(GLcontext *ctx, st_flush( ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL ); - if (strb->surface) - pipe_surface_reference( &strb->surface, NULL ); - strb->rtt = NULL; /* printf("FINISH RENDER TO TEXTURE surf=%p\n", strb->surface); */ - _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); - /* restore previous framebuffer state */ st_invalidate_state(ctx, _NEW_BUFFERS); } |