mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
minor improvements
This commit is contained in:
parent
f493a04be0
commit
82b29819a9
3 changed files with 10 additions and 10 deletions
|
|
@ -1213,7 +1213,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
|
|||
ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT);
|
||||
|
||||
if (y < 0 || y >= (GLint) rb->Height ||
|
||||
x + (GLint) n <= 0 || x >= (GLint) rb->Width) {
|
||||
x + n <= 0 || x >= (GLint) rb->Width) {
|
||||
/* span is completely outside framebuffer */
|
||||
_mesa_bzero(depth, n * sizeof(GLfloat));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -834,6 +834,8 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||
const GLvoid *pixels)
|
||||
{
|
||||
const GLint imgX = x, imgY = y;
|
||||
const GLboolean scaleOrBias =
|
||||
ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
|
||||
const GLfloat depthScale = ctx->DrawBuffer->_DepthMaxF;
|
||||
const GLuint stencilMask = ctx->Stencil.WriteMask[0];
|
||||
const GLuint stencilType = (STENCIL_BITS == 8) ?
|
||||
|
|
@ -865,8 +867,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||
GL_DEPTH_STENCIL_EXT, type, i, 0);
|
||||
|
||||
if (ctx->Depth.Mask) {
|
||||
if (ctx->Pixel.DepthScale == 1.0F && ctx->Pixel.DepthBias == 0.0F
|
||||
&& depthRb->DepthBits == 24) {
|
||||
if (!scaleOrBias && depthRb->DepthBits == 24) {
|
||||
/* fast path 24-bit zbuffer */
|
||||
GLuint zValues[MAX_WIDTH];
|
||||
GLint j;
|
||||
|
|
@ -880,8 +881,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||
else
|
||||
depthRb->PutRow(ctx, depthRb, width, x, y + i, zValues, NULL);
|
||||
}
|
||||
else if (ctx->Pixel.DepthScale == 1.0F && ctx->Pixel.DepthBias == 0.0F
|
||||
&& depthRb->DepthBits == 16) {
|
||||
else if (!scaleOrBias && depthRb->DepthBits == 16) {
|
||||
/* fast path 16-bit zbuffer */
|
||||
GLushort zValues[MAX_WIDTH];
|
||||
GLint j;
|
||||
|
|
|
|||
|
|
@ -415,6 +415,8 @@ read_depth_stencil_pixels(GLcontext *ctx,
|
|||
GLenum type, GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing )
|
||||
{
|
||||
const GLboolean scaleOrBias =
|
||||
ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
|
||||
struct gl_renderbuffer *depthRb, *stencilRb;
|
||||
GLint i;
|
||||
|
||||
|
|
@ -434,9 +436,7 @@ read_depth_stencil_pixels(GLcontext *ctx,
|
|||
GL_DEPTH_STENCIL_EXT, type, i, 0);
|
||||
|
||||
/* get depth values */
|
||||
if (ctx->Pixel.DepthScale == 1.0
|
||||
&& ctx->Pixel.DepthBias == 0.0
|
||||
&& depthRb->DepthBits == 24) {
|
||||
if (!scaleOrBias && depthRb->DepthBits == 24) {
|
||||
/* ideal case */
|
||||
ASSERT(depthRb->DataType == GL_UNSIGNED_INT);
|
||||
/* note, we've already been clipped */
|
||||
|
|
@ -447,12 +447,12 @@ read_depth_stencil_pixels(GLcontext *ctx,
|
|||
GLfloat depthVals[MAX_WIDTH];
|
||||
_swrast_read_depth_span_float(ctx, depthRb, width, x, y + i,
|
||||
depthVals);
|
||||
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
|
||||
if (scaleOrBias) {
|
||||
_mesa_scale_and_bias_depth(ctx, width, depthVals);
|
||||
}
|
||||
/* convert to 24-bit GLuints */
|
||||
for (j = 0; j < width; j++) {
|
||||
zVals[j] = FLOAT_TO_UINT(depthVals[j]) >> 8;
|
||||
zVals[j] = (GLuint) (depthVals[j] * (GLfloat) 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue