[Mesa-dev] [PATCH 2/4] mesa: fix texstore of DEPTH24_STENCIL8 if srcFormat is STENCIL_INDEX
Marek Olšák
maraeo at gmail.com
Fri Jun 24 08:58:03 PDT 2011
On Fri, Jun 24, 2011 at 3:15 PM, Brian Paul <brianp at vmware.com> wrote:
> On 06/23/2011 08:39 PM, Marek Olšák wrote:
>>
>> NOTE: This is a candidate for the 7.10 branch.
>> ---
>> src/mesa/main/texstore.c | 9 ++++++---
>> 1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
>> index 6da3e4e..5c925a3 100644
>> --- a/src/mesa/main/texstore.c
>> +++ b/src/mesa/main/texstore.c
>> @@ -3308,10 +3308,12 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
>> GLint img, row;
>>
>> ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
>> - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat ==
>> GL_DEPTH_COMPONENT);
>> + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
>> + srcFormat == GL_DEPTH_COMPONENT ||
>> + srcFormat == GL_STENCIL_INDEX);
>> ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType ==
>> GL_UNSIGNED_INT_24_8_EXT);
>>
>> - if (srcFormat != GL_DEPTH_COMPONENT&& ctx->Pixel.DepthScale == 1.0f&&
>> + if (srcFormat == GL_DEPTH_STENCIL&& ctx->Pixel.DepthScale == 1.0f&&
>> ctx->Pixel.DepthBias == 0.0f&&
>> !srcPacking->SwapBytes) {
>> /* simple path */
>> @@ -3322,7 +3324,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
>> srcWidth, srcHeight, srcDepth, srcFormat, srcType,
>> srcAddr, srcPacking);
>> }
>> - else if (srcFormat == GL_DEPTH_COMPONENT) {
>> + else if (srcFormat == GL_DEPTH_COMPONENT ||
>> + srcFormat == GL_STENCIL_INDEX) {
>> /* In case we only upload depth we need to preserve the stencil */
>> for (img = 0; img< srcDepth; img++) {
>> GLuint *dstRow = (GLuint *) dstAddr
>
> Hmmm, is a call like glTexImage(internalFormat=GL_DEPTH_STENCIL,
> format=GL_STENCIL_INDEX, type=GL_UNSIGNED_BYTE) even legal? I haven't
> checked the spec or Mesa.
>
> When does this combo happen?
It's not legal, but the format can be used in place of S8, causing the
function to receive STENCIL_INDEX data. The code for stencil is there,
it's just not enabled. That's what the patch fixes.
Marek
More information about the mesa-dev
mailing list