Ian Romanick wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Roland Scheidegger wrote: >> Ian Romanick wrote: >>> I just finished adding support for depth textures to r300. I'd like to >>> add support for shadow maps too. r300 implements shadow comparisons via >>> fragment program instructions instead of sampler state (like i9xx). >>> That seems to imply that we'd want to add support to texenvprogram.c to >>> generate the extra instructions. >>> >>> I have a couple questions about doing this: >>> >>> 1. How should a driver communicate to texenvprogram.c that it needs the >>> extra instructions? r300 will need this, but i9xx (and possibly r400?) >>> won't. >>> >>> 2. Where's the right place to do it in texenvprogram.c? >> Are you sure texenvprogram.c is the right place at all? This isn't >> really specific to ARB_shadow. Both GLSL (shadow samplers) and >> ARB_fragment_program (with the ARB_fragment_program_shadow option only) >> should probably get exactly the same treatment. >> This is something which should be more easily addressed with gallium. > > That's true. I expect that this will be handled in a nice, uniform way > in gallium. However, it seems like we're still a ways off from gallium > settling down and getting r300 support. I'd like to have something in > the mean time. :)
There's some rough spots in the current shadow sampling code in Mesa that you might want to address first. A depth texture can be interpreted either as Z values which get compared against one of the texture coords (the shadow test) or as a grayscale texture. In swrast, the gl_texture_object->_Function field is used to make the determination. With GLSL and ARB_fragment_program_shadow, the interpretation is specified by the user's choice of texture instructions/functions in their programs. So, the _Function field determination won't work if a single depth texture is bound to two different texture units, one accessed through a shadow sampler, one accessed as regular RGBA. I think we need to either: a) add an extra field (or re-use an existing) field of prog_instruction to indicate that the texture operation should do the shadow comparison. b) add new OPCODEs for shadow-mode texture fetches. Then, prog_execute.c would examine the instruction shadow bit at runtime and do the right thing. For drivers like R300, you'd examine the TEX instruction to determine if you need to emit the comparison instructions. For conventional, fixed-function texturing you'd have to regenerate the R300 fragment program depending on the texture object's CompareOperator and CompareMode fields. How does that sound? -Brian ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Mesa3d-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
