I was thinking the same thing. It should be possible for backends to do this on their own. That said, for the d3d10 opcodes with shadow comparison we actually have SAMPLE_C_LZ already since d3d10 exposes that (unlike glsl), though we don't really make any use of it (gallivm just will put in a zero as the lod parameter in the end...). The TEX opcodes have a bit quirky encoding due to the "packed" arguments, so I guess you'd have to pass the target along. It sounds to me like this just introduces gallium opcodes to paper over a backend deficiency. Though since IIRC most (all recent?) hw actually supports such instructions directly, why not... (Another question would then be, does this really warrant a cap bit (the ever-increasing cap hell...), or should it just be mandatory.)
Roland Am 07.03.2017 um 13:38 schrieb Ilia Mirkin: > Why can't the compiler perform this opt? At least we do that in nouveau... > > On Mar 7, 2017 7:33 AM, "Marek Olšák" <[email protected] > <mailto:[email protected]>> wrote: > > Hi, > > These new TGSI opcodes are for better code generation in drivers. If you > know the mipmap level or LOD is 0, you don't have to pass 0 to texture > instructions on hardware that has dedicated instructions for level-zero > fetches. This saves a temporary register that is usually required for > the level or LOD parameter. > > This change surprisingly reduces VGPR register spilling for DiRT > Showdown > on radeonsi, but that doesn't seem to have a visible effect on > performance. > We can't make this improvement at the LLVM level though. > > Note that TXF with an MSAA target and TG4 already imply level = 0. > > Please review. > > Marek > _______________________________________________ > mesa-dev mailing list > [email protected] <mailto:[email protected]> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0&m=0bK3zKm1g8FZ_JK22QL0R-wRpxQnKuEO0xWS7CLTjXw&s=DdBJZvhs4_7wLsu_hB1rHcDSq_wVIJW-FISUNigrSLs&e=> > > > > _______________________________________________ > mesa-dev mailing list > [email protected] > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0&m=0bK3zKm1g8FZ_JK22QL0R-wRpxQnKuEO0xWS7CLTjXw&s=DdBJZvhs4_7wLsu_hB1rHcDSq_wVIJW-FISUNigrSLs&e= > > _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
