On Fri, Feb 22, 2013 at 12:28 PM, Patrick Baggett <baggett.patr...@gmail.com> wrote: > > > On Fri, Feb 22, 2013 at 2:23 PM, Ian Romanick <i...@freedesktop.org> wrote: >> >> On 02/15/2013 11:20 AM, Anuj Phogat wrote: >>> >>> tex->Sright and tex->Ttop are initialized during texture allocation. >>> This fixes depth buffer blitting failures in khronos conformance tests >>> when run on desktop GL 3.0. >>> >>> Note: This is a candidate for stable branches. >>> >>> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com> >> >> >> Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> >> >> I think there is a lot of room for other improvements in this code. >> Like... why are we doing glReadPixels into malloc memory, then handing that >> same pointer to glTexImage2D. We should (at least for desktop and GLES3) >> use a PBO. >>> >>> --- >>> src/mesa/drivers/common/meta.c | 17 ++++++++--------- >>> 1 files changed, 8 insertions(+), 9 deletions(-) >>> >>> diff --git a/src/mesa/drivers/common/meta.c >>> b/src/mesa/drivers/common/meta.c >>> index 4e32b50..29a209e 100644 >>> --- a/src/mesa/drivers/common/meta.c >>> +++ b/src/mesa/drivers/common/meta.c >>> @@ -1910,6 +1910,14 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, >>> GLuint *tmp = malloc(srcW * srcH * sizeof(GLuint)); >>> >>> if (tmp) { >>> + >>> + newTex = alloc_texture(depthTex, srcW, srcH, >>> GL_DEPTH_COMPONENT); > > > Are out of memory conditions handled in alloc_texture? > name of the function 'alloc_texture' is little misleading. It doesn't do any memory allocation for the texture, just initializes texture size and format parameters. So, it doesn't need out of memory conditions. Memory is allocated for glReadPixels and the pointer is stored in 'tmp. variable. If tmp != NULL, same pointer is passed to glTexImage2D() in setup_drawpix_texture(). As Ian suggested, mallocing memory for glReadPixels can be avoided by using PBOs. I'll post a separate patch to do that.
>>> >>> + _mesa_ReadPixels(srcX, srcY, srcW, srcH, GL_DEPTH_COMPONENT, >>> + GL_UNSIGNED_INT, tmp); >>> + setup_drawpix_texture(ctx, depthTex, newTex, >>> GL_DEPTH_COMPONENT, >>> + srcW, srcH, GL_DEPTH_COMPONENT, >>> + GL_UNSIGNED_INT, tmp); >>> + >>> /* texcoords (after texture allocation!) */ >>> { >>> verts[0].s = 0.0F; >>> @@ -1928,15 +1936,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, >>> if (!blit->DepthFP) >>> init_blit_depth_pixels(ctx); >>> >>> - /* maybe change tex format here */ >>> - newTex = alloc_texture(depthTex, srcW, srcH, >>> GL_DEPTH_COMPONENT); >>> - >>> - _mesa_ReadPixels(srcX, srcY, srcW, srcH, >>> - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); >>> - >>> - setup_drawpix_texture(ctx, depthTex, newTex, >>> GL_DEPTH_COMPONENT, srcW, srcH, >>> - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, >>> tmp); >>> - >>> _mesa_BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); >>> _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); >>> _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); >>> >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev