[Mesa-dev] [PATCH] main/base_tex_format: Properly handle STENCIL_INDEX1/4/16

Ilia Mirkin imirkin at alum.mit.edu
Tue Mar 3 13:36:33 PST 2015


On Tue, Mar 3, 2015 at 4:31 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>
>
> On Tue, Mar 3, 2015 at 1:00 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>
>> On Tue, Mar 3, 2015 at 3:58 PM, Kenneth Graunke <kenneth at whitecape.org>
>> wrote:
>> > On Monday, March 02, 2015 02:33:31 PM Ilia Mirkin wrote:
>> >> On Mon, Mar 2, 2015 at 2:32 PM, Jason Ekstrand <jason at jlekstrand.net>
>> >> wrote:
>> >> >
>> >> >
>> >> > On Mon, Mar 2, 2015 at 11:18 AM, Ilia Mirkin <imirkin at alum.mit.edu>
>> >> > wrote:
>> >> >>
>> >> >> Hmmm... I was just looking at this code in connection to attepmting
>> >> >> to
>> >> >> enable ARB_texture_stencil8, and it _seems_ like that should be if
>> >> >> (ARB_texture_stencil8) -- I didn't see what in ARB_stencil_texturing
>> >> >> had to do with being able to have a GL_STENCIL_INDEX* internal
>> >> >> format...
>> >> >
>> >> >
>> >> > I just pushed it because it does fix a bug...  However, you do raise
>> >> > a good
>> >> > point.  Maybe we should change the i965 driver to use
>> >> > GL_STENCIL_INDEX for
>> >> > the internal format for our internal stencil buffers.
>> >>
>> >> How do you end up with a GL_STENCIL_INDEX internal format in the first
>> >> place? Without ARB_texture_stencil8 that's not a thing, is it?
>> >
>> > Eric added a ctx->Driver.BindRenderbufferTexImage hook which takes a
>> > (non-texture) renderbuffer and wraps it in a fake texture image.
>> >
>> > We use this in Meta's BlitFramebuffer implementation to be able to blit
>> > from non-texture renderbuffers.  i965 also has a custom meta blit path
>> > for stencil, which uses the same approach.  Thus, stencil textures :)
>>
>> None of which has to do with ARB_stencil_texturing being enabled as
>> far as mesa/main is concerned, right? IOW, why is that condition
>> there?
>
>
> Well, the blit path does require it because it requires us to be able to
> sample from stencil.  Why does it require the internal format?  That's
> another question.

Right... so I totally believe you that this is necessary to not crash
your driver :) I'm just questioning whether this is the right fix, or
the right condition, or whatever. If I understand correctly, it will
happily let me create a GL_STENCIL_INDEX texture even though that's
not allowed without ARB_texture_stencil8. A driver which enables
ARB_stencil_texturing (like st/mesa) will probably become confused at
this and fail.

Someone already added a ARB_texture_stencil8 bool to gl_extensions
even though the extension is not fully-enableable... perhaps it was
for this? Or perhaps there should be a driver-specific hook to the
base function which enables this sort of logic. Or some other
solution.

  -ilia


More information about the mesa-dev mailing list