Bug 93704

Summary: Stencil blits from targets other than GL_TEXTURE_2D or GL_TEXTURE_2D_MULTISAMPLE are probably broken
Product: Mesa Reporter: Ian Romanick <idr>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED MOVED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: emil.l.velikov, idr
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Ian Romanick 2016-01-14 02:46:09 UTC
The setup_program function in brw_meta_stencil_blit.c (http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c#n282) can only generate shader variations for GL_TEXTURE_2D and GL_TEXTURE_2D_MULTISAMPLE.  However, if I add an assertion

   assert(target == GL_TEXTURE_2D || target == GL_TEXTURE_2D_MULTISAMPLE);

at the single caller of the function, the arb_stencil_texturing-blit_corrupts_state test (http://patchwork.freedesktop.org/patch/70427/) fails the assertion for every other target.  That indicates to me that blits from those other targets probably don't work.

We need a test like arb_stencil_texturing-blit_corrupts_state that verifies the result of blitting from every possible texture target.  It shouldn't be too hard to adapt the existing arb_stencil_texturing-draw test.
Comment 1 Ian Romanick 2016-01-14 04:37:43 UTC
And... that is the only test that fails the assertion. :(

Looking back at the GIT history, it appears that GL_TEXTURE_2D and GL_TEXTURE_2D_MULTISAMPLE
Comment 2 Ian Romanick 2016-01-14 04:40:57 UTC
Looking back at the GIT history, it appears that GL_TEXTURE_2D and GL_TEXTURE_2D_MULTISAMPLE were the only targets supported when GL_ARB_stencil_texturing did not exist.  A renderbuffer was the only way to get stencil because internally we use separate stencil on these GENs even for packed depth / stencil targets.  _mesa_meta_bind_rb_as_tex_image would only generate those two targets.

When support for GL_ARB_stencil_texturing was added for GEN8+, we had only one test in piglit.  It didn't hit the non-GL_TEXTURE_2D* path, so nobody noticed.
Comment 3 Ian Romanick 2016-01-14 18:40:38 UTC
Inspecting brw_meta_stencil_blit, I believe it is also broken for blitting to anything other than the mipmap 0.
Comment 4 GitLab Migration User 2019-09-25 18:55:49 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1508.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.