From 322e8556b91ceb80d4a53129cbb5db99087085f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Jun 2009 14:55:14 -0600 Subject: mesa: add default function for ctx->Driver.CheckQuery() hook --- src/mesa/main/queryobj.c | 16 +++++++++++++++- src/mesa/main/queryobj.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 554e0b0d18..c25b31af02 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -83,12 +83,26 @@ void _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) { /* For software drivers, _mesa_end_query() should have completed the query. - * For real hardware, implement a proper WaitQuery() driver function. + * For real hardware, implement a proper WaitQuery() driver function, + * which may require issuing a flush. */ assert(q->Ready); } +/** + * Check if a query results are ready. Software driver fallback. + * Called via ctx->Driver.CheckQuery(). + */ +void +_mesa_check_query(GLcontext *ctx, struct gl_query_object *q) +{ + /* No-op for sw rendering. + * HW drivers may need to flush at this time. + */ +} + + /** * Delete a query object. Called via ctx->Driver.DeleteQuery(). * Not removed from hash table here. diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index 9a9774641b..bc02b65b54 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -48,6 +48,9 @@ _mesa_end_query(GLcontext *ctx, struct gl_query_object *q); extern void _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q); +extern void +_mesa_check_query(GLcontext *ctx, struct gl_query_object *q); + extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); -- cgit v1.2.3 From c6de08fff483911953692693c501bc200c235dce Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 11 Jun 2009 19:26:55 +0100 Subject: mesa: Enable uploads of only depth to z24s8 textures --- src/mesa/main/texstore.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f3739f950b..bfced1b3f4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2689,12 +2689,45 @@ GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS) { const GLfloat depthScale = (GLfloat) 0xffffff; + const GLint srcRowStride + = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) + / sizeof(GLuint); + GLint img, row; ASSERT(dstFormat == &_mesa_texformat_z24_s8); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); - ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); + ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); - if (ctx->Pixel.DepthScale == 1.0f && + /* In case we only upload depth we need to preserve the stencil */ + if (srcFormat == GL_DEPTH_COMPONENT) { + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLuint depth[MAX_WIDTH]; + GLint i; + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + depth, /* dst addr */ + depthScale, + srcType, src, srcPacking); + + for (i = 0; i < srcWidth; i++) + dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF); + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } + } + } + else if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes) { /* simple path */ -- cgit v1.2.3