From: J.P. D. <jpd...@cs...> - 2001-06-13 15:57:21
|
Hello, I've found that these faster MEMCPY functions were not selected for 16 (or 32-bit for that matter) bit/channel OSMesa. I enabled them by taking out the check for CHAN_BITS==8 in osmesa.c in the function osmesa_update_state under where it says /* 4 bytes / pixel in frame buffer */ ... This could be renamed 4 GLchan / pixel or someting. I also did some GLchan fixes in read/write_rgba_span_rgba in osmesa.c The functions appear to work correctly for 16 bit/channel (and should for 32 bit). They follow at the bottom. I don't know if the ASSERT in the write function can be removed completely. I was also playing around with compiling the osmesa lib with CHAN_BITS=32 and it broke quite a lot of functions mainly at bit shifts. How can I compile the lib with some functions modified (the ones that are going to be called by my 32bit/chan program for checking) and some others unchanged? Can I safely #if functions out that would not compile with CHAN_BITS=32, but that are not going to be called? I'm interested in getting 32bit/chan smoothed triangles rendered. cheers jp read/write functions: /* Write RGBA pixels to an RGBA buffer. This is the fastest span-writer. */ static void write_rgba_span_rgba( const GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgba[][4], const GLubyte mask[] ) { OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLchan *ptr4 = PIXELADDR4(x, y); GLuint i; /*ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE);*/ if (mask) { for (i = 0; i < n; i++, ptr4 += 4) { if (mask[i]) { PACK_RGBA(ptr4, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP]); } } } else { MEMCPY( ptr4, rgba, n * 4 * sizeof(GLchan)); } } /* Read RGBA pixels from an RGBA buffer */ static void read_rgba_span_rgba( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLchan *ptr4 = PIXELADDR4(x, y); MEMCPY( rgba, ptr4, n * 4 * sizeof(GLchan) ); } |