diff options
author | marha <marha@users.sourceforge.net> | 2011-12-14 14:08:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-14 14:08:20 +0100 |
commit | 7c06219c5953076ef3236b6a8959b99329c77ee9 (patch) | |
tree | c4b00bb9d592afcdffdb3e98c7c7320e29488adb /mesalib/src/mesa/swrast/s_renderbuffer.c | |
parent | 2b5652fc7742c5ac57aca701214b046626a729e9 (diff) | |
parent | 53d28537755790ee4625dc16f560cad5aa93f56b (diff) | |
download | vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.tar.gz vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.tar.bz2 vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml
mesalib/src/mapi/glapi/gen/glX_proto_recv.py
mesalib/src/mapi/glapi/gen/glX_proto_size.py
mesalib/src/mapi/glapi/gen/gl_gentable.py
mesalib/src/mapi/glapi/gen/gl_table.py
Diffstat (limited to 'mesalib/src/mesa/swrast/s_renderbuffer.c')
-rw-r--r-- | mesalib/src/mesa/swrast/s_renderbuffer.c | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c index 7622e38fd..bb7cdebfe 100644 --- a/mesalib/src/mesa/swrast/s_renderbuffer.c +++ b/mesalib/src/mesa/swrast/s_renderbuffer.c @@ -1888,6 +1888,31 @@ add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, } +static GLboolean +add_depth_stencil_renderbuffer(struct gl_context *ctx, + struct gl_framebuffer *fb) +{ + struct gl_renderbuffer *rb; + + assert(fb->Attachment[BUFFER_DEPTH].Renderbuffer == NULL); + assert(fb->Attachment[BUFFER_STENCIL].Renderbuffer == NULL); + + rb = _mesa_new_renderbuffer(ctx, 0); + if (!rb) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating depth+stencil buffer"); + return GL_FALSE; + } + + rb->InternalFormat = GL_DEPTH_STENCIL; + + rb->AllocStorage = soft_renderbuffer_storage; + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb); + + return GL_TRUE; +} + + /** * Add a software-based accumulation renderbuffer to the given framebuffer. * This is a helper routine for device drivers when creating a @@ -1999,14 +2024,29 @@ _swrast_add_soft_renderbuffers(struct gl_framebuffer *fb, frontRight, backRight); } - if (depth) { - assert(fb->Visual.depthBits > 0); - add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits); - } +#if 0 + /* This is pretty much for debugging purposes only since there's a perf + * hit for using combined depth/stencil in swrast. + */ + if (depth && fb->Visual.depthBits == 24 && + stencil && fb->Visual.stencilBits == 8) { + /* use combined depth/stencil buffer */ + add_depth_stencil_renderbuffer(NULL, fb); + } + else +#else + (void) add_depth_stencil_renderbuffer; +#endif + { + if (depth) { + assert(fb->Visual.depthBits > 0); + add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits); + } - if (stencil) { - assert(fb->Visual.stencilBits > 0); - add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits); + if (stencil) { + assert(fb->Visual.stencilBits > 0); + add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits); + } } if (accum) { |