Checkpoint: render-to-texture starting to work. Had to turn off stencil

in fbotexture.c.  Teapot is drawn upside down, not centered...
This commit is contained in:
Brian Paul 2006-03-20 22:12:48 +00:00
parent 54f435340b
commit 0089c7f4ee
2 changed files with 32 additions and 14 deletions

View file

@ -128,8 +128,8 @@ static void intelBufferSize(GLframebuffer *buffer,
*/
static void intelSetRenderbufferClipRects( struct intel_context *intel )
{
ASSERT(intel->ctx.DrawBuffer->Width > 0);
ASSERT(intel->ctx.DrawBuffer->Height > 0);
assert(intel->ctx.DrawBuffer->Width > 0);
assert(intel->ctx.DrawBuffer->Height > 0);
intel->fboRect.x1 = 0;
intel->fboRect.y1 = 0;
intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
@ -521,6 +521,14 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
_mesa_update_draw_buffer_bounds(ctx);
}
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
/* this may occur when we're called by glBindFrameBuffer() during
* the process of someone setting up renderbuffers, etc.
*/
_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");
return;
}
/*
* How many color buffers are we drawing into?
*/

View file

@ -428,7 +428,7 @@ intel_framebuffer_renderbuffer(GLcontext *ctx,
static struct intel_renderbuffer *
intel_wrap_texture(GLcontext *ctx)
intel_wrap_texture(GLcontext *ctx, struct gl_texture_image *texImage)
{
const GLuint name = ~0; /* XXX OK? */
struct intel_renderbuffer *irb;
@ -442,7 +442,19 @@ intel_wrap_texture(GLcontext *ctx)
_mesa_init_renderbuffer(&irb->Base, name);
irb->Magic = MAGIC; /* XXX FBO temporary */
irb->Base.Width = texImage->Width;
irb->Base.Height = texImage->Height;
irb->Base.InternalFormat = texImage->InternalFormat; /* XXX fix? */
irb->Base._BaseFormat = texImage->TexFormat->BaseFormat;
irb->Base.DataType = GL_UNSIGNED_BYTE; /* FBO XXX fix */
irb->Base.RedBits = texImage->TexFormat->RedBits;
irb->Base.GreenBits = texImage->TexFormat->GreenBits;
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
irb->Base.DepthBits = texImage->TexFormat->DepthBits;
irb->Base.Delete = intel_delete_renderbuffer;
/* XXX span funcs */
return irb;
}
@ -469,7 +481,7 @@ intel_renderbuffer_texture(GLcontext *ctx,
ASSERT(newImage);
if (!irb) {
irb = intel_wrap_texture(ctx);
irb = intel_wrap_texture(ctx, newImage);
if (!irb) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "render to texture");
return;
@ -484,11 +496,15 @@ intel_renderbuffer_texture(GLcontext *ctx,
intel_region_reference(&irb->region, intel_image->mt->region);
if (newImage->TexFormat == &_mesa_texformat_argb8888) {
_mesa_debug(ctx, "****** Render to texture OK\n");
_mesa_debug(ctx, "Render to texture OK\n");
}
else {
_mesa_debug(ctx, "****** Render to texture BAD FORMAT\n");
_mesa_debug(ctx, "Render to texture BAD FORMAT\n");
}
ctx->Driver.DrawBuffer(ctx, 0); /* second param is ignored */
}
@ -511,15 +527,9 @@ intel_finish_render_texture(GLcontext *ctx,
_mesa_debug(ctx, "intel_finish_render_texture, refcount=%d\n", irb->Base.RefCount);
/* should never hit zero here */
assert(irb->Base.RefCount > 0);
if (irb->Base.RefCount <= 0) {
_mesa_debug(ctx, "%s refcount == 0!\n", __FUNCTION__);
#if 0
irb->Base.Delete(&irb->Base);
#endif
}
/* XXX not finished? */
}