diff options
Diffstat (limited to 'src/mesa/main/depthstencil.c')
-rw-r--r-- | src/mesa/main/depthstencil.c | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 40d6c9612a2..af5c12f67fc 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -957,158 +957,3 @@ _mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer return s8rb; } - - - -/** - ** The following functions are useful for hardware drivers that only - ** implement combined depth/stencil buffers. - ** The GL_EXT_framebuffer_object extension allows indepedent depth and - ** stencil buffers to be used in any combination. - ** Therefore, we sometimes have to merge separate depth and stencil - ** renderbuffers into a single depth+stencil renderbuffer. And sometimes - ** we have to split combined depth+stencil renderbuffers into separate - ** renderbuffers. - **/ - - -/** - * Extract stencil values from the combined depth/stencil renderbuffer, storing - * the values into a separate stencil renderbuffer. - * \param dsRb the source depth/stencil renderbuffer - * \param stencilRb the destination stencil renderbuffer - * (either 8-bit or 32-bit) - */ -void -_mesa_extract_stencil(struct gl_context *ctx, - struct gl_renderbuffer *dsRb, - struct gl_renderbuffer *stencilRb) -{ - GLuint row, width, height; - - ASSERT(dsRb); - ASSERT(stencilRb); - - ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8); - ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 || - stencilRb->Format == MESA_FORMAT_S8); - ASSERT(dsRb->Width == stencilRb->Width); - ASSERT(dsRb->Height == stencilRb->Height); - - width = dsRb->Width; - height = dsRb->Height; - - for (row = 0; row < height; row++) { - GLuint depthStencil[MAX_WIDTH]; - dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil); - if (stencilRb->Format == MESA_FORMAT_S8) { - /* 8bpp stencil */ - GLubyte stencil[MAX_WIDTH]; - GLuint i; - for (i = 0; i < width; i++) { - stencil[i] = depthStencil[i] & 0xff; - } - stencilRb->PutRow(ctx, stencilRb, width, 0, row, stencil, NULL); - } - else { - /* 32bpp stencil */ - /* the 24 depth bits will be ignored */ - ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8); - ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - stencilRb->PutRow(ctx, stencilRb, width, 0, row, depthStencil, NULL); - } - } -} - - -/** - * Copy stencil values from a stencil renderbuffer into a combined - * depth/stencil renderbuffer. - * \param dsRb the destination depth/stencil renderbuffer - * \param stencilRb the source stencil buffer (either 8-bit or 32-bit) - */ -void -_mesa_insert_stencil(struct gl_context *ctx, - struct gl_renderbuffer *dsRb, - struct gl_renderbuffer *stencilRb) -{ - GLuint row, width, height; - - ASSERT(dsRb); - ASSERT(stencilRb); - - ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8); - ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 || - stencilRb->Format == MESA_FORMAT_S8); - - ASSERT(dsRb->Width == stencilRb->Width); - ASSERT(dsRb->Height == stencilRb->Height); - - width = dsRb->Width; - height = dsRb->Height; - - for (row = 0; row < height; row++) { - GLuint depthStencil[MAX_WIDTH]; - - dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil); - - if (stencilRb->Format == MESA_FORMAT_S8) { - /* 8bpp stencil */ - GLubyte stencil[MAX_WIDTH]; - GLuint i; - stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil); - for (i = 0; i < width; i++) { - depthStencil[i] = (depthStencil[i] & 0xffffff00) | stencil[i]; - } - } - else { - /* 32bpp stencil buffer */ - GLuint stencil[MAX_WIDTH], i; - ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8); - ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil); - for (i = 0; i < width; i++) { - depthStencil[i] - = (depthStencil[i] & 0xffffff00) | (stencil[i] & 0xff); - } - } - - dsRb->PutRow(ctx, dsRb, width, 0, row, depthStencil, NULL); - } -} - - -/** - * Convert the stencil buffer from 8bpp to 32bpp depth/stencil. - * \param stencilRb the stencil renderbuffer to promote - */ -void -_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb) -{ - const GLsizei width = stencilRb->Width; - const GLsizei height = stencilRb->Height; - GLubyte *data; - GLint i, j, k; - - ASSERT(stencilRb->Format == MESA_FORMAT_S8); - ASSERT(stencilRb->Data); - - data = (GLubyte *) stencilRb->Data; - stencilRb->Data = NULL; - stencilRb->AllocStorage(ctx, stencilRb, GL_DEPTH24_STENCIL8_EXT, - width, height); - - ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - - k = 0; - for (i = 0; i < height; i++) { - GLuint depthStencil[MAX_WIDTH]; - for (j = 0; j < width; j++) { - depthStencil[j] = data[k++]; - } - stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL); - } - free(data); -} |