[Mesa-dev] [PATCH 16/22] swrast: fast_draw_depth_stencil() for glDrawPixels(GL_DEPTH_STENCIL)
Brian Paul
brian.e.paul at gmail.com
Thu Dec 22 09:01:45 PST 2011
On Wed, Dec 21, 2011 at 1:30 PM, Eric Anholt <eric at anholt.net> wrote:
> On Sun, 18 Dec 2011 20:08:21 -0700, Brian Paul <brianp at vmware.com> wrote:
>> Stop using deprecated renderbuffer PutRow() function. Note that we
>> aren't using Map/UnmapRenderbuffer() yet because this call is inside
>> a swrast_render_start/finish() pair.
>> ---
>> src/mesa/swrast/s_drawpix.c | 64 ++++++++++++++++++++++++++++++++-----------
>> 1 files changed, 48 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
>> index 4a661a0..19b43f6 100644
>> --- a/src/mesa/swrast/s_drawpix.c
>> +++ b/src/mesa/swrast/s_drawpix.c
>> @@ -551,6 +551,49 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
>>
>>
>> /**
>> + * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_S8_Z24
>> + * renderbuffer. No masking, zooming, scaling, etc.
>> + */
>> +static void
>> +fast_draw_depth_stencil(struct gl_context *ctx, GLint x, GLint y,
>> + GLsizei width, GLsizei height,
>> + const struct gl_pixelstore_attrib *unpack,
>> + const GLvoid *pixels)
>> +{
>
>> + for (i = 0; i < height; i++) {
>> + if (rb->Format == MESA_FORMAT_Z24_S8) {
>> + memcpy(dst, src, width * 4);
>> + }
>> + else {
>> + /* swap Z24_S8 -> S8_Z24 */
>> + GLuint j, *dst4 = (GLuint *) dst, *src4 = (GLuint *) src;
>> + for (j = 0; j < width; j++) {
>> + dst4[j] = (src4[j] << 24) | (src4[j] >> 8);
>> + }
>> + }
>
> Reuse _mesa_pack_uint_24_8_depth_stencil_row() here? Other than that,
> looks good.
Yeah, I'll fix that.
-Brian
More information about the mesa-dev
mailing list